diff --git a/en/application-dev/application-models/enterprise-extensionAbility.md b/en/application-dev/application-models/enterprise-extensionAbility.md index 514e254f77981977c7c425a4ea2ddbebbcff9ca8..3750b2298ba5321194d827edde4ad7c526b467f7 100644 --- a/en/application-dev/application-models/enterprise-extensionAbility.md +++ b/en/application-dev/application-models/enterprise-extensionAbility.md @@ -1,54 +1,54 @@ # 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*** +- **Function constraints** - The APIs provided can be used only by device administrator applications. + EnterpriseAdminExtensionAbility is applicable only to enterprise 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 | +| 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 | 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 | onAdminEnabled(): void | Called when a device administrator application is activated. | +| 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 +56,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,7 +78,7 @@ 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()** and **unsubscribeManagedEvent()** 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. ```ts @State managedEvents: Array = [0,1] @@ -108,4 +108,3 @@ Use the **subscribeManagedEvent** and **unsubscribeManagedEvent** APIs in the ** } ``` - diff --git a/en/application-dev/connectivity/http-request.md b/en/application-dev/connectivity/http-request.md index da1a7e1c517f284037a41a88e2167b6d1d2406aa..a266e285245c932534873440fc777fd86ccd480d 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 -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,33 @@ 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(); } } ); ``` + +## 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/socket-connection.md b/en/application-dev/connectivity/socket-connection.md index 96c802d565d0e58201b627d18be1e59093919a07..b0c6fcd63d49a6cf9b77662d8340cadc8f82735d 100644 --- a/en/application-dev/connectivity/socket-connection.md +++ b/en/application-dev/connectivity/socket-connection.md @@ -49,6 +49,7 @@ TLS Socket connection functions are mainly provided by the **tls_socket** module | 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.| @@ -189,7 +190,7 @@ TLS Socket connection process on the client: let tlsTwoWay = socket.constructTLSSocketInstance(); // Subscribe to TLS Socket connection events. - tcp.on('message', value => { + tlsTwoWay.on('message', value => { console.log("on message") let buffer = value.message let dataView = new DataView(buffer) @@ -199,10 +200,10 @@ TLS Socket connection process on the client: } console.log("on connect received:" + str) }); - tcp.on('connect', () => { + tlsTwoWay.on('connect', () => { console.log("on connect") }); - tcp.on('close', () => { + tlsTwoWay.on('close', () => { console.log("on close") }); @@ -245,23 +246,23 @@ TLS Socket connection process on the client: console.log(data); }); - // Enable the TLS Socket connection to be automatically closed after use. Then, disable listening for TLS Socket connection events. - tls.close((err) => { + // 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"); } - tls.off('message'); - tls.off('connect'); - tls.off('close'); + 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. - tcp.on('message', value => { + tlsTwoWay.on('message', value => { console.log("on message") let buffer = value.message let dataView = new DataView(buffer) @@ -271,10 +272,10 @@ TLS Socket connection process on the client: } console.log("on connect received:" + str) }); - tcp.on('connect', () => { + tlsTwoWay.on('connect', () => { console.log("on connect") }); - tcp.on('close', () => { + tlsTwoWay.on('close', () => { console.log("on close") }); @@ -306,16 +307,16 @@ TLS Socket connection process on the client: console.log(data); }); - // Enable the TLS Socket connection to be automatically closed after use. Then, disable listening for TLS Socket connection events. - tls.close((err) => { + // 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"); } - tls.off('message'); - tls.off('connect'); - tls.off('close'); + tlsTwoWay.off('message'); + tlsTwoWay.off('connect'); + tlsTwoWay.off('close'); }); ``` diff --git a/en/application-dev/quick-start/Readme-EN.md b/en/application-dev/quick-start/Readme-EN.md index e0350b4c4ab31285f37eb18e819a4e84ad0759a7..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) @@ -17,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/application-package-structure-stage.md b/en/application-dev/quick-start/application-package-structure-stage.md index b9bd91d798c6a57c06c74cebb38bf558c8fa011d..cb6dc3b12ef12ff249d8afaa9871f901babd9412 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. @@ -27,6 +27,6 @@ To develop an application based on the [stage model](application-configuration-f - 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/cross-app-hsp.md b/en/application-dev/quick-start/cross-app-hsp.md new file mode 100644 index 0000000000000000000000000000000000000000..15345c966babd31b925d29160325eaf66e5b1140 --- /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. Third-party developers can only use the system-provided inter-application HSP files. + +## 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 +└── package.json +``` +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 an 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.json** 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/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/har-package.md b/en/application-dev/quick-start/har-package.md new file mode 100644 index 0000000000000000000000000000000000000000..71cc22a71f970d6fe9e7d3638b36da0e16b9d8de --- /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 **package.json** 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/in-app-hsp.md b/en/application-dev/quick-start/in-app-hsp.md new file mode 100644 index 0000000000000000000000000000000000000000..05380e9c6f3f3e631c56955128318d394a97f774 --- /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 +└── package.json +``` +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 **package.json** 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 **package.json** 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/src/main/module.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 2f308d7e5936d4fd62fbf5c22cee827e7bbc38a4..8fca81167d6d016376877602de947c4c9cc83bd1 100644 --- a/en/application-dev/quick-start/module-configuration-file.md +++ b/en/application-dev/quick-start/module-configuration-file.md @@ -487,11 +487,12 @@ 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 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/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md index 4f2555b95a8651ade5b99ec329033dd7bfdb184f..8b73384ec9064e0b7adb64c29529c909489edd74 100644 --- a/en/application-dev/reference/apis/Readme-EN.md +++ b/en/application-dev/reference/apis/Readme-EN.md @@ -237,6 +237,7 @@ - [@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 (Picker)](js-apis-file-picker.md) @@ -245,6 +246,7 @@ - [@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.fileShare (File Sharing)](js-apis-fileShare.md) - Telephony Service - [@ohos.contact (Contacts)](js-apis-contact.md) 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-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-call.md b/en/application-dev/reference/apis/js-apis-call.md index 6b6222abe96a415e28290892f8e6a215c1e98478..b6b2bddb6306e577053b5ea9e34c21acf23c9477 100644 --- a/en/application-dev/reference/apis/js-apis-call.md +++ b/en/application-dev/reference/apis/js-apis-call.md @@ -20,6 +20,10 @@ dial\(phoneNumber: string, callback: AsyncCallback\): void Initiates a call. This API uses an asynchronous callback to return the result. +>**NOTE** +> +>This parameter is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9). + **Required Permissions**: ohos.permission.PLACE_CALL **System capability**: SystemCapability.Telephony.CallManager @@ -46,6 +50,10 @@ dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback**NOTE** +> +>This parameter is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9). + **Required Permissions**: ohos.permission.PLACE_CALL **System capability**: SystemCapability.Telephony.CallManager @@ -75,6 +83,10 @@ dial\(phoneNumber: string, options?: DialOptions\): Promise Initiates a call. You can set call options as needed. This API uses a promise to return the result. +>**NOTE** +> +>This parameter is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9). + **Required Permissions**: ohos.permission.PLACE_CALL **System capability**: SystemCapability.Telephony.CallManager @@ -121,11 +133,12 @@ Initiates a call. This API uses an asynchronous callback to return the result. **Parameters** | 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 | @@ -140,8 +153,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -call.dialCall("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)}`); }); ``` @@ -161,12 +174,13 @@ Initiates a call. You can set call options as needed. This API uses an asynchron **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. | +| 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 | @@ -186,8 +200,8 @@ call.dialCall("138xxxxxxxx", { videoState: 0, dialScene: 0, dialType: 0, -}, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -209,15 +223,16 @@ Initiates a call. You can set call options as needed. This API uses a promise to | Name | Type | Mandatory| Description | | ----------- | ----------------------------------- | ---- | -------------------------------------- | | phoneNumber | string | Yes | Phone number. | -| options | [DialCallOptions](#dialcalloptions9)| No | Call option, which indicates whether the call is a voice call or video call.| +| 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. | +| 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 | @@ -232,12 +247,17 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```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.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)}`); +}); ``` @@ -257,6 +277,7 @@ Launches the call screen and displays the dialed number. This API uses an asynch | 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 | @@ -297,6 +318,7 @@ Launches the call screen and displays the dialed number. This API uses a promise | 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 | @@ -450,6 +472,7 @@ Checks whether the called number is an emergency number. This API uses an asynch | 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 | @@ -486,6 +509,7 @@ Checks whether the called number is an emergency number based on the phone numbe | 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 | @@ -527,6 +551,7 @@ Checks whether the called number is an emergency number based on the phone numbe | 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 | @@ -566,6 +591,7 @@ A formatted phone number is a standard numeric string, for example, 555 0100. | 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 | @@ -603,6 +629,7 @@ A formatted phone number is a standard numeric string, for example, 555 0100. | 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 | @@ -648,6 +675,7 @@ A formatted phone number is a standard numeric string, for example, 555 0100. | 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 | @@ -690,6 +718,7 @@ The phone number must match the specified country code. For example, for a China | 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 | @@ -735,6 +764,7 @@ All country codes are supported. | 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 | @@ -775,10 +805,12 @@ Mutes the ringtone while it is playing. It does not work if the ringtone has bee | 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. | @@ -788,8 +820,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -813,13 +845,12 @@ Mutes the ringtone while it is playing. It does not work if the ringtone has bee | 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. | @@ -827,16 +858,15 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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.answerCall7+ +## call.answerCall9+ answerCall\(callId: number, callback: AsyncCallback\): void @@ -856,6 +886,7 @@ Answers a call. This API uses an asynchronous callback 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 | @@ -870,13 +901,13 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -call.answerCall(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.answerCall7+ +## call.answerCall9+ answerCall(callId?: number\): Promise @@ -901,6 +932,7 @@ Answers a call. 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 | @@ -915,10 +947,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -let promise = call.answerCall(1); -promise.then(data => { - console.log(`answerCall success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.answerCall(1).then(() => { + console.log(`answerCall success.`); +}).catch((err) => { console.error(`answerCall fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -943,6 +974,7 @@ Answers a call. This API uses an asynchronous callback 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 | @@ -957,13 +989,13 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -call.answerCall((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.answerCall((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.hangUpCall7+ +## call.hangUpCall9+ hangUpCall\(callId: number, callback: AsyncCallback\): void @@ -983,6 +1015,7 @@ Ends a call. This API uses an asynchronous callback 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 | @@ -997,13 +1030,13 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -call.hangUpCall(1, (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.hangUpCall7+ +## call.hangUpCall9+ hangUpCall\(callId?: number\): Promise @@ -1028,6 +1061,7 @@ Ends a call. 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 | @@ -1042,10 +1076,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -let promise = call.hangUpCall(1); -promise.then(data => { - console.log(`hangUpCall success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.hangUpCall(1).then(() => { + console.log(`hangUpCall success.`); +}).catch((err) => { console.error(`hangUpCall fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1070,6 +1103,7 @@ Ends a call. This API uses an asynchronous callback 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 | @@ -1085,13 +1119,13 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -call.hangUpCall((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.hangUpCall((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.rejectCall7+ +## call.rejectCall9+ rejectCall(callId: number, callback: AsyncCallback\): void @@ -1111,6 +1145,7 @@ Rejects a call. This API uses an asynchronous callback 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 | @@ -1126,13 +1161,13 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -call.rejectCall(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.rejectCall7+ +## call.rejectCall9+ rejectCall\(callId: number, options: RejectMessageOptions, callback: AsyncCallback\): void @@ -1153,6 +1188,7 @@ Rejects a call. This API uses an asynchronous callback 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 | @@ -1170,13 +1206,13 @@ For details about the following error codes, see [Telephony Error Codes](../../r let rejectMessageOptions={ messageContent: "Unknown number blocked" } -call.rejectCall(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.rejectCall7+ +## call.rejectCall9+ rejectCall(callId?: number, options?: RejectMessageOptions\): Promise @@ -1202,6 +1238,7 @@ Rejects a call. 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 | @@ -1219,11 +1256,10 @@ For details about the following error codes, see [Telephony Error Codes](../../r let rejectMessageOptions={ messageContent: "Unknown number blocked" } -let promise = call.rejectCall(1, rejectMessageOptions); -promise.then(data => { - console.log(`rejectCall success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { - console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`); +call.reject(1, rejectMessageOptions).then(() => { + console.log(`reject success.`); +}).catch((err) => { + console.error(`reject fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1247,6 +1283,7 @@ Rejects a call. This API uses an asynchronous callback 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 | @@ -1261,8 +1298,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -call.rejectCall((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.rejectCall((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1287,6 +1324,7 @@ Rejects a call. This API uses an asynchronous callback 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 | @@ -1304,8 +1342,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r let rejectMessageOptions={ messageContent: "Unknown number blocked" } -call.rejectCall(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)}`); }); ``` @@ -1330,6 +1368,7 @@ Holds a call based on the specified call ID. This API uses an asynchronous callb | 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 | @@ -1344,8 +1383,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -1375,6 +1414,7 @@ Holds a call based on the specified call ID. This API uses a promise to return t | 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 | @@ -1389,10 +1429,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -1417,6 +1456,7 @@ Unholds a call based on the specified call ID. This API uses an asynchronous cal | 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 | @@ -1431,8 +1471,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -1462,6 +1502,7 @@ Unholds a call based on the specified call ID. This API uses a promise to return | 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 | @@ -1476,10 +1517,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -1504,6 +1544,7 @@ Switches a call. This API uses an asynchronous callback 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 | @@ -1518,8 +1559,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -1549,6 +1590,7 @@ Switches a call. 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 | @@ -1563,10 +1605,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -1589,6 +1630,7 @@ Combines two calls into a conference call. This API uses an asynchronous callbac | 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 | @@ -1602,8 +1644,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -1631,6 +1673,7 @@ Combines two calls into a conference call. This API uses a promise to return the | 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 | @@ -1644,10 +1687,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -1670,6 +1712,7 @@ Obtains the main call ID. This API uses an asynchronous callback to return the r | 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 | @@ -1713,6 +1756,7 @@ Obtains the main call ID. 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 | @@ -1752,6 +1796,7 @@ Obtains the list of subcall IDs. This API uses an asynchronous callback to retur | 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 | @@ -1794,6 +1839,7 @@ Obtains the list of subcall IDs. 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 | @@ -1833,6 +1879,7 @@ Obtains the list of call IDs in a conference. This API uses an asynchronous call | 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 | @@ -1875,6 +1922,7 @@ Obtains the list of call IDs in a conference. This API uses a promise to return | 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 | @@ -1916,6 +1964,7 @@ Obtains the call waiting status. This API uses an asynchronous callback to retur | 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 | @@ -1961,6 +2010,7 @@ Obtains the call waiting status. This API uses a promise to return the result. | 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 | @@ -2004,6 +2054,7 @@ Sets the call waiting switch. This API uses an asynchronous callback to return t | 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 | @@ -2018,8 +2069,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -2050,6 +2101,7 @@ Sets the call waiting switch. 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 | @@ -2064,10 +2116,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -2091,6 +2142,7 @@ Enables DTMF. This API uses an asynchronous callback 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 | @@ -2104,8 +2156,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -2134,6 +2186,7 @@ Enables DTMF. 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 | @@ -2147,10 +2200,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -2173,6 +2225,7 @@ Stops DTMF. This API uses an asynchronous callback 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 | @@ -2186,8 +2239,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -2215,6 +2268,7 @@ Stops DTMF. 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 | @@ -2228,10 +2282,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -2255,6 +2308,7 @@ Checks whether a call is an emergency call. This API uses an asynchronous callba | 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 | @@ -2294,6 +2348,7 @@ Checks whether a call is an emergency call. This API uses a promise to return th | 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 | @@ -2332,10 +2387,11 @@ Subscribes to **callDetailsChange** events. This API uses an asynchronous callba | 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 | Event type. 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 | @@ -2371,10 +2427,11 @@ Subscribes to **callEventChange** events. This API uses an asynchronous callback | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------ | ---- | -------------------------- | -| type | string | Yes | Call event change during a call.| +| type | string | Yes | This interface is used to monitor the change of call events during a call. The parameter 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 | @@ -2410,10 +2467,11 @@ Subscribes to **callDisconnectedCause** events. This API uses an asynchronous ca | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------ | ---- | -------------------------- | -| type | string | Yes | Cause of the call disconnection.| +| type | string | Yes | Event type. The 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 | @@ -2449,10 +2507,11 @@ Subscribes to **mmiCodeResult** events. This API uses an asynchronous callback t | Name | Type | Mandatory| Description | | -------- | -------------------------------------------- | ---- | --------------------- | -| type | string | Yes | Man-machine interface (MMI) code result.| +| type | string | Yes | Event type. The 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 | @@ -2488,10 +2547,11 @@ Unsubscribes from **callDetailsChange** events. This API uses an asynchronous ca | Name | Type | Mandatory| Description | | -------- | -------------------------------------------------------- | ---- | ---------------------------------- | -| type | string | Yes | IMS registration status changes.| +| type | string | Yes | Event type. The 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 | @@ -2527,10 +2587,11 @@ Unsubscribes from **callEventChange** events. This API uses an asynchronous call | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------ | ---- | ---------------------------------- | -| type | string | Yes | Unsubscription from call event changes when a call ends.| +| type | string | Yes | Event type. The 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 | @@ -2565,11 +2626,12 @@ Unsubscribes from **callDisconnectedCause** events. This API uses an asynchronou **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 | Event type. The 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 | @@ -2603,12 +2665,13 @@ Unsubscribes from **mmiCodeResult** events. This API uses an asynchronous callba **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 | Event type. The 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 | @@ -2645,6 +2708,7 @@ Checks whether a new call is allowed. This API uses an asynchronous callback to | 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 | @@ -2681,6 +2745,7 @@ Checks whether a new call is allowed. This API uses a promise to return the resu | 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 | @@ -2720,6 +2785,7 @@ Separates calls from a conference call. This API uses an asynchronous callback t | 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 | @@ -2733,8 +2799,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -2762,6 +2828,7 @@ Separates calls from a conference call. This API uses a promise to return the re | 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 | @@ -2775,10 +2842,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -2804,6 +2870,7 @@ Obtains the call restriction status. This API uses an asynchronous callback to r | 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 | @@ -2850,6 +2917,7 @@ Obtains the call restriction status. This API uses a promise to return the resul | Promise<[RestrictionStatus](#restrictionstatus8)> | 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 | @@ -2893,6 +2961,7 @@ Sets the call restriction status. This API uses an asynchronous callback to retu | 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 | @@ -2912,8 +2981,8 @@ let callRestrictionInfo={ password: "123456", mode: 1 } -call.setCallRestriction(0, callRestrictionInfo, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.setCallRestriction(0, callRestrictionInfo, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2944,6 +3013,7 @@ Sets the call restriction status. 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 | @@ -2963,10 +3033,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)}`); }); ``` @@ -2992,6 +3061,7 @@ Obtains call transfer information. This API uses an asynchronous callback to ret | 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 | @@ -3038,6 +3108,7 @@ Obtains call transfer information. This API uses a promise to return the result. | Promise<[CallTransferResult](#calltransferresult8)> | 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 | @@ -3081,6 +3152,7 @@ Sets call transfer information. This API uses an asynchronous callback to return | 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 | @@ -3100,8 +3172,8 @@ let callTransferInfo={ type: 1, settingType: 1 } -call.setCallTransfer(0, callTransferInfo, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.setCallTransfer(0, callTransferInfo, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3132,6 +3204,7 @@ Sets call transfer information. 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 | @@ -3151,10 +3224,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)}`); }); ``` @@ -3178,6 +3250,7 @@ Checks whether the ringtone is playing. This API uses an asynchronous callback t | 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 | @@ -3217,6 +3290,7 @@ Checks whether the ringtone is playing. 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 | @@ -3256,6 +3330,7 @@ Sets call muting. This API uses an asynchronous callback 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 | @@ -3269,8 +3344,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -3292,6 +3367,7 @@ Sets call muting. 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 | @@ -3305,10 +3381,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -3330,6 +3405,7 @@ Cancels call muting. This API uses an asynchronous callback 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 | @@ -3343,8 +3419,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -3366,6 +3442,7 @@ Cancels call muting. 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 | @@ -3379,10 +3456,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -3405,6 +3481,7 @@ Sets the audio device for a call. This API uses an asynchronous callback to retu | 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 | @@ -3418,8 +3495,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -3443,6 +3520,7 @@ Sets the audio device for a call based on the specified options. This API uses a | 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 | @@ -3459,8 +3537,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r 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)}`); }); ``` @@ -3489,6 +3567,7 @@ Sets the audio device for a call based on the specified options. This API uses a | 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 | @@ -3505,10 +3584,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r 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)}`); }); ``` @@ -3532,6 +3610,7 @@ Joins a conference call. This API uses an asynchronous callback to return the re | 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 | @@ -3548,8 +3627,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r 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)}`); }); ``` @@ -3577,6 +3656,7 @@ Joins a conference call. 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 | @@ -3593,10 +3673,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r let callNumberList: Array = [ "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)}`); }); ``` @@ -3620,6 +3699,7 @@ Updates the IMS call mode. This API uses an asynchronous callback to return the | 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 | @@ -3633,8 +3713,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -call.updateImsCallMode(1, 1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.updateImsCallMode(1, 1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3662,6 +3742,7 @@ Updates the IMS call mode. 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 | @@ -3675,10 +3756,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -3703,6 +3783,7 @@ Enables the IMS switch. This API uses an asynchronous callback to return the res | 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 | @@ -3717,8 +3798,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -3747,6 +3828,7 @@ Enables the IMS switch. 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 | @@ -3761,10 +3843,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -3789,6 +3870,7 @@ Disables the IMS switch. This API uses an asynchronous callback to return the re | 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 | @@ -3803,8 +3885,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -3822,20 +3904,21 @@ Disables the IMS switch. This API uses a promise to return the result. **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 | +| ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | | 401 | Parameter error. | @@ -3847,10 +3930,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r **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)}`); }); ``` @@ -3873,6 +3955,7 @@ Checks whether the IMS switch is enabled. This API uses an asynchronous callback | 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 | @@ -3914,6 +3997,7 @@ Checks whether the IMS switch is enabled. This API uses a promise to return the | 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 | 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-file-fileUri.md b/en/application-dev/reference/apis/js-apis-file-fileUri.md new file mode 100644 index 0000000000000000000000000000000000000000..9f524c06525a1a1f6ebdd8b2fd0117a2c43b89d5 --- /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-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-geoLocationManager.md b/en/application-dev/reference/apis/js-apis-geoLocationManager.md index 0d56943e531718578ac4d0238bb2f6770df277d7..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 @@ -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 @@ -840,7 +840,7 @@ 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, @@ -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-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-hiviewdfx-hiappevent.md b/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md index 2960e201db397e160dfc5cca7e1c729beebcb6a4..03cad26cfecb5295b611d48fbc9f69862895ddb0 100644 --- a/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md +++ b/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md @@ -1,6 +1,6 @@ # @ohos.hiviewdfx.hiAppEvent (Application Event Logging) -This module provides application event-related functions, including flushing application events to a disk, querying and clearing application events, and customizing application event logging configuration. +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** > @@ -120,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 diff --git a/en/application-dev/reference/apis/js-apis-http.md b/en/application-dev/reference/apis/js-apis-http.md index 4335d191f899346a3f0644c8f3571a0eff7c8212..820cba210b6b8b43578733c1a2eb060177aa5995 100644 --- a/en/application-dev/reference/apis/js-apis-http.md +++ b/en/application-dev/reference/apis/js-apis-http.md @@ -1,6 +1,6 @@ # @ohos.net.http (Data Request) -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**. +This 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** > @@ -13,10 +13,10 @@ The **http** module provides the HTTP data request capability. An application ca import http from '@ohos.net.http'; ``` -## Examples +## Example ```js -// Import the HTTP namespace. +// Import the http namespace. import http from '@ohos.net.http'; // Each httpRequest corresponds to an HTTP request task and cannot be reused. @@ -27,7 +27,7 @@ httpRequest.on('headersReceive', (header) => { console.info('header: ' + JSON.stringify(header)); }); httpRequest.request( - // Customize EXAMPLE_URL in extraData on your own. It is up to you whether to add parameters to the URL. + // Customize EXAMPLE_URL 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. @@ -112,7 +112,7 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback **Error codes** -| ID | Error Message | +| Code | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -164,7 +164,7 @@ Initiates an HTTP request containing specified options to a given URL. This API **Error codes** -| ID | Error Message | +| Code | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -231,7 +231,7 @@ httpRequest.request("EXAMPLE_URL", request(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. +Initiates an HTTP request 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. @@ -255,7 +255,7 @@ Initiates an HTTP request containing specified options to a given URL. This API **Error codes** -| ID | Error Message | +| Code | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -349,7 +349,7 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback **Error codes** -| ID | Error Message | +| Code | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -395,7 +395,7 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback **Error codes** -| ID | Error Message | +| Code | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -477,7 +477,7 @@ Initiates an HTTP request containing specified options to a given URL. This API **Error codes** -| ID | Error Message | +| Code | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -513,7 +513,7 @@ Initiates an HTTP request containing specified options to a given URL. This API >**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: +> 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** @@ -839,7 +839,7 @@ Enumerates the response codes for an HTTP request. | Name | Value | Description | | ----------------- | ---- | ------------------------------------------------------------ | -| OK | 200 | "OK." The request has been processed successfully. This return code is generally used for GET and POST requests. | +| OK | 200 | The request is successful. The request has been processed successfully. This return code is generally used for GET and POST requests. | | CREATED | 201 | "Created." The request has been successfully sent and a new resource is created. | | ACCEPTED | 202 | "Accepted." The request has been accepted, but the processing has not been completed. | | NOT_AUTHORITATIVE | 203 | "Non-Authoritative Information." The request is successful. | @@ -1007,7 +1007,7 @@ 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** 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 92450992f6d642dc1583f3147827a94622bcc96a..445443209e3ca4a670cfced56f285530144505c4 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 (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. @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -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; } @@ -818,7 +818,7 @@ Performs an action based on the specified action name. This API uses a promise t | Name | Type | Mandatory | Description | | ----------- | ---------------------------------------- | ---- | -------------- | -| actionName | string | Yes | Action name. | +| actionName | string | Yes | Action name. For details, see [Action](./js-apis-accessibility.md#action). | parameters | object | No | Parameter required for performing the target action. | **Return value** @@ -861,7 +861,7 @@ 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** @@ -900,7 +900,7 @@ Performs an action based on the specified action name. This API uses an asynchro | Name | Type | Mandatory | Description | | ----------- | ---------------------------------------- | ---- | -------------- | -| actionName | string | Yes | Action name. | +| actionName | string | Yes | Action name. For details, see [Action](./js-apis-accessibility.md#action).| | parameters | object | Yes | Parameter required for performing the target action. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| diff --git a/en/application-dev/reference/apis/js-apis-intl.md b/en/application-dev/reference/apis/js-apis-intl.md index 22b2225382e82166356b37003483c7c27a1400e0..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 **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** 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 3445952a9c818fad947373508accb50322e8cf59..d86e3904ec9c8789a645fde87492da5f5cd0c250 100644 --- a/en/application-dev/reference/apis/js-apis-net-ethernet.md +++ b/en/application-dev/reference/apis/js-apis-net-ethernet.md @@ -114,9 +114,9 @@ ethernet.setIfaceConfig("eth0", { 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)); }); ``` @@ -207,15 +207,15 @@ Obtains the configuration of a network interface. This API uses a promise to ret ```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)); }); ``` @@ -300,9 +300,9 @@ Checks whether a network interface is active. This API uses a promise to return ```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)); }); ``` @@ -377,12 +377,12 @@ Obtains the list of all active network interfaces. This API uses a promise to re ```js ethernet.getAllActiveIfaces().then((data) => { - console.log("getAllActiveIfaces promiss data.length = " + JSON.stringify(data.length)); + console.log("getAllActiveIfaces promise 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 = " + JSON.stringify(data[i])); } }).catch(error => { - console.log("getAllActiveIfaces promiss error = " + JSON.stringify(error)); + console.log("getAllActiveIfaces promise error = " + JSON.stringify(error)); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-observer.md b/en/application-dev/reference/apis/js-apis-observer.md index 2d56d02d2ec4e0f2117266569cb5bfd905f1b338..3c46e47479de6cacc6a0a2613f0aa422aad9aff8 100644 --- a/en/application-dev/reference/apis/js-apis-observer.md +++ b/en/application-dev/reference/apis/js-apis-observer.md @@ -10,7 +10,7 @@ The **observer** module provides event subscription management functions. You ca ## Modules to Import ``` -import observer from '@ohos.telephony.observer' +import observer from '@ohos.telephony.observer'; ``` ## observer.on('networkStateChange') @@ -31,7 +31,6 @@ Registers an observer for network status change events. This API uses an asynchr | 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 | | -------- | -------------------------------------------- | @@ -45,7 +44,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -observer.on('networkStateChange', data =>{ +observer.on('networkStateChange', data => { console.log("on networkStateChange, data:" + JSON.stringify(data)); }); ``` @@ -70,7 +69,6 @@ Registers an observer for network status change events of the SIM card in the sp | 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 | | -------- | -------------------------------------------- | @@ -84,7 +82,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -observer.on('networkStateChange', {slotId: 0}, data =>{ +observer.on('networkStateChange', {slotId: 0}, data => { console.log("on networkStateChange, data:" + JSON.stringify(data)); }); ``` @@ -145,7 +143,6 @@ Registers an observer for signal status change events. This API uses an asynchro | 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 | | -------- | -------------------------------------------- | @@ -159,7 +156,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -observer.on('signalInfoChange', data =>{ +observer.on('signalInfoChange', data => { console.log("on signalInfoChange, data:" + JSON.stringify(data)); }); ``` @@ -182,7 +179,6 @@ Registers an observer for signal status change events of the SIM card in the spe | 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 | | -------- | -------------------------------------------- | @@ -196,7 +192,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -observer.on('signalInfoChange', {slotId: 0}, data =>{ +observer.on('signalInfoChange', {slotId: 0}, data => { console.log("on signalInfoChange, data:" + JSON.stringify(data)); }); ``` @@ -222,7 +218,6 @@ Unregisters the observer for signal status change events. This API uses an async | 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 | | -------- | -------------------------------------------- | @@ -244,6 +239,125 @@ 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') @@ -261,7 +375,6 @@ Registers an observer for call status change events. This API uses an asynchrono | 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 | | -------- | -------------------------------------------- | @@ -274,7 +387,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -observer.on('callStateChange', value =>{ +observer.on('callStateChange', value => { console.log("on callStateChange, state:" + value.state + ", number:" + value.number); }); ``` @@ -297,7 +410,6 @@ Registers an observer for call status change events. This API uses an asynchrono | 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 | | -------- | -------------------------------------------- | @@ -310,7 +422,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -observer.on('callStateChange', {slotId: 0}, value =>{ +observer.on('callStateChange', {slotId: 0}, value => { console.log("on callStateChange, state:" + value.state + ", number:" + value.number); }); ``` @@ -336,7 +448,6 @@ Unregisters the observer for call status change events. This API uses an asynchr | 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 | | -------- | -------------------------------------------- | @@ -375,7 +486,6 @@ Registers an observer for connection status change events of the cellular data l | 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 | | -------- | -------------------------------------------- | @@ -388,7 +498,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -observer.on('cellularDataConnectionStateChange', value =>{ +observer.on('cellularDataConnectionStateChange', value => { console.log("on cellularDataConnectionStateChange, state:" + value.state + ", network:" + value.network); }); ``` @@ -411,7 +521,6 @@ Registers an observer for connection status change events of the cellular data l | 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 | | -------- | -------------------------------------------- | @@ -424,7 +533,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -observer.on('cellularDataConnectionStateChange', {slotId: 0}, value =>{ +observer.on('cellularDataConnectionStateChange', {slotId: 0}, value => { console.log("on cellularDataConnectionStateChange, state:" + value.state + ", network:" + value.network); }); ``` @@ -450,7 +559,6 @@ Unregisters the observer for connection status change events of the cellular dat | 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 | | -------- | -------------------------------------------- | @@ -489,7 +597,6 @@ Registers an observer for the uplink and downlink data flow status change events | 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 | | -------- | -------------------------------------------- | @@ -502,7 +609,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -observer.on('cellularDataFlowChange', data =>{ +observer.on('cellularDataFlowChange', data => { console.log("on networkStateChange, data:" + JSON.stringify(data)); }); ``` @@ -525,7 +632,6 @@ Registers an observer for the uplink and downlink data flow status change events | 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 | | -------- | -------------------------------------------- | @@ -538,7 +644,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -observer.on('cellularDataFlowChange', {slotId: 0}, data =>{ +observer.on('cellularDataFlowChange', {slotId: 0}, data => { console.log("on cellularDataFlowChange, data:" + JSON.stringify(data)); }); ``` @@ -564,7 +670,6 @@ Unregisters the observer for the uplink and downlink data flow status change eve | 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 | | -------- | -------------------------------------------- | @@ -603,7 +708,6 @@ Registers an observer for SIM card status change events. This API uses an asynch | 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 | | -------- | -------------------------------------------- | @@ -616,7 +720,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -observer.on('simStateChange', data =>{ +observer.on('simStateChange', data => { console.log("on simStateChange, data:" + JSON.stringify(data)); }); ``` @@ -639,7 +743,6 @@ Registers an observer for status change events of the SIM card in the specified | 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 | | -------- | -------------------------------------------- | @@ -652,7 +755,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r **Example** ```js -observer.on('simStateChange', {slotId: 0}, data =>{ +observer.on('simStateChange', {slotId: 0}, data => { console.log("on simStateChange, data:" + JSON.stringify(data)); }); ``` @@ -678,7 +781,6 @@ Unregisters the observer for SIM card status change events. This API uses an asy | 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 | | -------- | -------------------------------------------- | @@ -732,6 +834,6 @@ Enumerates SIM card types and states. | 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).| +| 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-radio.md b/en/application-dev/reference/apis/js-apis-radio.md index 1df1b8d7dd61ca1c5a92b65c1557aed3697a36e0..448ccd3dc7d40a17edfdb7b0862cefe3a2377f9e 100644 --- a/en/application-dev/reference/apis/js-apis-radio.md +++ b/en/application-dev/reference/apis/js-apis-radio.md @@ -394,7 +394,6 @@ Obtains the ID of the slot in which the primary card is located. This API uses a | 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** @@ -427,7 +426,6 @@ Obtains the ID of the slot in which the primary card is located. This API uses a | 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** diff --git a/en/application-dev/reference/apis/js-apis-socket.md b/en/application-dev/reference/apis/js-apis-socket.md index 626107db787301b55615b8354996e149eff20ede..27d1b5cb9a3e0fc77437ab1bdee1b81a30dcaecc 100644 --- a/en/application-dev/reference/apis/js-apis-socket.md +++ b/en/application-dev/reference/apis/js-apis-socket.md @@ -1,4 +1,4 @@ -# # @ohos.net.socket (Socket Connection) +# Socket Connection The **socket** module implements data transfer over TCPSocket, UDPSocket, WebSocket, and TLSSocket connections. @@ -364,7 +364,7 @@ udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback\): void -Sets other attributes of the UDPSocket connection. This API uses an asynchronous callback to return the result. +Sets other properties of the UDPSocket connection. This API uses an asynchronous callback to return the result. >**NOTE** >This API can be called only after **bind** is successfully called. @@ -418,7 +418,7 @@ udp.bind({address:'192.168.xx.xxx', port:xxxx, family:1}, err=> { setExtraOptions(options: UDPExtraOptions): Promise\ -Sets other attributes of the UDPSocket connection. This API uses a promise to return the result. +Sets other properties of the UDPSocket connection. This API uses a promise to return the result. >**NOTE** >This API can be called only after **bind** is successfully called. @@ -522,7 +522,7 @@ 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'); ``` @@ -582,14 +582,14 @@ 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'); ``` @@ -646,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'); ``` @@ -1426,7 +1426,7 @@ 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'); ``` @@ -1486,14 +1486,14 @@ 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'); ``` @@ -1550,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'); ``` 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-brightness.md b/en/application-dev/reference/apis/js-apis-system-brightness.md index 939e7d7021bc8f93ad7359004de58f525feeee05..3cc0779edf610eb39cda868abc84d353c6b05dc6 100644 --- a/en/application-dev/reference/apis/js-apis-system-brightness.md +++ b/en/application-dev/reference/apis/js-apis-system-brightness.md @@ -45,7 +45,7 @@ Obtains the current screen brightness. ## brightness.setValue -etValue(options?: SetBrightnessOptions): void +setValue(options?: SetBrightnessOptions): void Sets the screen brightness. @@ -74,7 +74,7 @@ Sets the screen brightness. ## brightness.getMode -getMode(options?: GetBrightnessModeOptions: void +getMode(options?: GetBrightnessModeOptions): void Obtains the screen brightness adjustment mode. @@ -161,67 +161,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-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 7d03495284b4a0a805d1b90b0c46eaf1997200e9..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** @@ -70,7 +48,7 @@ export default { console.log('success get location data. latitude:' + data.latitude); }, fail: function(data, code) { - console.log('fail to get location. code:' + code + ', data:' + data); + console.log('fail to get location. code:' + code + ', data:' + data); } }); } @@ -80,12 +58,12 @@ export default { ## 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** @@ -192,7 +146,7 @@ Cancels listening to the geographic location. ``` export default { unsubscribe() { - geolocation.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-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 index 521fef517823a160e22a17b752fdc62443eeba7a..49bb9b53a08027852baa2614975e6ec9f53d90e9 100644 --- a/en/application-dev/reference/apis/js-apis-usb.md +++ b/en/application-dev/reference/apis/js-apis-usb.md @@ -1,9 +1,12 @@ -# @ohos.usbV9 (USB Management) +# @ohos.usbV9 (USB) 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**
+> **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 no longer maintained since API version 9. You are advised to use [`@ohos.usbManager`](js-apis-usbManager.md). ## Modules to Import @@ -29,7 +32,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: [ @@ -86,7 +89,7 @@ console.log(`devicesList = ${JSON.stringify(devicesList)}`); connectDevice(device: USBDevice): Readonly<USBDevicePipe> -Connects to a USB device based on the device list obtained by using **getDevices()**. +Connects to the USB device based on the device information returned by **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. @@ -118,13 +121,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 @@ -133,7 +135,7 @@ 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. +Checks whether the user, for example, the application or system, has the device access permissions. The value **true** is returned if the user has the device access permissions; the value **false** is returned otherwise. **System capability**: SystemCapability.USB.USBManager @@ -182,7 +184,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}`); }); ``` @@ -210,7 +212,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`); } ``` @@ -245,7 +247,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`); } ``` @@ -454,8 +456,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}`); }) ``` @@ -491,7 +494,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}`); }); ``` @@ -578,7 +581,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); ``` @@ -600,14 +603,14 @@ Sets the current USB function list in Device mode. **Return value** -| Type | Description | -| ------------------ | ------------------------------------------------------------ | +| Type | Description | +| --------------- | ------------- | | Promise\ | Promise used to return the result.| **Example** ```js -let funcs = HDC; +let funcs = usb.HDC; usb.setCurrentFunctions(funcs).then(() => { console.info('usb setCurrentFunctions successfully.'); }).catch(err => { @@ -707,15 +710,15 @@ Sets the role types supported by a specified port, which can be **powerRole** (f **Return value** -| Type | Description | -| ------------------ | ------------------------------------------------------------ | -| Promise\ | Promise used to return the result. | +| 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(() => { +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); @@ -730,14 +733,14 @@ Represents the USB endpoint from which data is sent or received. You can obtain | 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.| +| 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 @@ -747,13 +750,13 @@ Represents a USB interface. One [USBConfig](#usbconfig) can contain multiple **U | 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. | +| 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 @@ -763,13 +766,13 @@ Represents the USB configuration. One [USBDevice](#usbdevice) can contain multip | 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. | +| 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 @@ -779,19 +782,19 @@ Represents the USB device 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 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.| +| 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 @@ -812,12 +815,12 @@ Represents control transfer parameters. | 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. | +| 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 @@ -829,9 +832,9 @@ Represents a USB port. | 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. | +| 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 @@ -843,9 +846,9 @@ Enumerates USB port roles. | Name | Type| Mandatory |Description | | ---------------- | -------- | ---------------- |---------------------- | -| currentMode | number | Yes | Current USB mode. | -| currentPowerRole | number | Yes | Current power role. | -| currentDataRole | number | Yes | Current data role.| +| currentMode | number | Yes|Current USB mode. | +| currentPowerRole | number | Yes |Current power role. | +| currentDataRole | number | Yes |Current data role.| ## USBRequestTargetType @@ -853,12 +856,12 @@ 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 | +| 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 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-webSocket.md b/en/application-dev/reference/apis/js-apis-webSocket.md index 6319fda995850708da44bec6c7d00dc158193516..bd7a55c09324684d80e787174483fcc8aefd884e 100644 --- a/en/application-dev/reference/apis/js-apis-webSocket.md +++ b/en/application-dev/reference/apis/js-apis-webSocket.md @@ -64,7 +64,7 @@ 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. @@ -89,7 +89,7 @@ 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. @@ -128,7 +128,7 @@ 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. @@ -173,7 +173,7 @@ 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. @@ -217,7 +217,7 @@ 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. @@ -229,7 +229,7 @@ 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** @@ -258,7 +258,7 @@ 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. @@ -270,7 +270,7 @@ 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** @@ -303,7 +303,7 @@ 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. @@ -341,7 +341,7 @@ 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. @@ -383,7 +383,7 @@ 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. @@ -427,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. @@ -453,9 +453,9 @@ 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. @@ -484,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. >**NOTE** ->The data in **AsyncCallback** can be in the format of string\(API 6\) or ArrayBuffer\(API 8\). +>The data in **AsyncCallback** can be in the format of string (API version 6) or ArrayBuffer (API version 8). **System capability**: SystemCapability.Communication.NetStack @@ -512,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. >**NOTE** ->The data in **AsyncCallback** can be in the format of string\(API 6\) or ArrayBuffer\(API 8\). +>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 @@ -539,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. @@ -552,7 +552,7 @@ 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** @@ -564,9 +564,9 @@ ws.on('close', (err, value) => { ``` -### 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. @@ -580,7 +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** @@ -590,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. @@ -615,9 +615,9 @@ 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. diff --git a/en/application-dev/reference/errorcodes/errorcode-hiappevent.md b/en/application-dev/reference/errorcodes/errorcode-hiappevent.md index eb6d5000d0c0f82d5dddfa4f6985b1f308677b4a..46256b87f89e224891a4428c9cc429bec0781bf6 100644 --- a/en/application-dev/reference/errorcodes/errorcode-hiappevent.md +++ b/en/application-dev/reference/errorcodes/errorcode-hiappevent.md @@ -15,6 +15,7 @@ This error code is reported if the **write** API is called to perform applicatio The application event logging function is disabled. **Solution** + Invoke the **configure** API to enable the application event logging function. ```js @@ -41,6 +42,7 @@ The specified event domain name does not comply with the following rules: - The event domain name is not empty and contains a maximum of 32 characters. **Solution** + Specify a valid event domain name. ## 11101002 Invalid Event Name diff --git a/en/application-dev/reference/errorcodes/errorcode-net-socket.md b/en/application-dev/reference/errorcodes/errorcode-net-socket.md index ebd15740b694e135c394b9459c06a7f09438fc8f..d4c982d29c9b402d5f2ed5a5af0ec57537aec19a 100644 --- a/en/application-dev/reference/errorcodes/errorcode-net-socket.md +++ b/en/application-dev/reference/errorcodes/errorcode-net-socket.md @@ -1,5 +1,9 @@ # Socket Error Codes +> **NOTE** +> +> The following describes only the error codes specific to the **socket** module. For details about common error codes, see [Common Error Codes](errorcode-universal.md) file. + ## 2301001 Operation Not Allowed **Error Message** diff --git a/en/application-dev/reference/syscap-list.md b/en/application-dev/reference/syscap-list.md index a51200c0fdb7e0ac0ef1e68c7bb44ab7cea33a0b..7c099ac348c597c2b888ca37295bcf82c8ca0c90 100644 --- a/en/application-dev/reference/syscap-list.md +++ b/en/application-dev/reference/syscap-list.md @@ -1,6 +1,6 @@ # SystemCapability List -SysCap, short for System Capability, refers to a standalone feature in the OpenHarmony system. +SystemCapability (SysCap) is a standalone feature in the OpenHarmony system. Before using an API for development, you are advised to familiarize yourself with [SysCap](syscap.md), and then consult the following tables to see whether the SysCap set required for the API is supported by the target device type. @@ -172,14 +172,6 @@ Basic network management services | ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | | Yes | No | Yes | Yes | Yes | Yes | No | No | -## SystemCapability.Communication.NetManager.Extension - -Extended network management services - -| Default | Sports Watch| Smart Watch| Tablet| Head Unit| Smart TV| Smart Vision | Router | -| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | -| Yes | No | No | Yes | Yes | Yes | No | No | - ## SystemCapability.Communication.NetStack Basic network stack capability @@ -315,14 +307,6 @@ Input device management | ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | | Yes | No | No | Yes | Yes | Yes | No | No | -## SystemCapability.MultimodalInput.Input.RemoteInputDevice - -Distributed input device management - -| Default | Sports Watch| Smart Watch| Tablet| Head Unit| Smart TV| Smart Vision | Router | -| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | -| Yes | No | No | Yes | Yes | Yes | No | No | - ## SystemCapability.MultimodalInput.Input.InputMonitor Input event listener @@ -347,14 +331,6 @@ Input event simulator | ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | | Yes | No | No | Yes | Yes | Yes | No | No | -## SystemCapability.MultimodalInput.Input.InputFilter - -Input event filter - -| Default | Sports Watch| Smart Watch| Tablet| Head Unit| Smart TV| Smart Vision | Router | -| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | -| Yes | No | No | Yes | Yes | Yes | No | No | - ## SystemCapability.PowerManager.BatteryManager.Extension Battery manager extension capability @@ -453,7 +429,7 @@ Media audio recorder capability ## SystemCapability.Multimedia.Media.VideoPlayer -Media video player capability +Video player capability | Default | Sports Watch| Smart Watch| Tablet| Head Unit| Smart TV| Smart Vision | Router | | ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | @@ -1347,7 +1323,7 @@ Contacts | ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | | Yes | No | Yes | Yes | Yes | No | No | No | -## SystemCapability.Applictaions.settings.Core +## SystemCapability.Applications.settings.Core API setting @@ -1658,3 +1634,35 @@ Quick fix | Default | Sports Watch| Smart Watch| Tablet| Head Unit| Smart TV| Smart Vision | Router | | ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | | Yes | No | Yes | Yes | Yes | Yes | No | No | + +## SystemCapability.MultimodalInput.Input.Pointer + +Pointer input enhancement + +| Default | Sports Watch| Smart Watch| Tablet| Head Unit| Smart TV| Smart Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| Yes | No | No | Yes | Yes | Yes | No | No | + +## SystemCapability.Communication.SecureElement + +Secure element access + +| Default | Sports Watch| Smart Watch| Tablet| Head Unit| Smart TV| Smart Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| No | No | No | No | No | No | No | No | + +## SystemCapability.Msdp.DeviceStatus.Stationarty + +Device status awareness + +| Default | Sports Watch| Smart Watch| Tablet| Head Unit| Smart TV| Smart Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| Yes | No | No | Yes | Yes | Yes | No | No | + +## SystemCapability.Base + +General type + +| Default | Sports Watch| Smart Watch| Tablet| Head Unit| Smart TV| Smart Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | diff --git a/en/device-dev/subsystems/Readme-EN.md b/en/device-dev/subsystems/Readme-EN.md index 580b86372075c5473c9f06a0b946a2c28f6b3d4c..3c97fc6d362ffb32a79bab32490658047cde7aad 100644 --- a/en/device-dev/subsystems/Readme-EN.md +++ b/en/device-dev/subsystems/Readme-EN.md @@ -109,3 +109,6 @@ - [bytrace](subsys-toolchain-bytrace-guide.md) - [hdc](subsys-toolchain-hdc-guide.md) - [hiperf](subsys-toolchain-hiperf.md) +- Power Management + - Display Management + - [System Brightness Customization](subsys-power-brightness-customization.md) diff --git a/en/device-dev/subsystems/subsys-dfx-hitracemeter.md b/en/device-dev/subsystems/subsys-dfx-hitracemeter.md index ce844c8a900854b1dc0101b79ff500edb65d6ac8..e80731582852658e6a65c6fc8f8d7cb66ca746a0 100644 --- a/en/device-dev/subsystems/subsys-dfx-hitracemeter.md +++ b/en/device-dev/subsystems/subsys-dfx-hitracemeter.md @@ -12,15 +12,13 @@ The HiTraceMeter subsystem consists of three parts: - hitrace CLI tool for data collection - smartperf tool for graphical data analysis -Wherein, HiTraceMeter APIs and the hitrace CLI tool run on the device side, and the smartperf tool runs on the PC side. - -HiTraceMeter APIs are provided in C++ and JS for event logging, which aims to generate the trace data necessary for performance tracing and analysis during the development process. +Wherein, HiTraceMeter APIs and the hitrace CLI tool run on the device side, and the smartperf tool runs on the PC side. HiTraceMeter APIs are provided in C++ and JS for event logging, which aims to generate the trace data necessary for performance tracing and analysis during the development process. The hitrace CLI tool is used to collect trace data. It captures trace data flows and saves the data as a text file. The smartperf tool allows you to perform data analysis manually or use the analysis script for automated data analysis. If you want to get the data analysis done automatically, you need to supply the data file generated by the hitrace CLI tool as the input for the smartperf tool. -Traces data is classified by trace tag or trace category. Generally, one device subsystem corresponds to one tag. The tag is passed as the **Tag** parameter to event logging APIs. When you use the hitrace CLI tool to collect trace data, only the trace data specified by the **Tag** parameter is collected. Trace data of applications is fixedly labeled as **APP Tag**, and therefore, no **Tag** parameter needs to be passed to JS APIs. The following is a list of trace tags supported by HiTraceMeter. You can view the tags in [hitrace_meter.h](https://gitee.com/openharmony/hiviewdfx_hitrace/blob/master/interfaces/native/innerkits/include/hitrace_meter/hitrace_meter.h). + Traces data is classified by trace tag or trace category. Generally, one device subsystem corresponds to one tag. The tag is passed as the **Tag** parameter to event logging APIs. When you use the hitrace CLI tool to collect trace data, only the trace data specified by the **Tag** parameter is collected. Trace data of applications is fixedly labeled as **APP Tag**, and therefore, no **Tag** parameter needs to be passed to JS APIs. The following is a list of trace tags supported by HiTraceMeter. You can view the tags in [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. @@ -73,7 +71,7 @@ constexpr uint64_t HITRACE_TAG_NOT_READY = (1ULL << 63); // Reserved for initial constexpr uint64_t HITRACE_TAG_VALID_MASK = ((HITRACE_TAG_LAST - 1) | HITRACE_TAG_LAST); ``` -## Implementation Principle +## Implementation Principles HiTraceMeter provides the hitrace CLI tool for capturing trace data in user mode and kernel mode, and provides C++ (innerkits) and JS (kits) APIs for event logging in user mode. Through extending kernel's ftrace functionality, HiTraceMeter can use the trace_marker node of ftrace to write the data, which is written into the user space by event logging APIs, to the kernel buffer. The following figure shows the basic HiTraceMeter architecture. @@ -83,14 +81,13 @@ HiTraceMeter provides the hitrace CLI tool for capturing trace data in user mode - ## Constraints - The implementation of HiTraceMeter functions and APIs depends on the ftrace functionality, a framework provided by the kernel. It enables developers to add more trace functions via plug-ins. Therefore, make sure that ftrace is enabled before you use HiTraceMeter. - For most Linux kernels, ftrace is enabled by default. For details, see the ftrace documentation you may obtain. + For most Linux kernels, ftrace is enabled by default. For details, see the ftrace documentation you may obtain. - HiTraceMeter is available only for the mini system and standard system. - - + + # HiTraceMeter Development @@ -98,7 +95,6 @@ HiTraceMeter development focuses on two parts: JS/C++ event logging APIs and the - ## When to Use You may encounter unexpected issues like app freezing during app development or need to view the code's call chain during code debugging. With the APIs provided by HiTraceMeter, you'll be able to trace the application delay and call chain to identify performance problems. @@ -109,20 +105,19 @@ Only C++ APIs are now open for system developers. If you're developing a JS app, **Table 1** Sync APIs -| API | Function |Parameter Description | -| :----------------------------------------------------------- | ------------- |------------- | -| void StartTrace(uint64_t label, const std::string& value, float limit = -1); | Starts a synchronous trace.|**label**: trace category.
**value**: trace data that indicates the specific status, such as the memory size and queue length.| -| void FinishTrace(uint64_t label); | Stops a synchronous trace.|**label**: trace category.| - +| Sync trace | Function | Parameter Description | +|:---------------------------------------------------------------------------- | --------- | --------------------------------------------------------------------- | +| void StartTrace(uint64_t label, const std::string& value, float limit = -1); | Starts a synchronous trace.| **label**: trace category.
**value**: trace data that indicates the specific status, such as the memory size and queue length.| +| void FinishTrace(uint64_t label); | Stops a synchronous trace.| **label**: trace category. | **StartTrace** and **FinishTrace** must be used in pairs, and **FinishTrace** matches the latest **StartTrace**. The two APIs can be used in nested mode. The stack data structure is used for matching during trace data parsing. The **limit** parameter is used for flow control, and you are advised to use the default value. **Table 2** Async APIs -| API | Function |Parameter Description | -| ------------------------------------------------------------ | ------------- |------------- | +| Async trace | Function | Parameter Description | +| ------------------------------------------------------------------------------------------------- | --------- | ---------------------------------------------------------------------------------------------------- | | void StartAsyncTrace(uint64_t label, const std::string& value, int32_t taskId, float limit = -1); | Starts an asynchronous trace.| **label**: trace category.
**value**: trace data that indicates the specific status, such as the memory size and queue length.
**taskId**: ID used to indicate the association of APIs in an asynchronous trace.| -| void FinishAsyncTrace(uint64_t label, const std::string& value, int32_t taskId); | Stops an asynchronous trace.| **label**: trace category.
**value**: trace data that indicates the specific status, such as the memory size and queue length.
**taskId**: ID used to indicate the association of APIs in an asynchronous trace.| +| void FinishAsyncTrace(uint64_t label, const std::string& value, int32_t taskId); | Stops an asynchronous trace.| **label**: trace category.
**value**: trace data that indicates the specific status, such as the memory size and queue length.
**taskId**: ID used to indicate the association of APIs in an asynchronous trace.| @@ -130,160 +125,144 @@ The trace data of **StartAsyncTrace** and **FinishAsyncTrace** is matched based **Table 3** Counter APIs -| API | Function |Parameter Description | -| ------------------------------------------------------------ | --------- |--------- | -| void CountTrace(uint64_t label, const std::string& name, int64_t); | Performs a count trace.|**label**: trace category.
**name**: trace name displayed in the IDE.| - +| Counter Trace | Function | Parameter Description | +| ------------------------------------------------------------------ | ------- | -------------------------------------------------------------- | +| void CountTrace(uint64_t label, const std::string& name, int64_t); | Count trace.| **label**: trace category.
**name**: trace name displayed in the IDE.| ## How to Develop + 1. Add the build dependencies to the build configuration file **base\hiviewdfx\hitrace\cmd\BUILD.gn**. + + ``` + external_deps = [ "hitrace_native:hitrace_meter"] + ``` - ``` - external_deps = [ "hitrace_native:hitrace_meter"] - ``` 2. Add the header file dependencies. - - ```cpp - #include "hitrace_meter.h"// Header file for defining APIs - ``` - -3. When calling an API, pass the trace value as an input parameter. After the hitrace command is executed in the shell, the trace data is automatically captured. The captured data includes the function call process and the memory and time consumed during this process. You can use the data to analyze the call process to identify performance problems. - - - ```cpp - - CountTrace(label, "count number", 2000); // Integer trace - - StartTrace(label, "func1Trace", -1); // Trace start point of func1Start - - FinishTrace(label); // Trace end point of func1Trace - - StartAsyncTrace(label, "asyncTrace1", 1234); // Start point of asyncTrace1 - - FinishAsyncTrace(label, "asyncTrace2", 3456); // End point of asyncTrace2 - ``` + + ```cpp + #include "hitrace_meter.h"// Header file for defining APIs + ``` + +3. When calling an API, pass the trace value as an input parameter. The trace tags currently supported are listed in **hitrace_meter.h**. Assume that the trace tag is **OHOS** and trace data of **func1** and **func2** needs to be captured. After the hitrace command is executed in the shell, the trace data is automatically captured. The captured data includes the function call process and the memory and time consumed during this process. You can use the data to analyze the call process to identify performance problems. + + ```cpp + #include "hitrace_meter.h" // Include hitrace_meter.h + using namespace std; + + int main() + { + uint64_t label = BYTRACE_TAG_OHOS; + sleep(1); + CountTrace(label, "count number", 2000); // Integer trace + + StartTrace(label, "func1Trace", -1); // Trace start point of func1Start + sleep(1); + StartTrace(label, "func2Trace", -1); // Trace start point of func2Start + sleep(2); + FinishTrace (label); // Trace end point of func2Trace + sleep(1); + FinishTrace(label); // Trace end point of func1Trace + + StartAsyncTrace(label, "asyncTrace1", 1234); // Trace start point of asyncTrace1 + FinishAsyncTrace(label, "asyncTrace1", 1234); // Trace end point of asyncTrace1 + + return 0; + } + ``` 4. On completion of HiTraceMeter building and deployment, start a trace. After you run the application in the shell on the device, trace data will be captured automatically. - - ``` - hdc_std shell hitrace -t 10 ohos > .\myapp_demo.ftrace - ``` - - You can open the captured data by clicking **Open trace file** in the smartperf tool or dragging the data to the graphics area. For details, see [smartperf](https://toscode.gitee.com/openharmony-sig/smartperf). - -## Development Example - -You can access a full list of trace tags supported by HiTraceMeter in **hitrace_meter.h**. The following uses the **OHOS** tag as an example to illustrate how to obtain the trace data of the **func1** and **func2** functions. - -```cpp -#include "hitrace_meter.h" // Include hitrace_meter.h -using namespace std; - -int main() -{ - uint64_t label = BYTRACE_TAG_OHOS; - sleep(1); - CountTrace(label, "count number", 2000); // Integer trace - - StartTrace(label, "func1Trace", -1); // Trace start point of func1Start - sleep(1); - StartTrace(label, "func2Trace", -1); // Trace start point of func2Start - sleep(2); - FinishTrace (label); // Trace end point of func2Trace - sleep(1); - FinishTrace(label); // Trace end point of func1Trace - - return 0; - } -``` - - + + ``` + hdc_std shell hitrace -t 10 ohos > .\myapp_demo.ftrace + ``` + + You can open the captured data by clicking **Open trace file** in the smartperf tool or dragging the data to the graphics area. For details, see [smartperf](https://toscode.gitee.com/openharmony-sig/smartperf). ## Verification The following is a demo debugging process, where the **StartTrace** and **FinishTrace** APIs are used in synchronization mode. 1. Write the test code file [hitrace_example.cpp](https://gitee.com/openharmony/hiviewdfx_hitrace/blob/master/cmd/example/hitrace_example.cpp) by adding the **StartTrace** and **FinishTrace** APIs to the code. - - ```cpp - int main() - { - thread t1(ThreadFunc1); - t1.join(); - - StartTrace(LABEL, "testStart"); - sleep(SLEEP_ONE_SECOND); - - StartTrace(LABEL, "funcAStart", SLEEP_ONE_SECOND); // Trace start point - FuncA(); - FinishTrace(LABEL); - sleep(SLEEP_TWO_SECOND); - - thread t2(ThreadFunc2); - t2.join(); - - StartTrace(LABEL, "funcBStart", SLEEP_TWO_SECOND); - FuncB(); - FinishTrace(LABEL);// Trace end point - sleep(SLEEP_TWO_SECOND); - - sleep(SLEEP_ONE_SECOND); - FinishTrace(LABEL); - FuncC(); - - return 0; - } - ``` + + ```cpp + int main() + { + thread t1(ThreadFunc1); + t1.join(); + + StartTrace(LABEL, "testStart"); + sleep(SLEEP_ONE_SECOND); + + StartTrace(LABEL, "funcAStart", SLEEP_ONE_SECOND); // Trace start point + FuncA(); + FinishTrace(LABEL); + sleep(SLEEP_TWO_SECOND); + + thread t2(ThreadFunc2); + t2.join(); + + StartTrace(LABEL, "funcBStart", SLEEP_TWO_SECOND); + FuncB(); + FinishTrace(LABEL);// Trace end point + sleep(SLEEP_TWO_SECOND); + + sleep(SLEEP_ONE_SECOND); + FinishTrace(LABEL); + FuncC(); + + return 0; + } + ``` 2. Modify the **base\hiviewdfx\hitrace\cmd\BUILD.gn** file, and start building. - - ``` - 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", - ] - } - ``` + + ``` + 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. Place the **hitrace_example** executable file in the **/system/bin** directory of the device, and run the following commands in sequence in the shell: - - ```shell - hitrace --trace_begin ohos - hitrace_exampe - hitrace --trace_dump - ``` - + + ```shell + hitrace --trace_begin ohos + hitrace_exampe + hitrace --trace_dump + ``` + If the expected trace value is present in the trace data, the capture of trace data is successful. For example: - - ``` - <...>-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 - ``` - - + + ``` + <...>-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 + ``` + + # Using the hitrace CLI Tool @@ -291,71 +270,82 @@ The hitrace CLI tool is an executable binary program. On an OpenHarmony-powered **Table 4** Command list -| Option | Description | -| ------------------------------ | ------------------------------------------------------------ | +| Option | Description | +| ----------------------------- | -------------------------------------------------------- | | -h, --help | Views the help Information. | -| -b *n*, --buffer_size *n* | Sets the buffer size for trace data in KB. The default value is **2048**. | -| -t *n*, --time *n* | Sets the trace uptime in seconds, which depends on the time required for analysis.| -| --trace_clock clock | Sets the type of the clock for adding a timestamp to a trace. The value can be **boot** (default), **global**, **mono**, **uptime**, or **perf**.| -| --trace_begin | Starts capturing trace data. | -| --trace_dump | Dumps trace data to the specified position. The default position is the console. | -| --trace_finish | Stops capturing trace data and dumps trace data to the specified position. The default position is the console. | -| -l, --list_categories | Lists the trace categories supported by the device. | -| --overwrite | Sets the action to take when the buffer is full. If this option is used, the latest trace data is discarded. If this option is not used, the earliest trace data is discarded (default). | -| -o *filename*, --output *filename*| Outputs trace data to the specified file. | -| -z | Compresses the trace data. | +| -b *n*, --buffer_size *n* | Sets the buffer size for trace data in KB. The default value is **2048**. | +| -t *n*, --time *n* | Sets the trace uptime in seconds, which depends on the time required for analysis. | +| --trace_clock clock | Sets the type of the clock for adding a timestamp to a trace. The value can be **boot** (default), **global**, **mono**, **uptime**, or **perf**.| +| --trace_begin | Starts capturing trace data. | +| --trace_dump | Dumps trace data to the specified position. The default position is the console. | +| --trace_finish | Stops capturing trace data and dumps trace data to the specified position. The default position is the console. | +| -l, --list_categories | Lists the trace categories supported by the device. | +| --overwrite | Sets the action to take when the buffer is full. If this option is used, the latest trace data is discarded. If this option is not used, the earliest trace data is discarded (default). | +| -o *filename*, --output *filename*| Outputs trace data to the specified file. | +| -z | Compresses the trace data. | Examples: - Query supported labels. - + ``` + hitrace -l + ``` - - Or, - + + Alternatively, run the following command: + ``` + hitrace --list_categories + ``` - - Trace ability information for 10 seconds and store the trace data in a buffer of 4 MB. - + ``` + hitrace -b 4096 -t 10 --overwrite ability > /data/log/mytrace.ftrace + ``` - - Set the clock type to **mono**. - + ``` + hitrace --trace_clock mono -b 4096 -t 10 --overwrite ability > /data/log/mytrace.ftrace + ``` - - Compress the trace data. - + ``` + hitrace -z -b 4096 -t 10 --overwrite ability > /data/log/mytrace.ftrace + ``` - - + + # FAQs ### Incomplete or Empty Data Captured by hitrace -#### Symptom +#### Symptom + +The data captured by running the hitrace command is incomplete or no data is captured. + +#### **Root Cause** - The data captured by running the hitrace command is incomplete or no data is captured. +The value of **-t** or **-b** buffer is too small, leading to data loss. -#### Solution +#### Solution - Check the value of the **-t** and **-b** parameters. If the value is too small, data loss will occur. You are advised to set **-t** to **60** and **-b** to **204800** to increase the trace capture time and buffer, respectively. +You can set **-t** to **60** and **-b** to **204800** to increase the trace time and buffer size. -# References +# Reference -For details about HiTraceMeter, see [hiviewdfx_hitrace: A Lightweight Distributed Tracing](https://gitee.com/openharmony/hiviewdfx_hitrace). +For details about HiTraceMeter, see [hiviewdfx_hitrace: Lightweight Distributed Tracing](https://gitee.com/openharmony/hiviewdfx_hitrace). diff --git a/en/device-dev/subsystems/subsys-power-brightness-customization.md b/en/device-dev/subsystems/subsys-power-brightness-customization.md new file mode 100644 index 0000000000000000000000000000000000000000..75604d60d5495105a380899d0815c4cc8f2b0098 --- /dev/null +++ b/en/device-dev/subsystems/subsys-power-brightness-customization.md @@ -0,0 +1,191 @@ +# System Brightness Customization + +## Overview + +### Introduction + +By default, the system brightness of OpenHarmony ranges from **0** to **255** (**0** indicates the minimum luminance and **255** the maximum). It is applicable to the entire system and all application windows. Due to hardware restrictions, some display devices are unable to support the system brightness range. To address this issue, OpenHarmony provides the function of customizing the system brightness range. This way, you can adjust the system brightness range based on the hardware specifications of the display devices. + +### Basic Concepts + +**System brightness** +Global brightness of OpenHarmony. The customized brightness range is effective for all application windows. + +**Window brightness** +Brightness of an application window. The customized brightness range is effective only for this application window. After a brightness is specified for an application window, its brightness is not affected by the system brightness. + +### Constraints + +The [sysparam](./subsys-boot-init-sysparam.md) module of OpenHarmony provides an easy-to-use key-value pair access interface for system services to configure service functions based on their own system parameters. The customization of the system brightness range is dependent on this feature. + +## How to Develop + +### Setting Up the Environment + +**Hardware requirements:** + +Development board running the standard system, for example, the DAYU200 or Hi3516D V300 open source suite. + +**Environment requirements:** + +For details about the requirements on the Linux environment, see [Quick Start](../quick-start/Readme-EN.md). + +### How to Develop + +1. In the target directory, create a target folder by referring to the [default brightness value configuration folder](https://gitee.com/openharmony/powermgr_display_manager/tree/master/service/etc). The file format is as follows: + + ```text + etc + ├── BUILD.gn + ├── display.para + ├── display.para.dac + ``` + +2. Write the customized **display.para** file by referring to the [**display.para** file](https://gitee.com/openharmony/powermgr_display_manager/blob/master/service/etc/display.para) in the default brightness range configuration folder. Include the customized brightness thresholds, for example, **max=150**, **default=75**, and **min=50**, into the file: + + ```shell + # Brightness limits is 0-255. + const.display.brightness.min=50 + const.display.brightness.default=75 + const.display.brightness.max=150 + ``` + +3. Write the customized **display.para.dac** file by referring to the [**display.para.dac** file](https://gitee.com/openharmony/powermgr_display_manager/blob/master/service/etc/display.para.dac) in the default brightness range configuration folder, so as to grant the permission required to access the customized configuration. + + ```shell + const.display.brightness.="foundation:foundation:444" + ``` + +4. Write the customized **BUILD.gn** file by referring to the [**BUILD.gn** file](https://gitee.com/openharmony/powermgr_display_manager/blob/master/service/etc/BUILD.gn) in the default brightness range configuration folder. Then, put the **display.para** and **display.para.dac** files to the **/vendor/etc/param** directory. For example: + + ```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. Write the customized **bundle.json** file by referring to the [**bundle.json** file](https://gitee.com/openharmony/powermgr_display_manager/blob/master/bundle.json) in the default brightness range configuration folder, so as to compile the **BUILD.gn** file. + + ```shell + "service_group": [ "//base/powermgr/display_manager/service/etc:param_files" ] + ``` + In the preceding code, **//base/powermgr/display_manager/service** indicates the directory of the created folder, and **etc** indicates the folder name. + +6. Build the customized version by referring to [Quick Start](../quick-start/Readme-EN.md). The following command uses DAYU200 as an example: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +7. Burn the customized version to the DAYU200 development board. + +### Debugging and Verification + +1. After startup, run the following command to launch the shell command line: + + ```shell + hdc shell + ``` + +2. Run the following command to check the console output: + + ```shell + hidumper -s 3308 -a -a + ``` + +3. Check the console output for the customized system brightness thresholds. + + The default system brightness thresholds are as follows: + + ```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 + + ``` + + Assume that the system brightness thresholds are set to **Max=150 Min=50 Default=75**. The console output is as follows: + + ```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. Set the system brightness thresholds to the customized values. + +## Reference + +For details about how to write the configuration file during system brightness customization, refer to the [default brightness range configuration file](https://gitee.com/openharmony/powermgr_display_manager/tree/master/service/etc). + +Default configuration: + +```shell +# Brightness limits is 0-255. +const.display.brightness.min=5 +const.display.brightness.default=102 +const.display.brightness.max=255 +``` + +Packing directory: /system/etc/param diff --git a/en/readme/ai.md b/en/readme/ai.md index 83aa9a2381963c295ba1d54375c98117dff307fc..409bfb226eab0208354adaf65b6a03bda5a99c69 100644 --- a/en/readme/ai.md +++ b/en/readme/ai.md @@ -36,7 +36,7 @@ The AI subsystem is the part of OpenHarmony that provides native distributed AI * **Programming language**: C/C++ -* **Operating system**: OpenHarmony +* **Operating system**: OpenHarmony mini- and small-system * **Others**: The System Ability Manager \(Samgr\) has been started and is running properly. @@ -314,9 +314,7 @@ The AI subsystem is the part of OpenHarmony that provides native distributed AI } ``` -4. Develop a sample application. For details, see the [keyword spotting demo](https://gitee.com/openharmony/applications_sample_camera/tree/master/ai). - - Directory: //applications/sample/camera/ai/asr/keyword\_spotting +4. Develop a sample application. Call the **Create** API. diff --git a/en/readme/network-management.md b/en/readme/network-management.md index 08e5ae88a87a5423efbf05bdf78a818c1ad7dc31..ac7fe63d43054c0badb2fa4d5de27dd117f31022 100644 --- a/en/readme/network-management.md +++ b/en/readme/network-management.md @@ -36,6 +36,8 @@ foundation/communication/ 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. + 6. Call **conn.unregister()** to unsubscribe from the network status changes if required. ``` @@ -43,9 +45,9 @@ foundation/communication/ import connection from '@ohos.net.connection' let netCap = { - // Set the network type to cellular network. + // Set the network type to CELLULAR. bearerTypes: [connection.NetBearType.BEARER_CELLULAR], - // Set the network capability to Internet. + // Set the network capability to INTERNET. networkCap: [connection.NetCap.NET_CAPABILITY_INTERNET], }; let netSpec = { @@ -55,7 +57,7 @@ foundation/communication/ let timeout = 10 * 1000; // Create a NetConnection object. let conn = connection.createNetConnection(netSpec, timeout); - // Subscribe to the netAvailable event. When the network is available, the callback will be invoked to report the event. + // Subscribe to the netAvailable event. conn.on('netAvailable', (data=> { console.log("net is available, netId is " + data.netId); })); @@ -67,16 +69,12 @@ foundation/communication/ ### Sharing a Network -1. Import the network sharing namespace from **@ohos.net.sharing**. - +1. Import the **sharing** namespace from **@ohos.net.sharing**. 2. Set the network sharing type. - 3. Start network sharing. - 4. Stop network sharing. - ``` -// Import the network sharing namespace. +// Import the connection namespace. import sharing from '@ohos.net.sharing'; // Set the network sharing type. this.sharingType = 0; // The value 0 indicates Wi-Fi, 1 indicates USB, and 2 indicates Bluetooth. @@ -92,33 +90,30 @@ sharing.stopSharing(this.sharingType,(err)=>{ ### Initiating a Network Request -1. Import the HTTP namespace from **@ohos.net.http.d.ts**. - +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 an HTTP response header. This method returns a response earlier than the request. You can subscribe to HTTP response header events based on service requirements. - +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 **httpRequest.destroy()** to release resources after the request is processed. +6. Call **off()** to unsubscribe from HTTP response header events. +7. Call **httpRequest.destroy()** to release resources after the request is processed. ``` -// Import the HTTP namespace. +// 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 the response to httpRequest. -httpRequest.on('headersReceive', (data) => { - console.info('header: ' + data.header); +// 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 for the httpRequest. You must specify the URL address, and set httpRequestOptions as required. You can specify the parameters for GET 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: 'POST', // Optional. The default value is GET. + 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' @@ -127,21 +122,28 @@ httpRequest.request( extraData: { "data": "data to send", }, - connectTimeout: 60000, // This parameter is optional. The default value is 60000, that is, 60s. - readTimeout: 60000, // This parameter is optional. The default value is 60000, that is, 60s. - },(err, data) => { + 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 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:' + data.header); - console.info('header:' + data.cookies); + console.info('header:' + JSON.stringify(data.header)); + console.info('cookies:' + JSON.stringify(data.cookies)); // 8+ } else { - console.info('error:' + err); + 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(); } - // Call destroy() to release resources after HttpRequest is complete. - httpRequest.destroy(); } ); ``` @@ -150,8 +152,6 @@ httpRequest.request( **Network Management Subsystem** -[communication_netmanager_base](https://gitee.com/openharmony/communication_netmanager_base) - -[communication_netmanager_ext](https://gitee.com/openharmony/communication_netmanager_ext) - -[communication_netstack](https://gitee.com/openharmony/communication_netstack) \ No newline at end of file +[communication_netmanager_base](https://gitee.com/openharmony/communication_netmanager_base/blob/master/README_zh.md) +[communication_netmanager_ext](https://gitee.com/openharmony/communication_netmanager_ext/blob/master/README_zh.md) +[communication_netstack](https://gitee.com/openharmony/communication_netstack/blob/master/README_zh.md) diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-screenlock.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-screenlock.md new file mode 100644 index 0000000000000000000000000000000000000000..deeaac319aecfd4ba2824b8f23370d6fe2601adc --- /dev/null +++ b/en/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-screenlock.md @@ -0,0 +1,157 @@ +# Theme Framework Subsystem – Screenlock Management Service Changelog + + +## cl.screenlock.1 Permission Change of isLocked and unlock +Changed the **isLocked** and **unlock** APIs to system APIs since API version 9. + +You need to adapt your application based on the following information. + +**Change Impact** + +The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. + +- Involved APIs: + +```js + function isLocked(): boolean; + function unlock(callback: AsyncCallback): void; + function unlock():Promise; +``` + +- Before change: + +```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): 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; +``` + +- After change: + +```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): 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; +``` + + +**Adaptation Guide** + +Make sure the APIs are only invoked by system applications. + +The code snippet is as follows: + +```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 Deprecation of isSecure +Deprecated the **isSecure** API since API version 9. + +You need to adapt your application based on the following information. + +**Change Impact** + +The API can no longer be used after being deleted. + +- Involved APIs: + +```js + function isSecure(): boolean; +``` + +- Before change: + +```js + function isSecure(): boolean; +``` + +- After change: + + The API is deleted. + + +**Adaptation Guide** + +Update the code so that the deprecated API is not used. diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-wallpaper.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-wallpaper.md new file mode 100644 index 0000000000000000000000000000000000000000..18fff418c0723c7508f6c7eacdb318b95758402b --- /dev/null +++ b/en/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-wallpaper.md @@ -0,0 +1,306 @@ +# Theme Framework Subsystem – Wallpaper Management Service Changelog + + +## cl.wallpaper.1 Permission Change of getColorsSync, getMinHeightSync, getMinWidthSync, restore, and setImage +Changed the **getColorsSync**, **getMinHeightSync**, **getMinWidthSync**, restore, and **setImage** APIs to system APIs since API version 9. + +You need to adapt your application based on the following information. + +**Change Impact** + +The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. + +- Involved APIs: + +```js + function getColorsSync(wallpaperType: WallpaperType): Array; + function getMinHeightSync(): number; + function getMinWidthSync(): number; + function restore(wallpaperType: WallpaperType, callback: AsyncCallback): void; + function restore(wallpaperType: WallpaperType): Promise; + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback): void; + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise; +``` + +- Before change: + +```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 } the Array 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; + + /** + * 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; + + /** + * 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; + + /** + * 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; + + /** + * 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; +``` + +- After change: + +```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 } the Array returned by the function. + * @throws {BusinessError} 401 - parameter error. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getColorsSync(wallpaperType: WallpaperType): Array; + + /** + * 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; + + /** + * 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; + + /** + * 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; + + /** + * 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; +``` + + +**Adaptation Guide** + +Make sure the APIs are only invoked by system applications. + +The code snippet is as follows: + +```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 + // The source type is 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 + // The source type is 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 Deprecation of getIdSync, getFileSync, isChangeAllowed, isUserChangeAllowed, on, off, and RgbaColor +Deprecated the **getIdSync**, **getFileSync**, **isChangeAllowed**, **isUserChangeAllowed**, **on**, **off**, and **RgbaColor** APIs since API version 9. + +You need to adapt your application based on the following information. + +**Change Impact** + +The APIs can no longer be used after being deleted. + +- Involved APIs: + +```js + function getIdSync(wallpaperType: WallpaperType): number; + function getFileSync(wallpaperType: WallpaperType): number; + function isChangeAllowed(): boolean; + function isUserChangeAllowed(): boolean; + function on(type: 'colorChange', callback: (colors: Array, wallpaperType: WallpaperType) => void): void; + function off(type: 'colorChange', callback?: (colors: Array, wallpaperType: WallpaperType) => void): void; + interface RgbaColor { + red: number; + green: number; + blue: number; + alpha: number; + } +``` + +- Before change: + +```js + function getIdSync(wallpaperType: WallpaperType): number; + function getFileSync(wallpaperType: WallpaperType): number; + function isChangeAllowed(): boolean; + function isUserChangeAllowed(): boolean; + function on(type: 'colorChange', callback: (colors: Array, wallpaperType: WallpaperType) => void): void; + function off(type: 'colorChange', callback?: (colors: Array, wallpaperType: WallpaperType) => void): void; + interface RgbaColor { + red: number; + green: number; + blue: number; + alpha: number; + } +``` + +- After change: + + The APIs are deleted. + + +**Adaptation Guide** + +Update the code so that the deprecated APIs are not used. diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.2.2/changelogs-global.md b/en/release-notes/changelogs/OpenHarmony_4.0.2.2/changelogs-global.md new file mode 100644 index 0000000000000000000000000000000000000000..e6e84330a176fb8e06a5a7a4dc626aba84b362ef --- /dev/null +++ b/en/release-notes/changelogs/OpenHarmony_4.0.2.2/changelogs-global.md @@ -0,0 +1,57 @@ +# Globalization Subsystem Changelog + +## cl.resourceManager.1 Change in the Meaning of the Return Value for the API Used to Obtain the rawfile Descriptor + +Changed the meaning of the return value for the API used to obtain the rawfile descriptor after the non-decompression feature is added in this version. The change in the meaning of the return value, namely, **descriptor: RawFileDescriptor {fd, offset, length}**, is described as follows: + +**Before change:** + +**fd**: file descriptor for accessing the rawfile. + +**offset**: offset for accessing the rawfile. In this case, the value is **0**. + +**length**: size of the rawfile to access. + +**After change:** + +**fd**: file descriptor for accessing the HAP where the rawfile is located. + +**offset**: offset of the accessed rawfile relative to the HAP. + +**length**: size of the rawfile to access. + +**Change Impact** + +In versions earlier than 4.0.2.2, the rawfile can be accessed only through **fd**. In version 4.0.2.2 or later, the rawfile can be accessed only through **{fd, offset, and length}**. + +**Key API/Component Changes** + +| **Original API** | +| ---------------- | +| getRawFd(path: string, callback: AsyncCallback\): void | +| getRawFd(path: string): Promise\ | +| getRawFileDescriptor(path: string, callback: AsyncCallback\): void| +| getRawFileDescriptor(path: string): Promise\| +|| + +**Sample Code** + +The following is an example of calling the **getRawFd** API: +``` +try { + this.context.resourceManager.getRawFd("test.ogg", (error, value) => { + if (error != null) { + console.log(`callback getRawFd failed error code: ${error.code}, message: ${error.message}.`); + } else { + let fileDescriptor = { + fd = value.fd, + offset = value.offset, + length = value.length + } + this.avPlayer.fdSrc(fileDescriptor); // Take the audio player as an example. When calling fdSrc, pass fileDescriptor in addition to fd. + } + }); + } catch (error) { + console.error(`callback getRawFd failed, error code: ${error.code}, message: ${error.message}.`) + }; +``` diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.5.3/changelog-screenlock.md b/en/release-notes/changelogs/OpenHarmony_4.0.5.3/changelog-screenlock.md new file mode 100644 index 0000000000000000000000000000000000000000..deeaac319aecfd4ba2824b8f23370d6fe2601adc --- /dev/null +++ b/en/release-notes/changelogs/OpenHarmony_4.0.5.3/changelog-screenlock.md @@ -0,0 +1,157 @@ +# Theme Framework Subsystem – Screenlock Management Service Changelog + + +## cl.screenlock.1 Permission Change of isLocked and unlock +Changed the **isLocked** and **unlock** APIs to system APIs since API version 9. + +You need to adapt your application based on the following information. + +**Change Impact** + +The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. + +- Involved APIs: + +```js + function isLocked(): boolean; + function unlock(callback: AsyncCallback): void; + function unlock():Promise; +``` + +- Before change: + +```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): 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; +``` + +- After change: + +```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): 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; +``` + + +**Adaptation Guide** + +Make sure the APIs are only invoked by system applications. + +The code snippet is as follows: + +```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 Deprecation of isSecure +Deprecated the **isSecure** API since API version 9. + +You need to adapt your application based on the following information. + +**Change Impact** + +The API can no longer be used after being deleted. + +- Involved APIs: + +```js + function isSecure(): boolean; +``` + +- Before change: + +```js + function isSecure(): boolean; +``` + +- After change: + + The API is deleted. + + +**Adaptation Guide** + +Update the code so that the deprecated API is not used. diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.5.3/changelog-wallpaper.md b/en/release-notes/changelogs/OpenHarmony_4.0.5.3/changelog-wallpaper.md new file mode 100644 index 0000000000000000000000000000000000000000..18fff418c0723c7508f6c7eacdb318b95758402b --- /dev/null +++ b/en/release-notes/changelogs/OpenHarmony_4.0.5.3/changelog-wallpaper.md @@ -0,0 +1,306 @@ +# Theme Framework Subsystem – Wallpaper Management Service Changelog + + +## cl.wallpaper.1 Permission Change of getColorsSync, getMinHeightSync, getMinWidthSync, restore, and setImage +Changed the **getColorsSync**, **getMinHeightSync**, **getMinWidthSync**, restore, and **setImage** APIs to system APIs since API version 9. + +You need to adapt your application based on the following information. + +**Change Impact** + +The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. + +- Involved APIs: + +```js + function getColorsSync(wallpaperType: WallpaperType): Array; + function getMinHeightSync(): number; + function getMinWidthSync(): number; + function restore(wallpaperType: WallpaperType, callback: AsyncCallback): void; + function restore(wallpaperType: WallpaperType): Promise; + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback): void; + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise; +``` + +- Before change: + +```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 } the Array 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; + + /** + * 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; + + /** + * 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; + + /** + * 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; + + /** + * 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; +``` + +- After change: + +```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 } the Array returned by the function. + * @throws {BusinessError} 401 - parameter error. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getColorsSync(wallpaperType: WallpaperType): Array; + + /** + * 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; + + /** + * 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; + + /** + * 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; + + /** + * 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; +``` + + +**Adaptation Guide** + +Make sure the APIs are only invoked by system applications. + +The code snippet is as follows: + +```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 + // The source type is 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 + // The source type is 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 Deprecation of getIdSync, getFileSync, isChangeAllowed, isUserChangeAllowed, on, off, and RgbaColor +Deprecated the **getIdSync**, **getFileSync**, **isChangeAllowed**, **isUserChangeAllowed**, **on**, **off**, and **RgbaColor** APIs since API version 9. + +You need to adapt your application based on the following information. + +**Change Impact** + +The APIs can no longer be used after being deleted. + +- Involved APIs: + +```js + function getIdSync(wallpaperType: WallpaperType): number; + function getFileSync(wallpaperType: WallpaperType): number; + function isChangeAllowed(): boolean; + function isUserChangeAllowed(): boolean; + function on(type: 'colorChange', callback: (colors: Array, wallpaperType: WallpaperType) => void): void; + function off(type: 'colorChange', callback?: (colors: Array, wallpaperType: WallpaperType) => void): void; + interface RgbaColor { + red: number; + green: number; + blue: number; + alpha: number; + } +``` + +- Before change: + +```js + function getIdSync(wallpaperType: WallpaperType): number; + function getFileSync(wallpaperType: WallpaperType): number; + function isChangeAllowed(): boolean; + function isUserChangeAllowed(): boolean; + function on(type: 'colorChange', callback: (colors: Array, wallpaperType: WallpaperType) => void): void; + function off(type: 'colorChange', callback?: (colors: Array, wallpaperType: WallpaperType) => void): void; + interface RgbaColor { + red: number; + green: number; + blue: number; + alpha: number; + } +``` + +- After change: + + The APIs are deleted. + + +**Adaptation Guide** + +Update the code so that the deprecated APIs are not used. diff --git a/zh-cn/application-dev/IDL/idl-guidelines.md b/zh-cn/application-dev/IDL/idl-guidelines.md index 5f9989698ce60c86c3614cb7389346e84d0a9b40..5ac5f5edba32523a93f65c2c2b4d21faa62a24ff 100644 --- a/zh-cn/application-dev/IDL/idl-guidelines.md +++ b/zh-cn/application-dev/IDL/idl-guidelines.md @@ -158,9 +158,9 @@ OpenHarmony IDL容器数据类型与Ts数据类型、C++数据类型的对应关 > **注意**:请保证使用最新版的SDK,版本老旧可能导致部分语句报错。 -若不存在,可对应版本前往[docs仓版本目录](https://gitee.com/openharmony/docs/tree/master/zh-cn/release-notes)下载SDK包,以[3.2Beta3版本](../../release-notes/OpenHarmony-v3.2-beta3.md#%E4%BB%8E%E9%95%9C%E5%83%8F%E7%AB%99%E7%82%B9%E8%8E%B7%E5%8F%96)为例,可通过镜像站点获取。 +若不存在,可对应版本前往[docs仓版本目录](https://gitee.com/openharmony/docs/tree/master/zh-cn/release-notes)下载SDK包,以[3.2Beta3版本](https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/OpenHarmony-v3.2-beta3.md)为例,可通过镜像站点获取。 -关于如何替换DevEco Studio的SDK包具体操作,参考[full-SDK替换指南](../quick-start/full-sdk-switch-guide.md#full-sdk%E6%9B%BF%E6%8D%A2%E6%8C%87%E5%8D%97)中的替换方法。 +关于如何替换DevEco Studio的SDK包具体操作,参考[full-SDK替换指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/full-sdk-compile-guide.md)中的替换方法。 得到idl工具的可执行文件后,根据具体场景进行后续开发步骤。 @@ -176,6 +176,8 @@ OpenHarmony IDL容器数据类型与Ts数据类型、C++数据类型的对应关 interface OHOS.IIdlTestService { int TestIntTransaction([in] int data); void TestStringTransaction([in] String data); + void TestMapTransaction([in] Map data); + int TestArrayTransaction([in] String[] data); } ``` @@ -203,6 +205,8 @@ OpenHarmony IDL工具生成的Stub类是接口类的抽象实现,并且会声 ```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 +215,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 +235,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 +268,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; } ``` -开发者需要继承.idl文件中定义的接口类并实现其中的方法。在本示例中,我们继承了IdlTestServiceStub接口类并实现了其中的testIntTransaction和testStringTransaction方法。具体的示例代码如下: +开发者需要继承.idl文件中定义的接口类并实现其中的方法。在本示例中,我们继承了IdlTestServiceStub接口类并实现了其中的testIntTransaction、testStringTransaction、testMapTransaction和testArrayTransaction方法。具体的示例代码如下: ```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 +298,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 +361,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/zh-cn/application-dev/application-models/stage-model-development-overview.md b/zh-cn/application-dev/application-models/stage-model-development-overview.md index e54ad806a83440b010e74ae49c5d3c4379537c9e..b3e6271352001f51614614411a2db30d2146b28b 100644 --- a/zh-cn/application-dev/application-models/stage-model-development-overview.md +++ b/zh-cn/application-dev/application-models/stage-model-development-overview.md @@ -10,7 +10,7 @@ - [UIAbility组件](uiability-overview.md)和[ExtensionAbility组件](extensionability-overview.md) - Stage模型提供UIAbility和ExtensionAbility两种类型的组件,这两种组件都有具体的类承载,支持面向对象的开发方式。他们是Ability抽象概念在Stage模型上的具体实现。他们是Ability管理服务调度的单元,其生命周期都是由Ability管理服务进行调度的。 + Stage模型提供UIAbility和ExtensionAbility两种类型的组件,这两种组件都有具体的类承载,支持面向对象的开发方式。 - UIAbility组件是一种包含UI界面的应用组件,主要用于和用户交互。例如,图库类应用可以在UIAbility组件中展示图片瀑布流,在用户选择某个图片后,在新的页面中展示图片的详细内容。同时用户可以通过返回键返回到瀑布流页面。UIAbility的生命周期只包含创建/销毁/前台/后台等状态,与显示相关的状态通过WindowStage的事件暴露给开发者。 diff --git a/zh-cn/application-dev/connectivity/http-request.md b/zh-cn/application-dev/connectivity/http-request.md index 8c4c663fcc800a1998168aed065fd3e568a5e329..cec44400b724fc3ca43edc77a37e63d4e9ffc0d0 100644 --- a/zh-cn/application-dev/connectivity/http-request.md +++ b/zh-cn/application-dev/connectivity/http-request.md @@ -90,6 +90,78 @@ httpRequest.request( ); ``` +## request2接口开发步骤 + +1. 从@ohos.net.http.d.ts中导入http命名空间。 +2. 调用createHttp()方法,创建一个HttpRequest对象。 +3. 调用该对象的on()方法,可以根据业务需要订阅HTTP响应头事件、HTTP流式响应数据接收事件、HTTP流式响应数据接收进度事件和HTTP流式响应数据接收完毕事件。 +4. 调用该对象的request2()方法,传入http请求的url地址和可选参数,发起网络请求。 +5. 按照实际业务需要,可以解析返回的响应码。 +6. 调用该对象的off()方法,取消订阅相应事件。 +7. 当该请求使用完毕时,调用destroy()方法主动销毁。 + +```js +// 引入包名 +import http from '@ohos.net.http' + +// 每一个httpRequest对应一个HTTP请求任务,不可复用 +let httpRequest = http.createHttp(); +// 用于订阅HTTP响应头事件 +httpRequest.on('headersReceive', (header) => { + console.info('header: ' + JSON.stringify(header)); +}); +// 用于订阅HTTP流式响应数据接收事件 +let res = ''; +httpRequest.on('dataReceive', (data) => { + res += data; + console.info('res: ' + res); +}); +// 用于订阅HTTP流式响应数据接收完毕事件 +httpRequest.on('dataEnd', () => { + console.info('No more data in response, data receive end'); +}); +// 用于订阅HTTP流式响应数据接收进度事件 +httpRequest.on('dataProgress', (data) => { + console.log("dataProgress receiveSize:" + data.receiveSize+ ", totalSize:" + data.totalSize); +}); + +httpRequest.request2( + // 填写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, // 可选,协议类型默认值由系统自动指定 + }, (err, data) => { + console.info('error:' + JSON.stringify(err)); + console.info('ResponseCode :' + JSON.stringify(data)); + // 取消订阅HTTP响应头事件 + httpRequest.off('headersReceive'); + // 取消订阅HTTP流式响应数据接收事件 + httpRequest.off('dataReceive'); + // 取消订阅HTTP流式响应数据接收进度事件 + httpRequest.off('dataProgress'); + // 取消订阅HTTP流式响应数据接收完毕事件 + httpRequest.off('dataEnd'); + // 当该请求使用完毕时,调用destroy方法主动销毁 + httpRequest.destroy(); + } +); + +``` + ## 相关实例 针对HTTP数据请求,有以下相关实例可供参考: - [`Http:`数据请求(ArkTS)(API9))](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/Http) 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/quick-start/arkts-restrictions-and-extensions.md b/zh-cn/application-dev/quick-start/arkts-restrictions-and-extensions.md index 946b9ced5bc14583846a28a37b1b4f81535dfc81..ae8318ee1472177ba59b6eaf8b21d8f2e5623bb4 100644 --- a/zh-cn/application-dev/quick-start/arkts-restrictions-and-extensions.md +++ b/zh-cn/application-dev/quick-start/arkts-restrictions-and-extensions.md @@ -231,3 +231,27 @@ struct Child { } } ``` + +## 自定义组件名,类名,函数名和系统组件名相同约束。 + +自定义组件名,类名,函数名不能和系统组件名相同。 + +示例: + +``` +// 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/zh-cn/application-dev/quick-start/module-configuration-file.md b/zh-cn/application-dev/quick-start/module-configuration-file.md index 3fe3c55f39d090ab0ea9acda31bddf31bd134eed..0743763adda6e0a788c5fc9df8d2ac9fc79393eb 100644 --- a/zh-cn/application-dev/quick-start/module-configuration-file.md +++ b/zh-cn/application-dev/quick-start/module-configuration-file.md @@ -777,9 +777,11 @@ preloads标签示例: **表14** **dependencies标签说明** -| 属性名称 | 含义 | 数据类型 | 是否可缺省 | -| -------- | -------- | -------- | -------- | -| moduleName | 标识当前模块依赖的共享库模块名 | 字符串 | 不可缺省。 | +| 属性名称 | 含义 | 数据类型 | 是否可缺省 | +| ----------- | ------------------------------ | -------- | ---------- | +| bundleName | 标识当前模块依赖的共享包包名。 | 字符串 | 可缺省。 | +| moduleName | 标识当前模块依赖的共享包模块名。| 字符串 | 不可缺省。 | +| versionCode | 标识当前共享包的版本号。 | 数值 | 可缺省。 | dependencies标签示例: @@ -788,7 +790,9 @@ dependencies标签示例: "module": { "dependencies": [ { - "moduleName": "library" + "bundleName":"com.share.library", + "moduleName": "library", + "versionCode": 10001 } ] } diff --git a/zh-cn/application-dev/reference/apis/Readme-CN.md b/zh-cn/application-dev/reference/apis/Readme-CN.md index f0a9cf89f73b0f6a5ea8400af6c72543d624aab1..07d9d19b88f139b835a153c436013f92f3257148 100755 --- a/zh-cn/application-dev/reference/apis/Readme-CN.md +++ b/zh-cn/application-dev/reference/apis/Readme-CN.md @@ -228,7 +228,7 @@ - [@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) @@ -236,6 +236,7 @@ - [@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) @@ -244,6 +245,7 @@ - [@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.fileShare (文件分享)](js-apis-fileShare.md) - 电话服务 - [@ohos.contact (联系人)](js-apis-contact.md) diff --git a/zh-cn/application-dev/reference/apis/commonEventManager-definitions.md b/zh-cn/application-dev/reference/apis/commonEventManager-definitions.md index 53019c39c737c2a0fa6badf67d3f501eb3ffea8c..d9f8a8082bf067155c478f5a2589607d85d3f0cf 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,17 @@ Wi-Fi P2P群组信息已更改。 表示HTTP代理的配置信息发生变化。 - 值:usual.event.HTTP_PROXY_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/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-abilityAccessCtrl.md b/zh-cn/application-dev/reference/apis/js-apis-abilityAccessCtrl.md index 65f7d28de041725febfd25cdac582e4b268476fb..8d77a5bffc1a5ccfa74c971c26f5eadf6e5e2b8d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-abilityAccessCtrl.md +++ b/zh-cn/application-dev/reference/apis/js-apis-abilityAccessCtrl.md @@ -206,8 +206,8 @@ grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permiss | 错误码ID | 错误信息 | | -------- | -------- | | 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 | TokenId does not exist. | -| 12100003 | Permission does not exist. | +| 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. | @@ -317,8 +317,8 @@ revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permis | 错误码ID | 错误信息 | | -------- | -------- | | 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 | TokenId does not exist. | -| 12100003 | Permission does not exist. | +| 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. | @@ -503,7 +503,7 @@ off(type: 'permissionStateChange', tokenIDList: Array<number>, permissionL | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID in list is all invalid, or the permissionName 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. | @@ -692,6 +692,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-appAccount.md b/zh-cn/application-dev/reference/apis/js-apis-appAccount.md index 719437c9913dc324003a2c9e030945f8f44f8db6..576ac1cb96871d0ff6bbd4b39072da650ca08f89 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. | **示例:** @@ -2281,7 +2274,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 +2324,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 +2587,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. | 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 d83bfe08bb64c405f5ed4e5b3de2bde89c1a4399..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,8 +40,8 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core -| 名称 | 描述 | -| ------------- | ------------ | +| 名称 | 描述 | +| ------------- | ------------------- | | left | 类型为字符串,表示向左的手势。 | | leftThenRight | 类型为字符串,表示先向左再向右的手势。 | | leftThenUp | 类型为字符串,表示先向左再向上的手势。 | @@ -61,12 +61,12 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens ## PageUpdateType -页面刷新类型。 +页面刷新类型;当前版本暂不支持。 **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core -| 名称 | 描述 | -| ----------------- | --------- | +| 名称 | 描述 | +| ----------------- | ---------------- | | pageContentUpdate | 类型为字符串,表示页面内容刷新。 | | pageStateUpdate | 类型为字符串,表示页面状态刷新。 | @@ -76,8 +76,8 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core -| 名称 | 描述 | -| ---------- | ------------ | +| 名称 | 描述 | +| ---------- | ------------------- | | touchBegin | 类型为字符串,表示触摸浏览时开始触摸。 | | touchEnd | 类型为字符串,表示触摸浏览时结束触摸。 | @@ -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-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-bluetooth.md b/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md index 1c8b02dde9ca35f07e7693d51a162ebc3de0b063..636487cc3dd633f9e8a5141ebc044c786e4441bd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md @@ -22,8 +22,7 @@ enableBluetooth(): boolean 开启蓝牙。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.enableBluetooth](js-apis-bluetoothManager.md#bluetoothmanagerenablebluetooth)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.enableBluetooth](js-apis-bluetoothManager.md#bluetoothmanagerenablebluetooth)替代。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH @@ -49,8 +48,7 @@ disableBluetooth(): boolean 关闭蓝牙。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.disableBluetooth](js-apis-bluetoothManager.md#bluetoothmanagerdisablebluetooth)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.disableBluetooth](js-apis-bluetoothManager.md#bluetoothmanagerdisablebluetooth)替代。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH @@ -76,8 +74,7 @@ getLocalName(): string 获取蓝牙本地设备名称。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.getLocalName](js-apis-bluetoothManager.md#bluetoothmanagergetlocalname)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getLocalName](js-apis-bluetoothManager.md#bluetoothmanagergetlocalname)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -103,8 +100,7 @@ getState(): BluetoothState 获取蓝牙开关状态。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.getState](js-apis-bluetoothManager.md#bluetoothmanagergetstate)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getState](js-apis-bluetoothManager.md#bluetoothmanagergetstate)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -127,11 +123,10 @@ let state = bluetooth.getState(); getBtConnectionState(): ProfileConnectionState -获取蓝牙设备的Profile连接状态。 +获取蓝牙本端的Profile连接状态,例如:任意一个支持的Profile连接状态为已连接,则此接口返回状态为已连接。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.getBtConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetbtconnectionstate)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getBtConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetbtconnectionstate)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -157,8 +152,7 @@ setLocalName(name: string): boolean 设置蓝牙本地设备名称。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.setLocalName](js-apis-bluetoothManager.md#bluetoothmanagersetlocalname)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.setLocalName](js-apis-bluetoothManager.md#bluetoothmanagersetlocalname)替代。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH @@ -190,8 +184,7 @@ pairDevice(deviceId: string): boolean 发起蓝牙配对。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.pairDevice](js-apis-bluetoothManager.md#bluetoothmanagerpairdevice)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.pairDevice](js-apis-bluetoothManager.md#bluetoothmanagerpairdevice)替代。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH @@ -221,11 +214,10 @@ let result = bluetooth.pairDevice("XX:XX:XX:XX:XX:XX"); getProfileConnState(profileId: ProfileId): ProfileConnectionState -获取profile的连接状态。 +依据ProfileId获取指定profile的连接状态。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.getProfileConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetprofileconnectionstate)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getProfileConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetprofileconnectionstate)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -257,8 +249,7 @@ cancelPairedDevice(deviceId: string): boolean 删除配对的远程设备。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.cancelPairedDevice](js-apis-bluetoothManager.md#bluetoothmanagercancelpaireddevice)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.cancelPairedDevice](js-apis-bluetoothManager.md#bluetoothmanagercancelpaireddevice)替代。 **系统接口**:此接口为系统接口。 @@ -292,8 +283,7 @@ getRemoteDeviceName(deviceId: string): string 获取对端蓝牙设备的名称。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.getRemoteDeviceName](js-apis-bluetoothManager.md#bluetoothmanagergetremotedevicename)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getRemoteDeviceName](js-apis-bluetoothManager.md#bluetoothmanagergetremotedevicename)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -325,8 +315,7 @@ getRemoteDeviceClass(deviceId: string): DeviceClass 获取对端蓝牙设备的类别。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.getRemoteDeviceClass](js-apis-bluetoothManager.md#bluetoothmanagergetremotedeviceclass)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getRemoteDeviceClass](js-apis-bluetoothManager.md#bluetoothmanagergetremotedeviceclass)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -358,8 +347,7 @@ getPairedDevices(): Array<string> 获取蓝牙配对列表。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.getPairedDevices](js-apis-bluetoothManager.md#bluetoothmanagergetpaireddevices)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getPairedDevices](js-apis-bluetoothManager.md#bluetoothmanagergetpaireddevices)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -385,8 +373,7 @@ setBluetoothScanMode(mode: ScanMode, duration: number): boolean 设置蓝牙扫描模式,可以被远端设备发现。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.setBluetoothScanMode](js-apis-bluetoothManager.md#bluetoothmanagersetbluetoothscanmode)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.setBluetoothScanMode](js-apis-bluetoothManager.md#bluetoothmanagersetbluetoothscanmode)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -420,8 +407,7 @@ getBluetoothScanMode(): ScanMode 获取蓝牙扫描模式。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.getBluetoothScanMode](js-apis-bluetoothManager.md#bluetoothmanagergetbluetoothscanmode)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getBluetoothScanMode](js-apis-bluetoothManager.md#bluetoothmanagergetbluetoothscanmode)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -447,8 +433,7 @@ startBluetoothDiscovery(): boolean 开启蓝牙扫描,可以发现远端设备。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.startBluetoothDiscovery](js-apis-bluetoothManager.md#bluetoothmanagerstartbluetoothdiscovery)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.startBluetoothDiscovery](js-apis-bluetoothManager.md#bluetoothmanagerstartbluetoothdiscovery)替代。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH 和 ohos.permission.LOCATION @@ -479,8 +464,7 @@ stopBluetoothDiscovery(): boolean 关闭蓝牙扫描。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.stopBluetoothDiscovery](js-apis-bluetoothManager.md#bluetoothmanagerstopbluetoothdiscovery)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.stopBluetoothDiscovery](js-apis-bluetoothManager.md#bluetoothmanagerstopbluetoothdiscovery)替代。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH @@ -506,8 +490,7 @@ setDevicePairingConfirmation(device: string, accept: boolean): boolean 设置设备配对请求确认。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.setDevicePairingConfirmation](js-apis-bluetoothManager.md#bluetoothmanagersetdevicepairingconfirmation)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.setDevicePairingConfirmation](js-apis-bluetoothManager.md#bluetoothmanagersetdevicepairingconfirmation)替代。 **需要权限**:ohos.permission.MANAGE_BLUETOOTH @@ -545,8 +528,7 @@ on(type: "bluetoothDeviceFind", callback: Callback<Array<string>>): 订阅蓝牙设备发现上报事件。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.on('bluetoothDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanageronbluetoothdevicefind)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.on('bluetoothDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanageronbluetoothdevicefind)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -580,8 +562,7 @@ off(type: "bluetoothDeviceFind", callback?: Callback<Array<string>>) 取消订阅蓝牙设备发现上报事件。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.off('bluetoothDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanageroffbluetoothdevicefind)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.off('bluetoothDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanageroffbluetoothdevicefind)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -616,8 +597,7 @@ on(type: "pinRequired", callback: Callback<PinRequiredParam>): void 订阅远端蓝牙设备的配对请求事件。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.on('pinRequired')](js-apis-bluetoothManager.md#bluetoothmanageronpinrequired)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.on('pinRequired')](js-apis-bluetoothManager.md#bluetoothmanageronpinrequired)替代。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH @@ -651,8 +631,7 @@ off(type: "pinRequired", callback?: Callback<PinRequiredParam>): void 取消订阅远端蓝牙设备的配对请求事件。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.off('pinRequired')](js-apis-bluetoothManager.md#bluetoothmanageroffpinrequired)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.off('pinRequired')](js-apis-bluetoothManager.md#bluetoothmanageroffpinrequired)替代。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH @@ -687,8 +666,7 @@ on(type: "bondStateChange", callback: Callback<BondStateParam>): void 订阅蓝牙配对状态改变事件。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.on('bondStateChange')](js-apis-bluetoothManager.md#bluetoothmanageronbondstatechange)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.on('bondStateChange')](js-apis-bluetoothManager.md#bluetoothmanageronbondstatechange)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -722,8 +700,7 @@ off(type: "bondStateChange", callback?: Callback<BondStateParam>): void 取消订阅蓝牙配对状态改变事件。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.off('bondStateChange')](js-apis-bluetoothManager.md#bluetoothmanageroffbondstatechange)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.off('bondStateChange')](js-apis-bluetoothManager.md#bluetoothmanageroffbondstatechange)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -758,8 +735,7 @@ on(type: "stateChange", callback: Callback<BluetoothState>): void 订阅蓝牙连接状态改变事件。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.on('stateChange')](js-apis-bluetoothManager.md#bluetoothmanageronstatechange)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.on('stateChange')](js-apis-bluetoothManager.md#bluetoothmanageronstatechange)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -793,8 +769,7 @@ off(type: "stateChange", callback?: Callback<BluetoothState>): void 取消订阅蓝牙连接状态改变事件。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.off('stateChange')](js-apis-bluetoothManager.md#bluetoothmanageroffstatechange)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.off('stateChange')](js-apis-bluetoothManager.md#bluetoothmanageroffstatechange)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -829,8 +804,7 @@ sppListen(name: string, option: SppOption, callback: AsyncCallback<number> 创建一个服务端监听Socket。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.sppListen](js-apis-bluetoothManager.md#bluetoothmanagerspplisten)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.sppListen](js-apis-bluetoothManager.md#bluetoothmanagerspplisten)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -868,8 +842,7 @@ sppAccept(serverSocket: number, callback: AsyncCallback<number>): void 服务端监听socket等待客户端连接。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.sppAccept](js-apis-bluetoothManager.md#bluetoothmanagersppaccept)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.sppAccept](js-apis-bluetoothManager.md#bluetoothmanagersppaccept)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -911,8 +884,7 @@ sppConnect(device: string, option: SppOption, callback: AsyncCallback<number& 客户端向远端设备发起spp连接。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.sppConnect](js-apis-bluetoothManager.md#bluetoothmanagersppconnect)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.sppConnect](js-apis-bluetoothManager.md#bluetoothmanagersppconnect)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -951,8 +923,7 @@ sppCloseServerSocket(socket: number): void 关闭服务端监听Socket,入参socket由sppListen接口返回。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.sppCloseServerSocket](js-apis-bluetoothManager.md#bluetoothmanagersppcloseserversocket)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.sppCloseServerSocket](js-apis-bluetoothManager.md#bluetoothmanagersppcloseserversocket)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -984,8 +955,7 @@ sppCloseClientSocket(socket: number): void 关闭客户端socket,入参socket由sppAccept或sppConnect接口获取。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.sppCloseClientSocket](js-apis-bluetoothManager.md#bluetoothmanagersppcloseclientsocket)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.sppCloseClientSocket](js-apis-bluetoothManager.md#bluetoothmanagersppcloseclientsocket)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1019,8 +989,7 @@ sppWrite(clientSocket: number, data: ArrayBuffer): boolean 通过socket向远端发送数据,入参clientSocket由sppAccept或sppConnect接口获取 。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.sppWrite](js-apis-bluetoothManager.md#bluetoothmanagersppwrite)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.sppWrite](js-apis-bluetoothManager.md#bluetoothmanagersppwrite)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1066,8 +1035,7 @@ if (ret) { on(type: "sppRead", clientSocket: number, callback: Callback<ArrayBuffer>): void > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.on('sppRead')](js-apis-bluetoothManager.md#bluetoothmanageronsppread)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.on('sppRead')](js-apis-bluetoothManager.md#bluetoothmanageronsppread)替代。 订阅spp读请求事件,入参clientSocket由sppAccept或sppConnect接口获取。 @@ -1112,8 +1080,7 @@ off(type: "sppRead", clientSocket: number, callback?: Callback<ArrayBuffer> 取消订阅spp读请求事件,入参clientSocket由sppAccept或sppConnect接口获取。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.off('sppRead')](js-apis-bluetoothManager.md#bluetoothmanageroffsppread)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.off('sppRead')](js-apis-bluetoothManager.md#bluetoothmanageroffsppread)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1152,8 +1119,7 @@ getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfi 通过ProfileId,获取profile的对象实例。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.getProfileInstance](js-apis-bluetoothManager.md#bluetoothmanagergetprofileinstance)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getProfileInstance](js-apis-bluetoothManager.md#bluetoothmanagergetprofileinstance)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1185,8 +1151,7 @@ createGattServer(): GattServer 创建一个可使用的GattServer实例。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.BLE.createGattServer](js-apis-bluetoothManager.md#bluetoothmanagerblecreategattserver)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLE.createGattServer](js-apis-bluetoothManager.md#bluetoothmanagerblecreategattserver)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1210,8 +1175,7 @@ createGattClientDevice(deviceId: string): GattClientDevice 创建一个可使用的GattClientDevice实例。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.BLE.createGattClientDevice](js-apis-bluetoothManager.md#bluetoothmanagerblecreategattclientdevice)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLE.createGattClientDevice](js-apis-bluetoothManager.md#bluetoothmanagerblecreategattclientdevice)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1241,8 +1205,7 @@ getConnectedBLEDevices(): Array<string> 获取和当前设备连接的BLE设备。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.BLE.getConnectedBLEDevices](js-apis-bluetoothManager.md#bluetoothmanagerblegetconnectedbledevices)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLE.getConnectedBLEDevices](js-apis-bluetoothManager.md#bluetoothmanagerblegetconnectedbledevices)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -1268,8 +1231,7 @@ startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void 发起BLE扫描流程。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.BLE.startBLEScan](js-apis-bluetoothManager.md#bluetoothmanagerblestartblescan)替代。 +> 从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 @@ -1315,8 +1277,7 @@ stopBLEScan(): void 停止BLE扫描流程。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.BLE.stopBLEScan](js-apis-bluetoothManager.md#bluetoothmanagerblestopblescan)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLE.stopBLEScan](js-apis-bluetoothManager.md#bluetoothmanagerblestopblescan)替代。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH @@ -1340,8 +1301,7 @@ on(type: "BLEDeviceFind", callback: Callback<Array<ScanResult>>): vo 订阅BLE设备发现上报事件。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.BLE.on('BLEDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanagerbleonbledevicefind)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLE.on('BLEDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanagerbleonbledevicefind)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -1375,8 +1335,7 @@ off(type: "BLEDeviceFind", callback?: Callback<Array<ScanResult>>): 取消订阅BLE设备发现上报事件。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.BLE.off('BLEDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanagerbleoffbledevicefind)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLE.off('BLEDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanagerbleoffbledevicefind)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -1416,8 +1375,7 @@ getConnectionDevices(): Array<string> 获取已连接设备列表。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.BaseProfile.getConnectionDevices](js-apis-bluetoothManager.md#getconnectiondevices)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BaseProfile.getConnectionDevices](js-apis-bluetoothManager.md#getconnectiondevices)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -1443,8 +1401,7 @@ getDeviceState(device: string): ProfileConnectionState 获取设备profile的连接状态。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.BaseProfile.getDeviceState](js-apis-bluetoothManager.md#getdevicestate)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BaseProfile.getDeviceState](js-apis-bluetoothManager.md#getdevicestate)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -1481,8 +1438,7 @@ connect(device: string): boolean 发起设备的A2dp服务连接请求。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.A2dpSourceProfile.connect](js-apis-bluetoothManager.md#connect)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.A2dpSourceProfile.connect](js-apis-bluetoothManager.md#connect)替代。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH @@ -1515,8 +1471,7 @@ disconnect(device: string): boolean 断开设备的a2dp服务连接。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.A2dpSourceProfile.disconnect](js-apis-bluetoothManager.md#disconnect)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.A2dpSourceProfile.disconnect](js-apis-bluetoothManager.md#disconnect)替代。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH @@ -1549,8 +1504,7 @@ on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#Stat 订阅a2dp连接状态变化事件。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.A2dpSourceProfile.on('connectionStateChange')](js-apis-bluetoothManager.md#onconnectionstatechange)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.A2dpSourceProfile.on('connectionStateChange')](js-apis-bluetoothManager.md#onconnectionstatechange)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1583,8 +1537,7 @@ off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#St 取消订阅a2dp连接状态变化事件。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.A2dpSourceProfile.off('connectionStateChange')](js-apis-bluetoothManager.md#offconnectionstatechange)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.A2dpSourceProfile.off('connectionStateChange')](js-apis-bluetoothManager.md#offconnectionstatechange)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1618,8 +1571,7 @@ getPlayingState(device: string): PlayingState 获取设备的播放状态。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.A2dpSourceProfile.getPlayingState](js-apis-bluetoothManager.md#getplayingstate)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.A2dpSourceProfile.getPlayingState](js-apis-bluetoothManager.md#getplayingstate)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1655,8 +1607,7 @@ connect(device: string): boolean 连接设备的HFP服务。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.HandsFreeAudioGatewayProfile.connect](js-apis-bluetoothManager.md#connect-1)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.HandsFreeAudioGatewayProfile.connect](js-apis-bluetoothManager.md#connect-1)替代。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH @@ -1690,8 +1641,7 @@ disconnect(device: string): boolean 断开连接设备的HFP服务。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.HandsFreeAudioGatewayProfile.disconnect](js-apis-bluetoothManager.md#disconnect-1)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.HandsFreeAudioGatewayProfile.disconnect](js-apis-bluetoothManager.md#disconnect-1)替代。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH @@ -1725,8 +1675,7 @@ on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#Stat 订阅HFP连接状态变化事件。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.HandsFreeAudioGatewayProfile.on('connectionStateChange')](js-apis-bluetoothManager.md#onconnectionstatechange-1)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.HandsFreeAudioGatewayProfile.on('connectionStateChange')](js-apis-bluetoothManager.md#onconnectionstatechange-1)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1760,8 +1709,7 @@ off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#St 取消订阅HFP连接状态变化事件。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.HandsFreeAudioGatewayProfile.off('connectionStateChange')](js-apis-bluetoothManager.md#offconnectionstatechange-1)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.HandsFreeAudioGatewayProfile.off('connectionStateChange')](js-apis-bluetoothManager.md#offconnectionstatechange-1)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1801,8 +1749,7 @@ startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse? 开始发送BLE广播。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.startAdvertising](js-apis-bluetoothManager.md#startadvertising)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.startAdvertising](js-apis-bluetoothManager.md#startadvertising)替代。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH @@ -1872,8 +1819,7 @@ stopAdvertising(): void 停止发送BLE广播。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.stopAdvertising](js-apis-bluetoothManager.md#stopadvertising)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.stopAdvertising](js-apis-bluetoothManager.md#stopadvertising)替代。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH @@ -1898,8 +1844,7 @@ addService(service: GattService): boolean server端添加服务。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.addService](js-apis-bluetoothManager.md#addservice)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.addService](js-apis-bluetoothManager.md#addservice)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -1961,8 +1906,7 @@ removeService(serviceUuid: string): boolean 删除已添加的服务。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.removeService](js-apis-bluetoothManager.md#removeservice)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.removeService](js-apis-bluetoothManager.md#removeservice)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -1995,8 +1939,7 @@ close(): void 关闭服务端功能,去注册server在协议栈的注册,调用该接口后[GattServer](#gattserver)实例将不能再使用。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.close](js-apis-bluetoothManager.md#close)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.close](js-apis-bluetoothManager.md#close)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2017,8 +1960,7 @@ notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharac server端特征值发生变化时,主动通知已连接的client设备。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.notifyCharacteristicChanged](js-apis-bluetoothManager.md#notifycharacteristicchanged)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.notifyCharacteristicChanged](js-apis-bluetoothManager.md#notifycharacteristicchanged)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2066,8 +2008,7 @@ sendResponse(serverResponse: ServerResponse): boolean server端回复client端的读写请求。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.sendResponse](js-apis-bluetoothManager.md#sendresponse)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.sendResponse](js-apis-bluetoothManager.md#sendresponse)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2117,8 +2058,7 @@ on(type: "characteristicRead", callback: Callback<CharacteristicReadReq>): server端订阅特征值读请求事件。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.on('characteristicRead')](js-apis-bluetoothManager.md#oncharacteristicread)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.on('characteristicRead')](js-apis-bluetoothManager.md#oncharacteristicread)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2169,8 +2109,7 @@ off(type: "characteristicRead", callback?: Callback<CharacteristicReadReq> server端取消订阅特征值读请求事件。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.off('characteristicRead')](js-apis-bluetoothManager.md#offcharacteristicread)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.off('characteristicRead')](js-apis-bluetoothManager.md#offcharacteristicread)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2202,8 +2141,7 @@ on(type: "characteristicWrite", callback: Callback<CharacteristicWriteReq> server端订阅特征值写请求事件。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.on('characteristicWrite')](js-apis-bluetoothManager.md#oncharacteristicwrite)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.on('characteristicWrite')](js-apis-bluetoothManager.md#oncharacteristicwrite)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2257,8 +2195,7 @@ off(type: "characteristicWrite", callback?: Callback<CharacteristicWriteReq&g server端取消订阅特征值写请求事件。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.off('characteristicWrite')](js-apis-bluetoothManager.md#offcharacteristicwrite)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.off('characteristicWrite')](js-apis-bluetoothManager.md#offcharacteristicwrite)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2290,8 +2227,7 @@ on(type: "descriptorRead", callback: Callback<DescriptorReadReq>): void server端订阅描述符读请求事件。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.on('descriptorRead')](js-apis-bluetoothManager.md#ondescriptorread)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.on('descriptorRead')](js-apis-bluetoothManager.md#ondescriptorread)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2342,8 +2278,7 @@ off(type: "descriptorRead", callback?: Callback<DescriptorReadReq>): void server端取消订阅描述符读请求事件。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.off('descriptorRead')](js-apis-bluetoothManager.md#offdescriptorread)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.off('descriptorRead')](js-apis-bluetoothManager.md#offdescriptorread)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2375,8 +2310,7 @@ on(type: "descriptorWrite", callback: Callback<DescriptorWriteReq>): void server端订阅描述符写请求事件。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.on('descriptorWrite')](js-apis-bluetoothManager.md#ondescriptorwrite)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.on('descriptorWrite')](js-apis-bluetoothManager.md#ondescriptorwrite)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2430,8 +2364,7 @@ off(type: "descriptorWrite", callback?: Callback<DescriptorWriteReq>): voi server端取消订阅描述符写请求事件。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.off('descriptorWrite')](js-apis-bluetoothManager.md#offdescriptorwrite)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.off('descriptorWrite')](js-apis-bluetoothManager.md#offdescriptorwrite)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2463,8 +2396,7 @@ on(type: "connectStateChange", callback: Callback<BLEConnectChangedState>) server端订阅BLE连接状态变化事件。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.on('connectStateChange')](js-apis-bluetoothManager.md#onconnectstatechange)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.on('connectStateChange')](js-apis-bluetoothManager.md#onconnectstatechange)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2501,8 +2433,7 @@ off(type: "connectStateChange", callback?: Callback<BLEConnectChangedState> server端取消订阅BLE连接状态变化事件。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattServer.off('connectStateChange')](js-apis-bluetoothManager.md#offconnectstatechange)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.off('connectStateChange')](js-apis-bluetoothManager.md#offconnectstatechange)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2539,8 +2470,7 @@ connect(): boolean client端发起连接远端蓝牙低功耗设备。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.connect](js-apis-bluetoothManager.md#connect-3)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.connect](js-apis-bluetoothManager.md#connect-3)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2567,8 +2497,7 @@ disconnect(): boolean client端断开与远端蓝牙低功耗设备的连接。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.disconnect](js-apis-bluetoothManager.md#disconnect-4)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.disconnect](js-apis-bluetoothManager.md#disconnect-4)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2595,8 +2524,7 @@ close(): boolean 关闭客户端功能,注销client在协议栈的注册,调用该接口后[GattClientDevice](#gattclientdevice)实例将不能再使用。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.close](js-apis-bluetoothManager.md#close-1)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.close](js-apis-bluetoothManager.md#close-1)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2625,8 +2553,7 @@ getServices(callback: AsyncCallback<Array<GattService>>): void client端获取蓝牙低功耗设备的所有服务,即服务发现 。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.getServices](js-apis-bluetoothManager.md#getservices)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.getServices](js-apis-bluetoothManager.md#getservices)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2671,8 +2598,7 @@ getServices(): Promise<Array<GattService>> client端获取蓝牙低功耗设备的所有服务,即服务发现。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.getServices](js-apis-bluetoothManager.md#getservices-1)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.getServices](js-apis-bluetoothManager.md#getservices-1)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2703,8 +2629,7 @@ readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallba client端读取蓝牙低功耗设备特定服务的特征值。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.readCharacteristicValue](js-apis-bluetoothManager.md#readcharacteristicvalue)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.readCharacteristicValue](js-apis-bluetoothManager.md#readcharacteristicvalue)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2761,8 +2686,7 @@ readCharacteristicValue(characteristic: BLECharacteristic): Promise<BLECharac client端读取蓝牙低功耗设备特定服务的特征值。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.readCharacteristicValue](js-apis-bluetoothManager.md#readcharacteristicvalue-1)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.readCharacteristicValue](js-apis-bluetoothManager.md#readcharacteristicvalue-1)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2811,8 +2735,7 @@ readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback<BLEDes client端读取蓝牙低功耗设备特定的特征包含的描述符。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.readDescriptorValue](js-apis-bluetoothManager.md#readdescriptorvalue)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.readDescriptorValue](js-apis-bluetoothManager.md#readdescriptorvalue)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2859,8 +2782,7 @@ readDescriptorValue(descriptor: BLEDescriptor): Promise<BLEDescriptor> client端读取蓝牙低功耗设备特定的特征包含的描述符。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.readDescriptorValue](js-apis-bluetoothManager.md#readdescriptorvalue-1)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.readDescriptorValue](js-apis-bluetoothManager.md#readdescriptorvalue-1)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2899,8 +2821,7 @@ writeCharacteristicValue(characteristic: BLECharacteristic): boolean client端向低功耗蓝牙设备写入特定的特征值。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.writeCharacteristicValue](js-apis-bluetoothManager.md#writecharacteristicvalue)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.writeCharacteristicValue](js-apis-bluetoothManager.md#writecharacteristicvalue)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2953,8 +2874,7 @@ writeDescriptorValue(descriptor: BLEDescriptor): boolean client端向低功耗蓝牙设备特定的描述符写入二进制数据。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.writeDescriptorValue](js-apis-bluetoothManager.md#writedescriptorvalue)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.writeDescriptorValue](js-apis-bluetoothManager.md#writedescriptorvalue)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -2998,8 +2918,7 @@ 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)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.setBLEMtuSize](js-apis-bluetoothManager.md#setblemtusize)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -3032,8 +2951,7 @@ setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolea 向服务端发送设置通知此特征值请求。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.setNotifyCharacteristicChanged](js-apis-bluetoothManager.md#setnotifycharacteristicchanged)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.setNotifyCharacteristicChanged](js-apis-bluetoothManager.md#setnotifycharacteristicchanged)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -3079,8 +2997,7 @@ on(type: "BLECharacteristicChange", callback: Callback<BLECharacteristic>) 订阅蓝牙低功耗设备的特征值变化事件。需要先调用setNotifyCharacteristicChanged接口才能接收server端的通知。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.on('BLECharacteristicChange')](js-apis-bluetoothManager.md#onblecharacteristicchange)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.on('BLECharacteristicChange')](js-apis-bluetoothManager.md#onblecharacteristicchange)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -3117,8 +3034,7 @@ off(type: "BLECharacteristicChange", callback?: Callback<BLECharacteristic> 取消订阅蓝牙低功耗设备的特征值变化事件。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.off('BLECharacteristicChange')](js-apis-bluetoothManager.md#offblecharacteristicchange)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.off('BLECharacteristicChange')](js-apis-bluetoothManager.md#offblecharacteristicchange)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -3150,8 +3066,7 @@ on(type: "BLEConnectionStateChange", callback: Callback<BLEConnectChangedStat client端订阅蓝牙低功耗设备的连接状态变化事件。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.on('BLEConnectionStateChange')](js-apis-bluetoothManager.md#onbleconnectionstatechange)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.on('BLEConnectionStateChange')](js-apis-bluetoothManager.md#onbleconnectionstatechange)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -3187,8 +3102,7 @@ off(type: "BLEConnectionStateChange", callback?: Callback<BLEConnectChangedSt 取消订阅蓝牙低功耗设备的连接状态变化事件。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.off('BLEConnectionStateChange')](js-apis-bluetoothManager.md#offbleconnectionstatechange)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.off('BLEConnectionStateChange')](js-apis-bluetoothManager.md#offbleconnectionstatechange)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -3220,8 +3134,7 @@ getDeviceName(callback: AsyncCallback<string>): void client获取远端蓝牙低功耗设备名。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.getDeviceName](js-apis-bluetoothManager.md#getdevicename)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.getDeviceName](js-apis-bluetoothManager.md#getdevicename)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -3256,8 +3169,7 @@ getDeviceName(): Promise<string> client获取远端蓝牙低功耗设备名。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattClientDevice.getDeviceName](js-apis-bluetoothManager.md#getdevicename-1)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.getDeviceName](js-apis-bluetoothManager.md#getdevicename-1)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -3288,8 +3200,7 @@ 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)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.getRssiValue](js-apis-bluetoothManager.md#getrssivalue)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -3325,8 +3236,7 @@ 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)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.getRssiValue](js-apis-bluetoothManager.md#getrssivalue-1)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -3353,8 +3263,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 枚举,扫描模式。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.ScanMode](js-apis-bluetoothManager.md#scanmode)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ScanMode](js-apis-bluetoothManager.md#scanmode)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3372,8 +3281,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 枚举,配对状态。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.BondState](js-apis-bluetoothManager.md#bondstate)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BondState](js-apis-bluetoothManager.md#bondstate)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3389,8 +3297,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述spp的配置参数。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.SppOption](js-apis-bluetoothManager.md#sppoption)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.SppOption](js-apis-bluetoothManager.md#sppoption)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3406,8 +3313,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 枚举,Spp链路类型。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.SppType](js-apis-bluetoothManager.md#spptype)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.SppType](js-apis-bluetoothManager.md#spptype)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3421,8 +3327,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述service的接口参数定义。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.GattService](js-apis-bluetoothManager.md#gattservice)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattService](js-apis-bluetoothManager.md#gattservice)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3439,8 +3344,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述characteristic的接口参数定义 。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.BLECharacteristic](js-apis-bluetoothManager.md#blecharacteristic)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLECharacteristic](js-apis-bluetoothManager.md#blecharacteristic)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3457,8 +3361,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述descriptor的接口参数定义 。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.BLEDescriptor](js-apis-bluetoothManager.md#bledescriptor)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLEDescriptor](js-apis-bluetoothManager.md#bledescriptor)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3475,8 +3378,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述server端特征值变化时发送的特征通知参数定义。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.NotifyCharacteristic](js-apis-bluetoothManager.md#notifycharacteristic)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.NotifyCharacteristic](js-apis-bluetoothManager.md#notifycharacteristic)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3493,8 +3395,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述server端订阅后收到的特征值读请求事件参数结构。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.CharacteristicReadRequest](js-apis-bluetoothManager.md#characteristicreadrequest)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.CharacteristicReadRequest](js-apis-bluetoothManager.md#characteristicreadrequest)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3512,8 +3413,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述server端订阅后收到的特征值写请求事件参数结构。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.CharacteristicWriteRequest](js-apis-bluetoothManager.md#characteristicwriterequest)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.CharacteristicWriteRequest](js-apis-bluetoothManager.md#characteristicwriterequest)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3532,8 +3432,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述server端订阅后收到的描述符读请求事件参数结构。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.DescriptorReadRequest](js-apis-bluetoothManager.md#descriptorreadrequest)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.DescriptorReadRequest](js-apis-bluetoothManager.md#descriptorreadrequest)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3552,8 +3451,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述server端订阅后收到的描述符写请求事件参数结构。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.DescriptorWriteRequest](js-apis-bluetoothManager.md#descriptorwriterequest)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.DescriptorWriteRequest](js-apis-bluetoothManager.md#descriptorwriterequest)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3575,8 +3473,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述server端回复client端读/写请求的响应参数结构。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.ServerResponse](js-apis-bluetoothManager.md#serverresponse)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ServerResponse](js-apis-bluetoothManager.md#serverresponse)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3594,8 +3491,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述Gatt profile连接状态 。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.BLEConnectChangedState](js-apis-bluetoothManager.md#bleconnectchangedstate)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLEConnectChangedState](js-apis-bluetoothManager.md#bleconnectchangedstate)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3610,8 +3506,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 枚举,蓝牙设备的profile连接状态。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.ProfileConnectionState](js-apis-bluetoothManager.md#profileconnectionstate)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ProfileConnectionState](js-apis-bluetoothManager.md#profileconnectionstate)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3628,8 +3523,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 扫描过滤参数。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.ScanFilter](js-apis-bluetoothManager.md#scanfilter)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ScanFilter](js-apis-bluetoothManager.md#scanfilter)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3645,8 +3539,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 扫描的配置参数。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.ScanOptions](js-apis-bluetoothManager.md#scanoptions)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ScanOptions](js-apis-bluetoothManager.md#scanoptions)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3662,8 +3555,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 枚举,扫描模式。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.ScanDuty](js-apis-bluetoothManager.md#scanduty)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ScanDuty](js-apis-bluetoothManager.md#scanduty)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3679,8 +3571,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 枚举,硬件过滤匹配模式。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.MatchMode](js-apis-bluetoothManager.md#matchmode)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.MatchMode](js-apis-bluetoothManager.md#matchmode)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3695,8 +3586,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 扫描结果上报数据。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.ScanResult](js-apis-bluetoothManager.md#scanresult)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ScanResult](js-apis-bluetoothManager.md#scanresult)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3712,8 +3602,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 枚举,蓝牙开关状态。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.BluetoothState](js-apis-bluetoothManager.md#bluetoothstate)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BluetoothState](js-apis-bluetoothManager.md#bluetoothstate)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3733,8 +3622,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述蓝牙低功耗设备发送广播的参数。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.AdvertiseSetting](js-apis-bluetoothManager.md#advertisesetting)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.AdvertiseSetting](js-apis-bluetoothManager.md#advertisesetting)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3750,8 +3638,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述BLE广播数据包的内容。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.AdvertiseData](js-apis-bluetoothManager.md#advertisedata)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.AdvertiseData](js-apis-bluetoothManager.md#advertisedata)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3767,8 +3654,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述BLE广播数据包的内容。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.ManufactureData](js-apis-bluetoothManager.md#manufacturedata)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ManufactureData](js-apis-bluetoothManager.md#manufacturedata)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3783,8 +3669,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述广播包中服务数据内容。 > **说明:**
-> 从API version 7开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.ServiceData](js-apis-bluetoothManager.md#servicedata)替代。 +> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ServiceData](js-apis-bluetoothManager.md#servicedata)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3799,8 +3684,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述配对请求参数。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.PinRequiredParam](js-apis-bluetoothManager.md#pinrequiredparam)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.PinRequiredParam](js-apis-bluetoothManager.md#pinrequiredparam)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3815,8 +3699,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述配对状态参数。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.BondStateParam](js-apis-bluetoothManager.md#bondstateparam)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BondStateParam](js-apis-bluetoothManager.md#bondstateparam)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3831,8 +3714,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述profile状态改变参数。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.StateChangeParam](js-apis-bluetoothManager.md#statechangeparam)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.StateChangeParam](js-apis-bluetoothManager.md#statechangeparam)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3847,8 +3729,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 描述蓝牙设备的类别。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.DeviceClass](js-apis-bluetoothManager.md#deviceclass)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.DeviceClass](js-apis-bluetoothManager.md#deviceclass)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3865,8 +3746,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 枚举,蓝牙设备主要类别。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.MajorClass](js-apis-bluetoothManager.md#majorclass)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.MajorClass](js-apis-bluetoothManager.md#majorclass)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3890,8 +3770,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 枚举,主要次要蓝牙设备类别。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.MajorMinorClass](js-apis-bluetoothManager.md#majorminorclass)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.MajorMinorClass](js-apis-bluetoothManager.md#majorminorclass)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3990,8 +3869,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 枚举,蓝牙A2DP 播放状态。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.PlayingState](js-apis-bluetoothManager.md#playingstate)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.PlayingState](js-apis-bluetoothManager.md#playingstate)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -4006,8 +3884,7 @@ let rssi = gattClient.getRssiValue().then((data) => { 蓝牙profile枚举,API9新增PROFILE_HID_HOST,PROFILE_PAN_NETWORK。 > **说明:**
-> 从API version 8开始支持。 -> 从API version 9开始废弃,建议使用[bluetoothManager.ProfileId](js-apis-bluetoothManager.md#profileid)替代。 +> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ProfileId](js-apis-bluetoothManager.md#profileid)替代。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-bluetoothManager.md b/zh-cn/application-dev/reference/apis/js-apis-bluetoothManager.md index 1386e7f32ab296447a7930bbfe583d1ac4afb3ec..7d0b578f5935b7419a99b50e7aa6fca86229743a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bluetoothManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bluetoothManager.md @@ -151,7 +151,7 @@ try { getBtConnectionState(): ProfileConnectionState -获取蓝牙设备的Profile连接状态。 +获取蓝牙本端的Profile连接状态,例如:任意一个支持的Profile连接状态为已连接,则此接口返回状态为已连接。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -263,7 +263,7 @@ try { getProfileConnectionState(profileId: ProfileId): ProfileConnectionState -获取profile的连接状态。 +依据ProfileId获取指定profile的连接状态。 **需要权限**:ohos.permission.USE_BLUETOOTH 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..ef3853d7c5c52ba7cf2f018cdae5482690ce6f8d 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 @@ -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 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 a875c3f90429166aa42f9c4f4d3b4e86d22e2164..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 @@ -45,6 +45,8 @@ HAP信息,系统应用可以通过[bundleManager.getBundleInfo](js-apis-bundle **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 -| 名称 | 类型 | 可读 | 可写 | 说明 | -| --------- | -------------- | ---- | ---- | --------------------------- | -|moduleName | string | 是 | 否 | 依赖共享库的模块名称。 | \ No newline at end of file +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------- | ------ | ---- | ---- | ---------------------- | +| bundleName | string | 是 | 否 | 标识当前模块依赖的共享包包名。 | +| moduleName | string | 是 | 否 | 标识当前模块依赖的共享包模块名。 | +| versionCode | number | 是 | 否 | 标识当前共享包的版本号。 | \ No newline at end of file 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 4baddf1ecd63eb6787d97495e26be7d4daf715f3..81792364b3b24c0fe0dfe978025b425c4721cb89 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md @@ -1109,7 +1109,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. | 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-curve.md b/zh-cn/application-dev/reference/apis/js-apis-curve.md index f3892ab6da6ca22906ad5e02042b358c7cb2d179..17fa78bda0cc5e7410c82f8e1ef9b11c17275f5e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-curve.md +++ b/zh-cn/application-dev/reference/apis/js-apis-curve.md @@ -112,7 +112,7 @@ 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 @@ -202,6 +202,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 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-distributed-account.md b/zh-cn/application-dev/reference/apis/js-apis-distributed-account.md index 1cade67ddc4d97371f9c07925a508a6195293efe..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 @@ -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 @@ -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-effectKit.md b/zh-cn/application-dev/reference/apis/js-apis-effectKit.md index 5610c212819c32fc322225e6824da36fbc87a736..19e128c424c2554cf11544241c51389277e0bcdc 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-effectKit.md +++ b/zh-cn/application-dev/reference/apis/js-apis-effectKit.md @@ -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-file-fileUri.md b/zh-cn/application-dev/reference/apis/js-apis-file-fileUri.md new file mode 100644 index 0000000000000000000000000000000000000000..595a3a593dad5d384dbc7ff832285e07cd9b031a --- /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-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-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-http.md b/zh-cn/application-dev/reference/apis/js-apis-http.md index afdc43e1e0896d996ac9512e096c6feef6666800..fbab7e810ae3f24faec4eb4d2a5f190ff145b6a4 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-http.md +++ b/zh-cn/application-dev/reference/apis/js-apis-http.md @@ -332,7 +332,7 @@ httpRequest.destroy(); ### request210+ -request2(url: string, callback: AsyncCallback\): void +request2(url: string, callback: AsyncCallback\): void 根据URL地址和相关配置项,发起HTTP网络请求并返回流式响应,使用callback方式作为异步方法。 @@ -345,7 +345,7 @@ request2(url: string, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------------- | ---- | ----------------------------------------------- | | url | string | 是 | 发起网络请求的URL地址。 | -| callback | AsyncCallback\ | 是 | 回调函数。 | +| callback | AsyncCallback\<[number](#responsecode)\> | 是 | 回调函数。 | **错误码:** @@ -366,9 +366,9 @@ request2(url: string, callback: AsyncCallback\): void **示例:** ```js -httpRequest.request2("EXAMPLE_URL", (err) => { +httpRequest.request2("EXAMPLE_URL", (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)); } @@ -377,7 +377,7 @@ httpRequest.request2("EXAMPLE_URL", (err) => { ### request210+ -request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\): void +request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\): void 根据URL地址和相关配置项,发起HTTP网络请求并返回流式响应,使用callback方式作为异步方法。 @@ -391,7 +391,7 @@ request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\ | 是 | 回调函数。 | +| callback | AsyncCallback\<[number](#responsecode)\> | 是 | 回调函数。 | **错误码:** @@ -444,9 +444,9 @@ httpRequest.request2("EXAMPLE_URL", }, 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)); } @@ -454,7 +454,7 @@ httpRequest.request2("EXAMPLE_URL", ``` ### request210+ -request2(url: string, options? : HttpRequestOptions): Promise\ +request2(url: string, options? : HttpRequestOptions): Promise\ 根据URL地址,发起HTTP网络请求并返回流式响应,使用Promise方式作为异步方法。 @@ -473,7 +473,7 @@ request2(url: string, options? : HttpRequestOptions): Promise\ | 类型 | 说明 | | :------------------------------------- | :-------------------------------- | -| Promise\ | 以Promise形式返回发起请求的结果。 | +| Promise\<[number](#responsecode)\> | 以Promise形式返回发起请求的结果。 | **错误码:** @@ -526,8 +526,8 @@ let promise = httpRequest.request("EXAMPLE_URL", { '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)); }); 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 c2e88eeed1b761482ec958b0add5357f69c07fbc..1ab0f3ee0be051fe56bb233261285db7f0c3b5ea 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-i18n.md +++ b/zh-cn/application-dev/reference/apis/js-apis-i18n.md @@ -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-inner-application-accessibilityExtensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-accessibilityExtensionContext.md index 1f45af02032486ff5cc5b4ad33ed54438a637a3f..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 @@ -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有数据返回。 | **示例:** @@ -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. | **示例:** @@ -236,10 +236,10 @@ getFocusElement(isAccessibilityFocus: boolean, callback: AsyncCallback\; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------------------- | ------- | ---- | ------------------- | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ---------------------- | | 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. | **示例:** @@ -353,17 +353,17 @@ getWindowRootElement(windowId: number, callback: AsyncCallback\>; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------------------- | ------- | ---- | ------------------- | +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------ | ---- | --------------------- | | 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. | **示例:** @@ -479,17 +479,17 @@ getWindows(displayId: number, callback: AsyncCallback\; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ----------- | ---------------------------------------- | ---- | -------------- | -| 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. | **示例:** @@ -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>> | 是 | 回调函数,返回节点元素支持的所有操作名称。 | **示例:** @@ -819,20 +819,20 @@ performAction(actionName: string, parameters?: object): Promise\; | 参数名 | 类型 | 必填 | 说明 | | ----------- | ---------------------------------------- | ---- | -------------- | | actionName | string | 是 | 表示属性的名称,取值参考[Action](./js-apis-accessibility.md#action)。 -| parameters | object | 否 | 表示执行操作时所需要的参数。 | +| parameters | object | 否 | 表示执行操作时所需要的参数;当前版本暂不支持。 | **返回值:** -| 类型 | 说明 | -| ---------------------------------------- | ------------------------ | +| 类型 | 说明 | +| ------------------- | ---------------- | | Promise<void> | 无返回结果的Promise对象。 | **错误码:** 以下错误码的详细介绍请参见[无障碍子系统错误码](../errorcodes/errorcode-accessibility.md)。 -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | | 9300005 | This action is not supported. | **示例:** @@ -868,8 +868,8 @@ performAction(actionName: string, 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\; | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | +| 16000012 | The previous ability is starting, wait start later. | | 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. | @@ -196,6 +198,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | +| 16000012 | The previous ability is starting, wait start later. | | 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. | @@ -272,6 +275,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | +| 16000012 | The previous ability is starting, wait start later. | | 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. | @@ -347,6 +351,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | +| 16000012 | The previous ability is starting, wait start later. | | 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. | @@ -431,6 +436,7 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | +| 16000012 | The previous ability is starting, wait start later. | | 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. | @@ -1324,6 +1330,7 @@ startAbilityByCall(want: Want): Promise<Caller>; | 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | | 16000008 | Crowdtest App Expiration. | | 16000009 | Can not start ability in wukong mode. | +| 16000012 | The previous ability is starting, wait start later. | | 16000050 | Internal Error. | **示例:** 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 ad2e300dc43f314ee377500020ee414d81340ea6..1cf39b1e8171f8c419208e4b904bb18be6a17f18 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 @@ -54,6 +54,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; | 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. | +| 16000012 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -117,6 +118,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& | 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. | +| 16000012 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -189,6 +191,7 @@ startAbility(want: Want, options?: StartOptions): Promise<void>; | 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. | +| 16000012 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -257,6 +260,7 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): | 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. | +| 16000012 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -324,6 +328,7 @@ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback | 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. | +| 16000012 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -401,6 +406,7 @@ startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityRes | 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. | +| 16000012 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -471,6 +477,7 @@ startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncC | 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. | +| 16000012 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -542,6 +549,7 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOp | 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. | +| 16000012 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -621,6 +629,7 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartO | 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. | +| 16000012 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -1575,6 +1584,7 @@ startAbilityByCall(want: Want): Promise<Caller>; | 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. | +| 16000012 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -1681,6 +1691,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< | 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. | +| 16000012 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -1752,6 +1763,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca | 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. | +| 16000012 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -1825,6 +1837,7 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): | 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. | +| 16000012 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | 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..ad0dcdade7eb8e05e066902451697ae36f538938 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,7 +21,7 @@ import InputMethodSubtype from '@ohos.InputMethodSubtype'; | 名称 | 类型 | 可读 | 可写 | 必选 | 说明 | | -------- | -------- | -------- | -------- | -------- | -------- | | label | string | 是 | 否 | 否 | 输入法子类型的标签。 | -| name | string | 是 | 否 | 是 | 输入法子类型的名字。 | +| name | string | 是 | 否 | 是 | 输入法应用的包名。 | | id | string | 是 | 否 | 是 | 输入法子类型的id。 | | mode | string | 是 | 否 | 否 | 输入法子类型的模式,包括upper(大写)和lower(小写)。 | | locale | string | 是 | 否 | 是 | 输入法子类型的方言版本。 | 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 892b9a2b98717c5ec5e2e8f787bd79619e563f22..e1b4c44893f56ce9965efc8f948cf0a1b849237c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md @@ -256,9 +256,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: "", @@ -317,9 +317,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 +391,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 +445,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 { 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 1e92502fafa03cafd408ee7877a1b579508635ce..d00cf928cd584ae05e54c97ddb31486b3ef95e95 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-installer.md +++ b/zh-cn/application-dev/reference/apis/js-apis-installer.md @@ -118,7 +118,8 @@ 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 because without allow app shared bundle permission. | +| 17700036 | Failed to install the HSP because lacks appropriate permissions. | +| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. | **示例:** @@ -176,6 +177,7 @@ uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallbac | -------- | ------------------------------------------------------------ | | 17700004 | The specified user ID 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. | **示例:** @@ -397,11 +399,11 @@ try { | 名称 | 类型 | 必填 | 说明 | | ------------------------------ | ------------------------------ | ------------------ | ------------------ | -| 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/)截止日期。 | +| 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/)截止日期。 | | sharedBundleDirPaths | Array\ | 否 |共享包文件所在路径。 | ## UninstallParam10+ 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 2e6e392ff2de19431e85af08a1f23dfe88f21e66..40492367bd96e8ebdb15bac7a4ba24d07346d0b1 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 @@ -294,8 +294,8 @@ let httpProxy = { port: 8080, exclusionList: exclusionArray } -connection.setGlobalHttpProxy(httpProxy).then((error, data) => { - console.info(JSON.stringify(data)); +connection.setGlobalHttpProxy(httpProxy).then(() => { + console.info("success"); }).catch(error=>{ console.info(JSON.stringify(error)); }) @@ -436,8 +436,8 @@ setAppNet(netHandle: NetHandle): Promise\; ```js connection.getDefaultNet().then(function (netHandle) { - connection.setAppNet(netHandle).then((error, data) => { - console.log(JSON.stringify(data)) + connection.setAppNet(netHandle).then(() => { + console.log("success") }).catch(error => { console.log(JSON.stringify(error)) }) 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..cfbda46e5bce0aca5c80331cc37e80692d9c4365 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-net-mdns.md @@ -0,0 +1,551 @@ +# @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-inner-application-uiAbilityContext.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)。 + +**示例:** + +```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\ + +添加一个mDNS服务,使用Promise方式作为异步方法。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|----------------------------------|-----------|-------------------------------------------------| +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.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)。 + +**示例:** + +```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 + +移除一个mDNS服务,使用callback方式作为异步方法。 + +**系统能力**: SystemCapability.Communication.NetManager.MDNS + +**参数** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|----------------------------------|-----------|-------------------------------------------------| +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.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)。 + +**示例:** + +```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\ + +移除一个mDNS服务. 使用Promise方式作为异步方法。 + +**系统能力**: SystemCapability.Communication.NetManager.MDNS + +**参数** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|----------------------------------|-----------|-------------------------------------------------| +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.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)。 + +**示例:** + +```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 + +返回一个DiscoveryService对象,该对象用于发现指定服务类型的mDNS服务。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|---------|-----------| ------------------------------------------------------------ | +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 | +| serviceType | string | 是 | 需要发现的mDNS服务类型。| + +**返回值:** + +| Type | Description | +| ----------------------------- |---------------------------------| +| DiscoveryService | 基于指定serviceType和Context的发现服务对象。 | + +**Example** + +```js +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-inner-application-uiAbilityContext.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)。 + +**示例:** + +```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\ + +解析一个mDNS服务,使用Promise方式作为异步方法。 + +**系统能力**: SystemCapability.Communication.NetManager.MDNS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|--------------|-----------|-----------------------------------------------------| +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.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)。 + +**示例:** + +```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 + +指定服务类型的发现服务对象。 + +### startSearchingMDNS + +startSearchingMDNS(): void + +开始搜索局域网内的mDNS服务。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +**示例:** + +```js +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.startSearchingMDNS(); +``` + +### stopSearchingMDNS + +stopSearchingMDNS(): void + +停止搜索局域网内的mDNS服务。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +**示例:** + +```js +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.stopSearchingMDNS(); +``` + +### on('discoveryStart') + +on(type: 'discoveryStart', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MDNS_ERR}>): void + +订阅开启监听mDNS服务的通知。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|--------------|-----------|-----------------------------------------------------| +| type | string | 是 |订阅事件,固定为'discoveryStart'。
discoveryStart:开始搜索局域网内的mDNS服务事件。 | +| callback | Callback<{serviceInfo: [LocalServiceInfo](#localserviceinfo), errorCode?: [MDNS_ERR](#mdns_err)}> | 是 | 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?: MDNS_ERR}>): void + +订阅停止监听mDNS服务的通知。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|--------------|-----------|-----------------------------------------------------| +| type | string | 是 |订阅事件,固定为'discoveryStop'。
discoveryStop:停止搜索局域网内的mDNS服务事件。 | +| callback | Callback<{serviceInfo: [LocalServiceInfo](#localserviceinfo), errorCode?: [MDNS_ERR](#mdns_err)}> | 是 | 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<[LocalServiceInfo](#localserviceinfo)>): 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<[LocalServiceInfo](#localserviceinfo)>): 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服务属性值。 | + +## MDNS_ERR + +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-osAccount.md b/zh-cn/application-dev/reference/apis/js-apis-osAccount.md index b99b134d6a67d8eb2ddb534ad5b76a8682527a1e..dfe530d7cbc066330dff01f5f35a35a97ecc6654 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-osAccount.md +++ b/zh-cn/application-dev/reference/apis/js-apis-osAccount.md @@ -326,9 +326,9 @@ checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: A | 错误码ID | 错误信息 | | -------- | ------------------- | -| 12300001 | system service exception. | -| 12300002 | invalid localId or constraint. | -| 12300003 | the account indicated by localId dose not exist. | +| 12300001 | System service exception. | +| 12300002 | Invalid localId or constraint. | +| 12300003 | Account not found. | **示例:** 判断ID为100的系统帐号是否有禁止使用Wi-Fi的约束 @@ -376,9 +376,9 @@ checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise< | 错误码ID | 错误信息 | | -------- | ------------------- | -| 12300001 | system service exception. | -| 12300002 | invalid localId or constraint. | -| 12300003 | the account indicated by localId dose not exist. | +| 12300001 | System service exception. | +| 12300002 | Invalid localId or constraint. | +| 12300003 | Account not found. | **示例:** 判断ID为100的系统帐号是否有禁止使用Wi-Fi的约束 @@ -487,7 +487,7 @@ checkOsAccountVerified(callback: AsyncCallback<boolean>): void | 错误码ID | 错误信息 | | -------- | ------------------- | -| 12300001 | system service exception. | +| 12300001 | System service exception. | **示例:** @@ -527,9 +527,9 @@ checkOsAccountVerified(localId: number, callback: AsyncCallback<boolean>): | 错误码ID | 错误信息 | | -------- | ------------------- | -| 12300001 | system service exception. | -| 12300002 | invalid localId. | -| 12300003 | the account indicated by localId dose not exist. | +| 12300001 | System service exception. | +| 12300002 | Invalid localId. | +| 12300003 | Account not found. | **示例:** @@ -575,9 +575,9 @@ checkOsAccountVerified(localId: number): Promise<boolean> | 错误码ID | 错误信息 | | -------- | ------------------- | -| 12300001 | system service exception. | -| 12300002 | invalid localId. | -| 12300003 | the account indicated by localId dose not exist. | +| 12300001 | System service exception. | +| 12300002 | Invalid localId. | +| 12300003 | Account not found. | **示例:** @@ -720,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. | @@ -774,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. | @@ -987,7 +987,7 @@ getOsAccountLocalId(callback: AsyncCallback<number>): void | 错误码ID | 错误信息 | | -------- | ------------------- | -| 12300001 | system service exception. | +| 12300001 | System service exception. | **示例:** @@ -1024,7 +1024,7 @@ getOsAccountLocalId(): Promise<number> | 错误码ID | 错误信息 | | -------- | ------------------- | -| 12300001 | system service exception. | +| 12300001 | System service exception. | **示例:** @@ -1060,8 +1060,8 @@ getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback<number>): v | 错误码ID | 错误信息 | | -------- | --------------- | -| 12300001 | system service exception. | -| 12300002 | invalid uid. | +| 12300001 | System service exception. | +| 12300002 | Invalid uid. | **示例:** 查询值为12345678的uid所属的系统帐号的帐号ID @@ -1104,8 +1104,8 @@ getOsAccountLocalIdForUid(uid: number): Promise<number> | 错误码ID | 错误信息 | | -------- | ------------- | -| 12300001 | system service exception. | -| 12300002 | invalid uid. | +| 12300001 | System service exception. | +| 12300002 | Invalid uid. | **示例:** 查询值为12345678的uid所属的系统帐号ID @@ -1144,8 +1144,8 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallb | 错误码ID | 错误信息 | | -------- | ------------- | -| 12300001 | system service exception. | -| 12300002 | invalid domainInfo. | +| 12300001 | System service exception. | +| 12300002 | Invalid domainInfo. | **示例:** @@ -1191,8 +1191,8 @@ getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise<number&g | 错误码ID | 错误信息 | | -------- | ------------- | -| 12300001 | system service exception. | -| 12300002 | invalid domainInfo. | +| 12300001 | System service exception. | +| 12300002 | Invalid domainInfo. | **示例:** @@ -1470,7 +1470,7 @@ getActivatedOsAccountLocalIds(callback: AsyncCallback<Array<number>> | 错误码ID | 错误信息 | | -------- | ------------- | -| 12300001 | system service exception. | +| 12300001 | System service exception. | **示例:** @@ -1507,7 +1507,7 @@ getActivatedOsAccountLocalIds(): Promise<Array<number>> | 错误码ID | 错误信息 | | -------- | ------------- | -| 12300001 | system service exception. | +| 12300001 | System service exception. | **示例:** @@ -1858,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的系统帐号信息 @@ -2229,9 +2229,9 @@ getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback | 错误码ID | 错误信息 | | -------- | ------------------- | -| 12300001 | system service exception. | -| 12300002 | invalid serialNumber. | -| 12300003 | the account indicated by serialNumber dose not exist. | +| 12300001 | System service exception. | +| 12300002 | Invalid serialNumber. | +| 12300003 | The account indicated by serialNumber dose not exist. | **示例:** 查询与SN码12345关联的系统帐号的ID @@ -2272,9 +2272,9 @@ getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise<number> | 错误码ID | 错误信息 | | -------- | ------------------- | -| 12300001 | system service exception. | -| 12300002 | invalid serialNumber. | -| 12300003 | the account indicated by serialNumber dose not exist. | +| 12300001 | System service exception. | +| 12300002 | Invalid serialNumber. | +| 12300003 | The account indicated by serialNumber dose not exist. | **示例:** 查询与SN码12345关联的系统帐号的ID @@ -2311,9 +2311,9 @@ getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback<n | 错误码ID | 错误信息 | | -------- | ------------------- | -| 12300001 | system service exception. | -| 12300002 | invalid localId. | -| 12300003 | the account indicated by localId dose not exist. | +| 12300001 | System service exception. | +| 12300002 | Invalid localId. | +| 12300003 | Account not found. | **示例:** 获取ID为100的系统帐号关联的SN码 @@ -2354,9 +2354,9 @@ getSerialNumberForOsAccountLocalId(localId: number): Promise<number> | 错误码ID | 错误信息 | | -------- | ------------------- | -| 12300001 | system service exception. | -| 12300002 | invalid localId. | -| 12300003 | the account indicated by localId dose not exist. | +| 12300001 | System service exception. | +| 12300002 | Invalid localId. | +| 12300003 | Account not found. | **示例:** 获取ID为100的系统帐号关联的SN码 @@ -2400,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. | **示例:** @@ -2442,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. | **示例:** @@ -2479,8 +2477,8 @@ getBundleIdForUid(uid: number, callback: AsyncCallback<number>): void; | 错误码ID | 错误信息 | | -------- | ------------- | -| 12300001 | system service exception. | -| 12300002 | invalid uid. | +| 12300001 | System service exception. | +| 12300002 | Invalid uid. | **示例:** @@ -2522,8 +2520,8 @@ getBundleIdForUid(uid: number): Promise<number>; | 错误码ID | 错误信息 | | -------- | ------------- | -| 12300001 | system service exception. | -| 12300002 | invalid uid. | +| 12300001 | System service exception. | +| 12300002 | Invalid uid. | **示例:** @@ -2640,9 +2638,9 @@ getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: | 错误码ID | 错误信息 | | -------- | ------------- | -| 12300001 | system service exception. | -| 12300002 | invalid name or constraint. | -| 12300003 | the account indicated by localId dose not exist. | +| 12300001 | System service exception. | +| 12300002 | Invalid name or constraint. | +| 12300003 | Account not found. | **示例:** @@ -2687,9 +2685,9 @@ getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise& | 错误码ID | 错误信息 | | -------- | ------------- | -| 12300001 | system service exception. | -| 12300002 | invalid name or constraint. | -| 12300003 | the account indicated by localId dose not exist. | +| 12300001 | System service exception. | +| 12300002 | Invalid name or constraint. | +| 12300003 | Account not found. | **示例:** @@ -4113,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 @@ -4172,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 @@ -4282,7 +4280,7 @@ registerInputer(inputer: IInputer): void; | 错误码ID | 错误信息 | | -------- | --------------------------- | | 12300001 | System service exception. | -| 12300102 | Invalid inputer. | +| 12300002 | Invalid inputer. | | 12300103 | Inputer already registered. | **示例:** @@ -4347,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. | @@ -4716,7 +4714,7 @@ static registerPlugin(plugin: DomainPlugin): void | 错误码ID | 错误信息 | | -------- | --------------------------- | -| 12300201 | the domain plugin has been registered. | +| 12300201 | The domain plugin has been registered. | **示例:** ```js @@ -4783,17 +4781,17 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs | 错误码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. | +| 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 @@ -4836,16 +4834,16 @@ authWithPopup(callback: IUserAuthCallback): void | 错误码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. | +| 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 @@ -4884,17 +4882,17 @@ authWithPopup(localId: number, callback: IUserAuthCallback): void | 错误码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. | +| 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 @@ -4933,9 +4931,9 @@ hasAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<bool | 错误码ID | 错误信息 | | -------- | --------------------------- | -| 12300001 | system service exception. | -| 12300002 | invalid domainAccountInfo. | -| 12300013 | network exception. | +| 12300001 | System service exception. | +| 12300002 | Invalid domainAccountInfo. | +| 12300013 | Network exception. | **示例:** ```js @@ -4984,9 +4982,9 @@ hasAccount(domainAccountInfo: DomainAccountInfo): Promise<boolean> | 错误码ID | 错误信息 | | -------- | --------------------------- | -| 12300001 | system service exception. | -| 12300002 | invalid domainAccountInfo. | -| 12300013 | network exception. | +| 12300001 | System service exception. | +| 12300002 | Invalid domainAccountInfo. | +| 12300013 | Network exception. | **示例:** ```js @@ -5389,7 +5387,6 @@ getAuthInfo(callback: AsyncCallback<Array<EnrolledCredInfo>>): void; | 错误码ID | 错误信息 | | -------- | --------------------- | | 12300001 | System service exception. | -| 12300102 | Credential not found. | **示例:** ```js @@ -5429,7 +5426,6 @@ getAuthInfo(authType: AuthType, callback: AsyncCallback<Array<EnrolledCred | -------- | ------------------- | | 12300001 | System service exception. | | 12300002 | Invalid authType. | -| 12300102 | Credential not found. | **示例:** ```js @@ -5474,7 +5470,6 @@ getAuthInfo(authType?: AuthType): Promise<Array<EnrolledCredInfo>>; | -------- | ------------------- | | 12300001 | System service exception. | | 12300002 | Invalid authType. | -| 12300102 | Credential not found. | **示例:** ```js @@ -5513,6 +5508,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]); @@ -5975,7 +5976,7 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void; | ----------- | ------ | ---- | ---------- | | domain | string | 是 | 域名。 | | accountName | string | 是 | 域帐号名。 | -| accountId10+ | string | 否 | 域帐号标识。 | +| accountId10+ | string | 否 | 域帐号标识。
**系统接口:** 此接口为系统接口。 | ## 系统帐号约束列表 diff --git a/zh-cn/application-dev/reference/apis/js-apis-overlay.md b/zh-cn/application-dev/reference/apis/js-apis-overlay.md index c86bceaaf70cc5cb048dee0e1b2c6e307dbaa113..3faa6159a50e121b6b2c99e548cfd0afa3cb8506 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-overlay.md +++ b/zh-cn/application-dev/reference/apis/js-apis-overlay.md @@ -238,7 +238,8 @@ getOverlayModuleInfo(moduleName: string): Promise\; | 错误码ID | 错误信息 | | ------ | -------------------------------------- | -| 17700002 | The specified module name is not found. | +| 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. | **示例:** @@ -278,6 +279,7 @@ getOverlayModuleInfo(moduleName: string, callback: AsyncCallback\> | 是 | 回调函数,当获取指定应用中指定module关联的所有OverlayModuleInfo信息成功时,err返回undefined。否则回调函数返回具体错误对象。 | **错误码:** 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 a8abc368b6b5652bdc11d892ae2b22db21d6f647..84beb19662ebd11529f7256c4ae745b6b5220e37 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-privacyManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-privacyManager.md @@ -46,8 +46,8 @@ addPermissionUsedRecord(tokenID: number, permissionName: Permissions, successCou | 错误码ID | 错误信息 | | -------- | -------- | | 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 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. | @@ -96,8 +96,8 @@ addPermissionUsedRecord(tokenID: number, permissionName: Permissions, successCou | 错误码ID | 错误信息 | | -------- | -------- | | 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 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. | @@ -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. | @@ -267,8 +267,8 @@ startUsingPermission(tokenID: number, permissionName: Permissions): Promise<v | 错误码ID | 错误信息 | | -------- | -------- | | 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 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. | | 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. | @@ -315,8 +315,8 @@ startUsingPermission(tokenID: number, permissionName: Permissions, callback: Asy | 错误码ID | 错误信息 | | -------- | -------- | | 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 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. | | 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. | @@ -370,8 +370,8 @@ stopUsingPermission(tokenID: number, permissionName: Permissions): Promise<vo | 错误码ID | 错误信息 | | -------- | -------- | | 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 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. | | 12100004 | The interface is not used with | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -418,8 +418,8 @@ stopUsingPermission(tokenID: number, permissionName: Permissions, callback: Asyn | 错误码ID | 错误信息 | | -------- | -------- | | 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 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. | | 12100004 | The interface is not used with | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -512,7 +512,7 @@ off(type: 'activeStateChange', permissionList: Array<Permissions>, callbac | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The permissionName in list is all invalid or the list size is larger than 1024. | +| 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. | 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 d98025f0f3b80bf1f1d025df51ed3526d7694031..c5746422ef06f7aa7bd5a198c17e5281d74f0564 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-radio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-radio.md @@ -414,7 +414,6 @@ getPrimarySlotId\(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. | **示例:** @@ -449,7 +448,6 @@ getPrimarySlotId\(\): 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. | **示例:** 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 4c5dc4aab1d5258e0056342b3b3e087971e153bb..d533ba3be47e2b6dfe06320edc602f2057d86c11 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-sim.md +++ b/zh-cn/application-dev/reference/apis/js-apis-sim.md @@ -142,7 +142,6 @@ hasOperatorPrivileges(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. | **示例:** @@ -183,7 +182,6 @@ hasOperatorPrivileges(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. | **示例:** @@ -468,7 +466,6 @@ getSimState\(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. | **示例:** @@ -510,7 +507,6 @@ getSimState\(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. | **示例:** @@ -631,7 +627,6 @@ hasSimCard\(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. | **示例:** @@ -673,7 +668,6 @@ hasSimCard\(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. | **示例:** @@ -2994,7 +2988,6 @@ getOperatorConfigs(slotId: number, callback: AsyncCallback> | 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. | **示例:** @@ -3787,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. | **示例:** @@ -3838,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. | **示例:** @@ -3878,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. | **示例:** @@ -3929,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. | **示例:** 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 7c005e050863732e1af8ea6b4003135aeac1a1fe..f3d2dff5695686b48f76a97aab7fb3706d63165d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-socket.md +++ b/zh-cn/application-dev/reference/apis/js-apis-socket.md @@ -2674,4 +2674,4 @@ TLS通信的协议版本。 | 类型 | 说明 | | --------------------------------------------------------------------- | --------------------- | -|[cryptoFramework.EncodingBlob](js-apis-cryptoFramework.md#datablob) | 存储证书的数据和编码格式 | +|[cert.EncodingBlob](js-apis-cert.md#datablob) | 存储证书的数据和编码格式 | 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 index 97ab611a3ea96ba21772559e381dd225b2e8020c..9d94f7dd8f4595b8e23ddbeb69e6dc0f58d6a131 100644 --- a/zh-cn/application-dev/reference/arkui-js-lite/Readme-CN.md +++ b/zh-cn/application-dev/reference/arkui-js-lite/Readme-CN.md @@ -13,6 +13,7 @@ - [通用属性](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) 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/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/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/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/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/progress.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/progress.png index 7edb3bedb97ee4b203cd35a6ef6642740f410846..fb9170121d950b8d8b5a4a5a209c25b452791d25 100644 Binary files a/zh-cn/application-dev/reference/arkui-js-lite/figures/progress.png 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/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/slider.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/slider.png index d0167fe6773371fa70d8bf32c3a3953ed1e1455b..b72ed8404c613ec9283d7be1f56071d70fcbbc1f 100644 Binary files a/zh-cn/application-dev/reference/arkui-js-lite/figures/slider.png 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/switch.gif b/zh-cn/application-dev/reference/arkui-js-lite/figures/switch.gif new file mode 100644 index 0000000000000000000000000000000000000000..102295bc63e3d373d45e74c23dcddc4f5532e9fb 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/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/js-components-basic-chart.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-chart.md index 20bed6b363ea29e67f3229d0890ef2188f0417ed..71730347c3280ff915655e5d916c4c97fa5e3693 100644 --- 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 @@ -1,8 +1,11 @@ # chart - 图表组件,用于呈现线形图、柱状图界面。 +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 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 index 4ec840daf2d2d4ecb42929108bba84eccb4edddc..9c85c0e3808241dda5faad0aa459c627d5ed069b 100644 --- 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 @@ -1,8 +1,11 @@ # image-animator - 图片帧动画播放器。 +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 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 index a44510bb870601a8110e6f0f861b2ccd4513ce7f..838db18b496f1fd144bc2cebddb70dfc2e84e516 100644 --- 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 @@ -1,8 +1,11 @@ # image - 图片组件,用来渲染展示图片。 +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 @@ -46,3 +49,26 @@ | 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 index 8a8a9cd2b5a68b295fb997761fd171b834606623..facd4e72415f5c740b879c02698c0f4e5823e620 100644 --- 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 @@ -1,8 +1,11 @@ # input - 交互式组件,包括单选框,多选框,按钮。 +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 @@ -60,3 +63,119 @@ | 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 index a0c7f6b90114b6da59fa6a61394933cfaf9d9d2d..e146eb244ac7c796efca5773842feaf1607502ee 100644 --- 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 @@ -1,8 +1,11 @@ # marquee - 跑马灯组件,用于展示一段单行滚动的文字。 +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 @@ -49,3 +52,67 @@ | 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 index ba53345a62e8f6c0a0f7bf205793026838040dc0..3722716aae1e0d42bf1638e0efc50d475430ee13 100644 --- 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 @@ -2,6 +2,10 @@ 嵌入页面的滑动选择器。 +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 @@ -138,4 +142,4 @@ export default { } ``` -![sssssss](figures/sssssss.PNG) +![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 index 3b9006219ce2622b38f89bb1663d9eedde661232..afbbb9010be0c457ac3419da1c5f30aae9fa8388 100644 --- 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 @@ -1,8 +1,11 @@ # progress - 进度条,用于显示内容加载或操作处理进度。 +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 @@ -78,3 +81,45 @@ | 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 index 4c1ce42fe498c6606926ee986e3958297ce4963c..c454322301d03fe4ae53bb7d3c83aa3b733cf239 100644 --- 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 @@ -3,10 +3,9 @@ 生成并显示二维码。 - > **说明:** > -> 本组件从从API version 5 开始支持。 +> 该组件从从API version 5 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 ## 子组件 @@ -61,6 +60,66 @@ ## 示例 +```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 index 1357ac470166f59764a6e423e8803fe3e1880224..a686e9cf6202041c883ce347c9feaf34af329572 100644 --- 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 @@ -1,8 +1,11 @@ # slider - 滑动条组件,用来快速调节设置值,如音量、亮度等。 +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 @@ -57,3 +60,43 @@ | 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 index bfd28ff1fca70f6f7b1049ac4d383e95ef9b3f42..2f09e3c14322014dda6b1e1afd922d4b94dead9a 100644 --- 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 @@ -1,8 +1,11 @@ # switch - 开关选择器,通过开关,开启或关闭某个功能。 +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 @@ -46,3 +49,51 @@ | 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: '开启' + }, + switchChange(e){ + console.log(e.checked); + if(e.checked){ + this.title="开启" + }else{ + this.title="关闭" + } + } +} +``` + +![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 index 390070dcee280173cdc114228a1139089dd2b0a0..fa258500f81b3b9436188afb6cb77740202ec831 100644 --- 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 @@ -1,8 +1,11 @@ # text - 文本,用于呈现一段信息。 +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 @@ -51,3 +54,45 @@ | opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | | display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | | [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + +## 示例 + +```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 index 2375d62e5ed3e34ccde759bf6b4a7fdbf62a6fcc..4ba0df786f1c888c861e9e002c12ee35eb794d4a 100644 --- 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 @@ -1,8 +1,11 @@ # canvas组件 - 提供画布组件。用于自定义绘制图形。 +> **说明:** +> +> 该组件从从API version 5 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 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 index 11681a4e57b8aa451c84a284649b58733f7c5cdc..0986adc7e314f7f2ed5acc2d39c56352eca100f4 100644 --- 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 @@ -5,7 +5,7 @@ **示例:** -``` +```html @@ -13,7 +13,7 @@ ``` -``` +```javascript // xxx.js export default { handleClick() { @@ -47,7 +47,7 @@ export default { ![zh-cn_image_0000001431388525](figures/zh-cn_image_0000001431388525.png) - ``` + ```javascript ctx.fillRect(20, 20, 200, 150); ``` @@ -67,7 +67,7 @@ export default { ![zh-cn_image_0000001431388505](figures/zh-cn_image_0000001431388505.png) - ``` + ```javascript ctx.fillStyle = '#0000ff'; ctx.fillRect(20, 20, 150, 100); ``` @@ -91,7 +91,7 @@ export default { ![zh-cn_image_0000001381268264](figures/zh-cn_image_0000001381268264.png) - ``` + ```javascript ctx.strokeRect(30, 30, 200, 150); ``` @@ -113,7 +113,7 @@ export default { ![zh-cn_image_0000001431548109](figures/zh-cn_image_0000001431548109.png) - ``` + ```javascript ctx.font = '35px sans-serif'; ctx.fillText("Hello World!", 20, 60); ``` @@ -134,7 +134,7 @@ export default { ![zh-cn_image_0000001431548121](figures/zh-cn_image_0000001431548121.png) - ``` + ```javascript ctx.lineWidth = 5; ctx.strokeRect(25, 25, 85, 105); ``` @@ -155,7 +155,7 @@ export default { ![zh-cn_image_0000001380789172](figures/zh-cn_image_0000001380789172.png) - ``` + ```javascript ctx.lineWidth = 10; ctx.strokeStyle = '#0000ff'; ctx.strokeRect(25, 25, 155, 105); @@ -170,7 +170,7 @@ export default { ![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)'; @@ -187,7 +187,7 @@ export default { ![zh-cn_image_0000001431548125](figures/zh-cn_image_0000001431548125.png) - ``` + ```javascript ctx.beginPath(); ctx.lineWidth = '6'; ctx.strokeStyle = '#0000ff'; @@ -212,7 +212,7 @@ export default { ![zh-cn_image_0000001431388529](figures/zh-cn_image_0000001431388529.png) - ``` + ```javascript ctx.beginPath(); ctx.moveTo(10, 10); ctx.lineTo(280, 160); @@ -235,7 +235,7 @@ export default { ![zh-cn_image_0000001431148365](figures/zh-cn_image_0000001431148365.png) - ``` + ```javascript ctx.beginPath(); ctx.moveTo(10, 10); ctx.lineTo(280, 160); @@ -252,7 +252,7 @@ export default { ![zh-cn_image_0000001381268284](figures/zh-cn_image_0000001381268284.png) - ``` + ```javascript ctx.beginPath(); ctx.moveTo(30, 30); ctx.lineTo(110, 30); @@ -277,7 +277,7 @@ export default { ![zh-cn_image_0000001381108328](figures/zh-cn_image_0000001381108328.png) - ``` + ```javascript ctx.font = '30px sans-serif'; ctx.fillText("Hello World", 20, 60); ``` @@ -298,7 +298,7 @@ export default { ![zh-cn_image_0000001431388517](figures/zh-cn_image_0000001431388517.png) - ``` + ```javascript ctx.strokeStyle = '#0000ff'; ctx.moveTo(140, 10); ctx.lineTo(140, 160); @@ -335,7 +335,7 @@ export default { ![zh-cn_image_0000001381108320](figures/zh-cn_image_0000001381108320.png) - ``` + ```javascript ctx.beginPath(); ctx.arc(100, 75, 50, 0, 6.28); ctx.stroke(); @@ -359,7 +359,7 @@ export default { ![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-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 index b5ebdd4b8e12373e0a45e67c377af6cef3d79a85..d8485dc11445111f2c7165b8c2f7088d246328a8 100644 --- 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 @@ -1,8 +1,11 @@ # div - 基础容器,用作页面结构的根节点或将内容进行分组。 +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 @@ -55,7 +58,7 @@ 1. Flex样式 - ``` + ```html
@@ -67,7 +70,7 @@ ``` - ``` + ```css /* xxx.css */ .container { flex-direction: column; @@ -103,7 +106,7 @@ 2. Flex Wrap样式 - ``` + ```html
@@ -115,7 +118,7 @@ ``` - ``` + ```css /* xxx.css */ .container { flex-direction: column; 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 index 902a04866d7d38025a8af5457fbe24b8d13be43e..8db4c78b3b042eaded0f5c90d6406917b1abf255 100644 --- 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 @@ -1,8 +1,11 @@ # list-item - <[list](js-components-container-list.md)>的子组件,用来展示列表具体item。 +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 @@ -42,3 +45,9 @@ | 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 index 291f725e7aadb9c8c2772d168aff675566607a26..905cf802427c20a6b474de2f32adcb241b01db28 100644 --- 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 @@ -1,8 +1,11 @@ # list - 列表包含一系列相同宽度的列表项。适合连续、多行呈现同类数据,例如图片和文本。 +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 @@ -27,6 +30,8 @@ | click | - | 点击动作触发该事件。 | | longpress | - | 长按动作触发该事件。 | | swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | +| scrolltop8+ | - | 当前列表已滑动到顶部位置。 | +| scrollbottom8+ | - | 当前列表已滑动到底部位置。 | ## 样式 @@ -115,4 +120,4 @@ export default { } ``` -![zh-cn_image_0000001380789196](figures/zh-cn_image_0000001380789196.png) +![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 index 27167a410fdb4a8fa6fa202092242d8855c424c4..47a0a062124bc9a92c26dc325739f5cb1b0b3812 100644 --- 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 @@ -1,8 +1,11 @@ # stack - 堆叠容器,子组件按照顺序依次入栈,后一个子组件覆盖前一个子组件。 +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 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 index e9274975dae24e07f80bdc66a98f99d313aa51fd..37865ab41d81a1d873ab0df01b06253f397b779b 100644 --- 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 @@ -1,8 +1,11 @@ # swiper - 滑动容器,提供切换子组件显示的能力。 +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + ## 子组件 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/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/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/ts-basic-components-button.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-button.md index fef36417d08f3c17c699cc65dc0f8837ad18a06a..4bda014092441bbc03c7663b8733af948a8f01dd 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 @@ -62,6 +62,7 @@ > - 当按钮类型为Capsule时,borderRadius设置不生效,按钮圆角始终为宽、高中较小值的一半。 > - 当按钮类型为Circle时,borderRadius即为按钮半径,若未设置borderRadius按钮半径则为宽、高中较小值的一半。 > - 按钮文本通过[通用文本样式](ts-universal-attributes-text-style.md)进行设置。 +> - 设置[颜色渐变](ts-universal-attributes-gradient-color.md)需先设置[backgroundColor](ts-universal-attributes-background.md)为透明色。 ## LabelStyle10+对象说明 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 073a0e0255fd33394cde65a11af2384b764e7525..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 @@ -28,15 +28,6 @@ DataPanel(options:{values: number[], max?: number, type?: DataPanelType}) | max | number | 否 | - max大于0,表示数据的最大值。
- max小于等于0,max等于value数组各项的和,按比例显示。
默认值:100 | | type8+ | [DataPanelType](#datapaneltype枚举说明) | 否 | 数据面板的类型(不支持动态修改)。
默认值:DataPanelType.Circle | -## 属性 - -除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: - -| 名称 | 类型 | 描述 | -| ----------- | ------- | -------------------------------------------- | -| closeEffect | boolean | 关闭数据占比图表旋转动效。
默认值:false | - - ## DataPanelType枚举说明 @@ -48,6 +39,50 @@ DataPanel(options:{values: number[], max?: number, type?: DataPanelType}) | 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..e6014899129f494107508b7e9374a5864692d9d1 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 @@ -32,7 +32,16 @@ DatePicker(options?: {start?: Date, end?: Date, selected?: Date}) | 名称 | 参数类型 | 描述 | | ------| -------------- | -------- | | 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只支持字号、字体粗细的设置。 | ## 事件 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 c8737ca8a0712ae7f8025b17fa46c1f4762c38f4..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)。 > > - 该组件使用需要具有系统签名。 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 0492a368d84457e0fb99e7ed3be7257f1d27308e..a96e5d27b901d036abe0a1998dabd4d5f92c5b61 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,7 +19,7 @@ ## 接口 -Image(src: string | PixelMap | Resource) +Image(src: PixelMap | ResourceStr | DrawableDescriptor) 通过图片数据源获取图片,用于后续渲染展示。 @@ -29,7 +29,7 @@ Image(src: string | PixelMap | Resource) | 参数名 | 参数类型 | 必填 | 参数描述 | | ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| 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文件夹下的图片资源。需要保证目录包路径下的文件有可读权限。
**说明:**
- ArkTS卡片上支持gif图片格式动效,但仅在显示时播放一次。
- ArkTS卡片上不支持`http://`等网络相关路径前缀、`datashare://`路径前缀以及`file://data/storage`路径前缀的字符串
- ArkTS卡片上不支持 [PixelMap](../apis/js-apis-image.md#pixelmap7)类型 | +| 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-management/medialibrary-overview.md#申请媒体库功能相关权限)
\- 支持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)类型 | ## 属性 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-qrcode.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md index e6e48f77ebd3b8d73f5a1a72997021cdcc2dd850..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开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> +> 二维码组件的像素点数量与内容有关,当组件尺寸过小时,可能出现无法展示内容的情况,此时需要适当调整组件尺寸。 ## 子组件 @@ -22,7 +24,7 @@ QRCode(value: string) | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| value | string | 是 | 二维码内容字符串。 | +| value | string | 是 | 二维码内容字符串。最大支持256个字符,若超出,则截取前256个字符。 | ## 属性 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 2be4487c78625ad1747737ba5b8a523f0e251ce4..1572040765b11658f11b565929dccc4e909686e8 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 @@ -43,7 +43,7 @@ TextInput(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Te | style9+ | [TextInputStyle](#textinputstyle9枚举说明) | 设置输入框为默认风格或内联输入风格。
默认值:TextInputStyle.Default | | textAlign9+ | [TextAlign](ts-appendix-enums.md#textalign) | 设置输入文本在输入框中的对齐方式。
默认值:TextAlign.Start | | selectedBackgroundColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置文本选中底板颜色。 | -| caretStyle10+ | {
caretWidth: [Length](ts-types.md#length)
} | 设置光标风格。 | +| caretStyle10+ | {
width: [Length](ts-types.md#length)
} | 设置光标风格。 | | caretPosition10+ | number | 设置光标位置。 | > **说明:** 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..69c483aeaa7422b8bd6e0746241c318d7a5593ed 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,25 @@ 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) | 否 | 文本信息。 | ## 属性 | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | | 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 +48,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..48e5f172f67d70f7d93c86cb4b93208a81b3bf92 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 @@ -30,6 +30,9 @@ TimePicker(options?: {selected?: Date}) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | | 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类型说明) | 设置选中项的文本颜色、字号、字体粗细。 | ## 事件 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-types.md b/zh-cn/application-dev/reference/arkui-ts/ts-types.md index 9fbeb42aab15a612da74627fe93c0ecb211be8d6..6dea36b625b7a3d267bf8f9066b6d244e298f1f7 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-types.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-types.md @@ -122,7 +122,7 @@ | 类型 | 说明 | | ---------------------------------------- | ------------------------------------------------- | | [Color](ts-appendix-enums.md#color) | 颜色枚举值。 | -| number | HEX格式颜色。 | +| number | HEX格式颜色,支持rgb。 | | string | rgb或者argb格式颜色。 | | [Resource](#resource) | 使用引入资源的方式,引入系统资源或者应用资源中的颜色。 | @@ -132,7 +132,7 @@ | 名称 | 描述 | | --------- | ------- | -| Invert | 设置前景色为控件背景色的反色。| +| INVERT | 设置前景色为控件背景色的反色。| ## LengthConstrain 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-location.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-location.md index d48f2173dba569da02985ffbe9ebcac2de6790c1..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 @@ -14,7 +14,7 @@ | -------- | -------- | -------- | | 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卡片中使用。 | +| 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,20 +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) - .textAlign(TextAlign.End) - .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%') @@ -87,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) @@ -95,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) @@ -111,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 }) @@ -128,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) @@ -136,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..e15fc1b17998ce850e2943cb213129e24f0153be 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,25 @@ ## 属性 -| 名称 | 参数类型 | 描述 | +| 名称 | 参数类型 | 描述 | | ---------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| bindMenu | Array<[MenuItem](#menuitem)> \| [CustomBuilder](ts-types.md#custombuilder8) | 给组件绑定菜单,点击后弹出菜单。弹出菜单项支持文本和自定义两种功能。 | +| bindMenu | content: Array<[MenuItem](#menuitem)> \| [CustomBuilder](ts-types.md#custombuilder8),
options10+: [MenuOptions](#menuoptions10)10+ | 给组件绑定菜单,点击后弹出菜单。弹出菜单项支持图标+文本排列和自定义两种功能。
content: 必填,配置菜单项图标和文本的数组,或者自定义组件
options: 非必填,配置弹出菜单的参数 | | bindContextMenu8+ | content: [CustomBuilder](ts-types.md#custombuilder8),
responseType: [ResponseType](ts-appendix-enums.md#responsetype8) | 给组件绑定菜单,触发方式为长按或者右键点击,弹出菜单项需要自定义。 | ## MenuItem -| 名称 | 类型 | 描述 | -| ------ | ----------------------- | ----------- | -| value | string | 菜单项文本。 | -| action | () => void | 点击菜单项的事件回调。 | +| 名称 | 类型 | 必填 | 描述 | +| ------------------ | -------------------------------------- | ---- | ---------------------- | +| value | string | 是 | 菜单项文本。 | +| icon10+ | [ResourceStr](ts-types.md#resourcestr) | 否 | 菜单项图标。 | +| action | () => void | 是 | 点击菜单项的事件回调。 | +## MenuOptions10+ + +| 名称 | 类型 | 必填 | 描述 | +| ------ | -------------------------------- | ---- | ------------------------------------------------------ | +| title | string | 否 | 菜单标题。 | +| offset | [Position](ts-types.md#position8) | 否 | 菜单弹出位置的偏移量,不会导致菜单显示超出屏幕范围。 | ## 示例 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..f3b2f7d831c4d6fc6d83ae28e222238d8215d79f 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 @@ -26,7 +26,15 @@ | 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+类型说明 | 名称 | 类型 | 必填 | 描述 | @@ -40,7 +48,7 @@ | 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 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 d7c6f070afe88b8046b38870ef2e7176491661d1..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 @@ -13,11 +13,56 @@ | 名称 | 参数类型 | 描述 | | -----| ------------------------------------------ | ------------------------------------ | | 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) | 在当前组件上加上指定形状的遮罩。
从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-transformation.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md index 648f16c3e6166c41a15204f6587ba5c4ad162001..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%'
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | -| translate | {
x?: number \| string,
y?: number \| string,
z? : number \| string
} | 可以分别设置X轴、Y轴、Z轴的平移距离,距离的正负控制平移的方向。不支持百分比形式的输入。
默认值:
{
x: 0,
y: 0,
z: 0
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| 名称 | 参数类型 | 描述 | +| --------- | ---------------------------------------- | ---------------------------------------- | +| 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) | 设置当前组件的变换矩阵。 | +| transform | [Matrix4Transit](../apis/js-apis-matrix4.md) | 设置当前组件的变换矩阵。 | +> **说明:** +> +> 当组件同时设置了rotate和scale属性时,centerX和centerY的取值会发生冲突,此时centerX和centerY的值以后设定属性的值为准。 ## 示例 diff --git a/zh-cn/application-dev/reference/errorcodes/Readme-CN.md b/zh-cn/application-dev/reference/errorcodes/Readme-CN.md index 6f6b2cb855d65b2d2820613ae9273c74f763ce28..6267fa52fc5786b5b355242dcced764b3112ea15 100644 --- a/zh-cn/application-dev/reference/errorcodes/Readme-CN.md +++ b/zh-cn/application-dev/reference/errorcodes/Readme-CN.md @@ -43,7 +43,7 @@ - [数据共享错误码](errorcode-datashare.md) - [分布式数据对象错误码](errorcode-distributed-dataObject.md) - [分布式键值数据库错误码](errorcode-distributedKVStore.md) - - [首选项错误码](errorcode-preferences.md) + - [用户首选项错误码](errorcode-preferences.md) - 文件管理 - [文件管理子系统错误码](errorcode-filemanagement.md) - 电话服务 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-ability.md b/zh-cn/application-dev/reference/errorcodes/errorcode-ability.md index bace485b136291d552d4247aef0d95d9b4e06ec3..202bd9d425c7f583b5db8c075e6b3df57fc196f0 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-ability.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-ability.md @@ -186,6 +186,24 @@ The context does not exist. 请检查上下文对象是否可用。 +## 16000012 上一个Ability未启动完成,先缓存在队列中等待后续启动。 + +**错误信息** + +The previous ability is starting, wait start later. + +**错误描述** + +需要启动的Ability过多,由于系统处理能力有限,会先将请求缓存在队列中,按照顺序依次处理。 + +**可能原因** + +系统并发大。 + +**处理步骤** + +无需处理,等待启动即可。 + ## 16000050 内部错误 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-bundle.md b/zh-cn/application-dev/reference/errorcodes/errorcode-bundle.md index 7f3f91ebc64dc31aa15732ad69928d3a2623d873..c68152ab39b592fb7c7c4b7abfcf71da535605e7 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-bundle.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-bundle.md @@ -471,7 +471,7 @@ The specified bundle is an overlay bundle. ## 17700036 共享库缺少AllowAppShareLibrary特权导致安装失败 **错误信息**
-Failed to install because without allow app shared bundle permission. +Failed to install the HSP because lacks appropriate permissions. **错误描述**
共享库未申请配置AllowAppShareLibrary特权,可能存在安全隐私风险,不允许安装。 @@ -514,4 +514,34 @@ The specified shared bundle does not exist. 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-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-preferences.md b/zh-cn/application-dev/reference/errorcodes/errorcode-preferences.md index 9fe87bc4b97b2eccb9133004a080446d76fab8de..2a7fca5cc095bc5a4823f9ce587d7487adbb74de 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-preferences.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-preferences.md @@ -1,17 +1,17 @@ -# 首选项错误码 +# 用户首选项错误码 > **说明:** > > 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 -## 15500010 删除首选项失败 +## 15500010 删除用户首选项持久化文件失败 **错误信息** Failed to delete preferences. **错误描述** -删除首选项失败。 +删除用户首选项持久化文件失败。 **可能原因** 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/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/device-dev/subsystems/Readme-CN.md b/zh-cn/device-dev/subsystems/Readme-CN.md index a547550a2e517f8b9daa1868abc72cdb63a0e12b..8db80acc71b81397c3178ca20d343836bdb8ec35 100644 --- a/zh-cn/device-dev/subsystems/Readme-CN.md +++ b/zh-cn/device-dev/subsystems/Readme-CN.md @@ -97,7 +97,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) @@ -105,6 +104,7 @@ - [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) 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-hitracechain.md b/zh-cn/device-dev/subsystems/subsys-dfx-hitracechain.md index 0659079bcca77980e3655d16a0834f2b3e074678..1941e1a7db0f0bc7c091fb3a08703f41310dc6fd 100644 --- a/zh-cn/device-dev/subsystems/subsys-dfx-hitracechain.md +++ b/zh-cn/device-dev/subsystems/subsys-dfx-hitracechain.md @@ -137,7 +137,7 @@ HiTraceChain实现在C层,主要原理是在一次业务调用流程中,利 | | 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-overview.md b/zh-cn/device-dev/subsystems/subsys-dfx-overview.md index c20077d8a63df17583c8634d865668bbea5fa9b8..bc4c9e8a6c4de388101d6b8824cf3a7df641a3e1 100644 --- a/zh-cn/device-dev/subsystems/subsys-dfx-overview.md +++ b/zh-cn/device-dev/subsystems/subsys-dfx-overview.md @@ -7,7 +7,7 @@ 提供以下功能: -- HiLog流水日志,轻量系统类设备(参考内存≥128KiB)、小型系统类设备(参考内存≥1MiB)适用、标准系统类设备(参考内存≥128MB)适用。 +- HiLog流水日志,标准系统类设备(参考内存≥128MB)适用、HiLog_Lite轻量流水日志,轻量系统类设备(参考内存≥128KiB),小型系统类设备(参考内存≥1MiB)适用。 - HiTraceChain分布式跟踪,标准系统类设备(参考内存≥128MiB)适用。 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/release-notes/OpenHarmony-v3.1.3-release.md b/zh-cn/release-notes/OpenHarmony-v3.1.3-release.md index 493b77b534ac0e867c7cd417067022a983b1df0c..47b48ac3385903392c30a14f651ecdd58817bfe6 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厂商提供,包含了需要使用系统权限的系统接口。
使用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厂商提供,包含了需要使用系统权限的系统接口。
使用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) | 面向应用开发者提供,不包含需要使用系统权限的系统接口。
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智能设备集成开发环境推荐使用。 | 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.7/changelogs-bundlemanager.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-bundlemanager.md index ee19ef727948307f189f19ef2857e3f02eb64c70..a35a20b092e9c8095deaaf85fb73ec575fcf936a 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,10 @@ module.json配置文件中的ability的[name](../../../application-dev/quick-sta 删除配置文件module.json[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 **适配指导**
-删除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配置文件中launchTypede标签standard模式修改为multiton +删除module.json中[launchType](../../../application-dev/quick-start/module-configuration-file.md)标签的standard模式修改为multiton + +**适配指导**
+删除module.json中[launchType](../../../application-dev/quick-start/module-configuration-file.md)标签的standard模式,使用multiton替代 \ 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。| + +**适配指导** + +请按上述取值变更结果适配更新。