diff --git a/README.md b/README.md index 0373151e1eed3dc5dd8175f3724556de2529bdd9..9e744f73cc8145806a7c234a46b1ca2cca183712 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,12 @@ OpenHarmony_v1.x_release: OpenHarmony v1.1.4 LTS. [Learn more](en/release-notes/ ## Third-Party Open-Source Software and License Notice -3rd-Party-License: [Third-Party Open-Source Software and License Notice](en/contribute/third-party-open-source-software-and-license-notice.md) +Third-party license: [Third-Party Open-Source Software and License Notice](en/contribute/third-party-open-source-software-and-license-notice.md) ## How to Contribute -A great open-source project wouldn't be possible without the hard work of many contributors. We'd like to invite anyone from around the world to [participate](contribute/contribution.md) in this exciting journey, and we're grateful for your time, passion, and efforts! +A great open-source project wouldn't be possible without the hard work of many contributors. We'd like to invite anyone from around the world to [participate](en/contribute/how-to-contribute.md) in this exciting journey, and we're grateful for your time, passion, and efforts! -You can evaluate available documents, make simple modifications, provide feedback on document quality, and contribute your original content. For details, see [Documentation Contribution](contribute/documentation-contribution.md). +You can evaluate available documents, make simple modifications, provide feedback on document quality, and contribute your original content. For details, see [Documentation Contribution](en/contribute/documentation-contribution.md). Excellent contributors will be awarded and the contributions will be publicized in the developer community. diff --git a/README_zh.md b/README_zh.md index 29a601d1d9067d74d607d7226c0147ac386d1d39..5fd17116edf8be3aa6b997ee770d47c453f24a87 100644 --- a/README_zh.md +++ b/README_zh.md @@ -18,19 +18,19 @@ master:最新开发版本。 -发布OpenHarmony 3.1 Release版本,[了解版本详情](zh-cn/release-notes/OpenHarmony-v3.1-release.md)。 +OpenHarmony 3.1 Release版本:点击[此处](zh-cn/release-notes/OpenHarmony-v3.1-release.md)了解版本详情。 -发布OpenHarmony 3.0 LTS版本,[了解版本详情](zh-cn/release-notes/OpenHarmony-v3.0-LTS.md)。该版本已更新至OpenHarmony 3.0.3 LTS,[了解版本详情](zh-cn/release-notes/OpenHarmony-v3.0.3-LTS.md)。 +OpenHarmony 3.0 LTS版本:点击[此处](zh-cn/release-notes/OpenHarmony-v3.0-LTS.md)了解版本详情。该版本已更新至OpenHarmony 3.0.3 LTS,点击[此处](zh-cn/release-notes/OpenHarmony-v3.0.3-LTS.md)了解版本详情。 -发布 OpenHarmony v2.2 Beta2版本,[了解版本详情](zh-cn/release-notes/OpenHarmony-v2.2-beta2.md)。 +OpenHarmony v2.2 Beta2版本:点击[此处](zh-cn/release-notes/OpenHarmony-v2.2-beta2.md)了解版本详情。 -发布OpenHarmony 2.0 Canary预览版本,[了解版本详情](zh-cn/release-notes/OpenHarmony-2-0-Canary.md)。 +OpenHarmony 2.0 Canary预览版本:点击[此处](zh-cn/release-notes/OpenHarmony-2-0-Canary.md)了解版本详情。 ### 历史稳定版本 -OpenHarmony_v1.x_release:OpenHarmony 1.1.4 LTS稳定版本,[了解版本详情](zh-cn/release-notes/OpenHarmony-v1-1-4-LTS.md)。 +OpenHarmony_v1.x_release:OpenHarmony 1.1.4 LTS稳定版本,点击[此处](zh-cn/release-notes/OpenHarmony-v1-1-4-LTS.md)了解版本详情。 -[了解更多版本详情](zh-cn/release-notes/)。 +如需了解更多版本详情,点击[此处](zh-cn/release-notes/)。 ## 第三方开源软件及许可说明 @@ -39,7 +39,7 @@ OpenHarmony_v1.x_release:OpenHarmony 1.1.4 LTS稳定版本,[了解版本详 ## 贡献 -非常欢迎您参与[贡献](zh-cn/contribute/参与贡献.md),我们鼓励开发者以各种方式参与文档反馈和贡献。 +欢迎您参与[贡献](zh-cn/contribute/参与贡献.md),我们鼓励开发者以各种方式参与文档反馈和贡献。 您可以对现有文档进行评价、简单更改、反馈文档质量问题、贡献您的原创内容,详细请参考[贡献文档](zh-cn/contribute/贡献文档.md)。 diff --git a/en/OpenHarmony-Overview.md b/en/OpenHarmony-Overview.md index fe725c9e7722b73ef79d49329bf680994e90abb3..78abcbd9df183779c9e930e8904019921970a145 100644 --- a/en/OpenHarmony-Overview.md +++ b/en/OpenHarmony-Overview.md @@ -1,4 +1,4 @@ -# OpenHarmony +# OpenHarmony Project ## Introduction @@ -109,245 +109,56 @@ You need to understand the following basic concepts related to OpenHarmony: A module is a reusable software binary unit that contains source code, configuration files, resource files, and build scripts. A module can be built independently, integrated in binary mode, and then tested independently. - The following table describes the subsystems of OpenHarmony. For details about the readme files of these subsystems, see [https://gitee.com/openharmony/docs/tree/master/en/readme](https://gitee.com/openharmony/docs/tree/master/en/readme). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Subsystem

-

Description

-

Applicable To

-

Kernel

-

Supports small-sized LiteOS kernels that provide high performance and low power consumption for embedded devices and devices with limited resources, and supports Linux kernels that are applicable to the standard system.

-

Small system

-

Standard system

-

DFileSystem

-

Provides APIs for synchronizing local JS files.

-

Standard system

-

Graphics

-

Consists of user interface (UI) components, layout, animator, font, input event, window management, and rendering and drawing modules. It is an application framework that can be built on the LiteOS to develop OpenHarmony applications for Internet of Things (IoT) devices with limited hardware resources or on the standard OS to develop OpenHarmony applications for standard- and large-system devices (for example, tablet and lite smart devices).

-

All systems

-

Driver

-

Constructed using the C object-oriented programming (OOP) language. It provides a unified driver platform and is compatible with different kernels by means of platform decoupling and kernel decoupling. This unified driver platform is designed to provide a more precise and efficient development environment, where you develop a driver that can be deployed on different systems supporting Hardware Driver Foundation (HDF).

-

All systems

-

Power Management

-

Provides the following functions: restarting the system, managing running locks, managing and querying the system power status, querying and reporting the charging and battery status, and turning on/off the device screen, including adjusting the screen brightness.

-

Standard system

-

Pan-sensor

-

Contains sensors and misc devices. A sensor is a device to detect events or changes in an environment and send messages about the events or changes to another electronic device. Misc devices, including vibrators and LED lights, are used to send signals externally. You can call APIs to control the vibration of vibrators and lighting-on and lighting-off of LED lights.

-

Small system

-

Multimodal Input

-

OpenHarmony provides a Natural User Interface (NUI) for you to interact with your users. Unlike conventional categorization of input methods, OpenHarmony combines input methods of different dimensions into multimodal inputs, so you can easily arm your app with multi-dimensional, natural interaction features by using the application framework and system built-in UI components or APIs. Specifically, OpenHarmony currently supports traditional input methods such as key and touch inputs.

-

Standard system

-

Startup

-

Starts the OS middle layer between the time the kernel is started and the time apps are started. In addition, you can query and modify system attributes and restore factory settings.

-

All systems

-

Update

-

Supports over the air (OTA) update of OpenHarmony devices.

-

Standard system

-

Account

-

Provides interconnection with vendors' cloud account apps on the device side, and query and update of the cloud account login status.

-

Standard system

-

Compilation and Building

-

Provides a compilation and building framework based on Generate Ninja (GN) and Ninja.

-

All systems

-

Testing

-

The test-driven development mode is used during the development process. You can develop new cases or modify existing cases to test new or enhanced system features. The test helps you develop high-quality code in the development phase.

-

All systems

-

Data Management

-

Provides local data management and distributed data management:

-
  • Local app data management for lightweight preference databases and relational databases
  • Distributed data service to provide apps with the capability to store data in the databases of different devices
-

Standard system

-

Programming Language Runtime

-

Provides the compilation and execution environment for programs developed with JavaScript or C/C++, basic libraries that support the runtime, and the runtime-associated APIs, compilers, and auxiliary tools.

-

All systems

-

Distributed Scheduler

-

Starts, registers, queries, and manages system services.

-

All systems

-

JS UI framework

-

OpenHarmony UI development framework that supports web-development-like paradigm.

-

All systems

-

Multimedia

-

Provides easy-to-use APIs for developing multimedia components such as audio, video, and camera, and enables apps to use multimedia resources of the system.

-

All systems

-

Event Notification

-

Provides the common event management capabilities that allow apps to subscribe to, unsubscribe from, publish, and receive common events (such as screen-on/off events and USB device attachment/detachment events).

-

Standard system

-

Misc Services

-

Provides the function of setting the time.

-

Standard system

-

Bundle management

-

Provides bundle installation, uninstallation, update, and query capabilities.

-

All systems

-

Telephony

-

Provides basic communication capabilities of the cellular network, such as SIM cards, network search, cellular data, cellular calls, SMS, and MMS, as well as easy-to-use APIs for you to manage multiple types of calls and data network connections.

-

Standard system

-

Utils

-

Stores basic OpenHarmony components, which can be used by OpenHarmony subsystems and upper-layer apps.

-

All systems

-

Development Tools

-

Provides a performance profiler platform for you to analyze system issues such as memory and performance, including hdc used for device debugging, APIs for performance tracing, and a performance profiler framework.

-

Standard system

-

DSoftBus

-

Provides cross-process or cross-device communication capabilities for the OpenHarmony system and consists of the DSoftBus and IPC modules. The DSoftBus module enables distributed communication between near-field devices and provides device discovery, connection, networking, and data transmission functions, regardless of the communication mode. The IPC module enables communication between processes on a device or across devices.

-

All systems

-

XTS

-

Provides a set of OpenHarmony compatibility test suites, including the currently supported application compatibility test suite (ACTS) and the device compatibility test suite (DCTS) that will be supported in the future.

-

All systems

-

System Apps

-

Provides system apps that are applicable to the OpenHarmony standard system, such as Launcher, SystemUI, and Settings. It also provides specific examples for you to build standard-system apps, which can be installed on all devices running the standard system.

-

Standard system

-

DFX

-

Provides non-functional capabilities of OpenHarmony. It provides a logging system, app and system event logging APIs, the event log subscription service, and fault information generation and collection capabilities.

-

All systems

-

Globalization

-

If OpenHarmony devices and apps need to be used globally, they must meet the requirements of users in different regions on languages and cultures. The Globalization subsystem provides multi-language and multi-cultural capabilities for global use, including resource management and internationalization (i18n).

-

All systems

-

Security

-

Provides system, data, and app security capabilities to protect system and user data of OpenHarmony. Its functions include app integrity verification, app permission management, device authentication, and key management.

-

All systems

-
+| Subsystem| Description| Applicable To| +| -------- | -------- | -------- | +| Kernel| Supports small-sized LiteOS kernels that provide high performance and low power consumption for embedded devices and devices with limited resources, and supports Linux kernels that are applicable to the standard system.| Small system
Standard system | +| DFileSystem | Provides APIs for synchronizing local JS files. | Standard system | +| Graphics | Consists of user interface (UI) components, layout, animator, font, input event, window management, and rendering and drawing modules. It is an application framework that can be built on the LiteOS to develop OpenHarmony applications for Internet of Things (IoT) devices with limited hardware resources or on the standard OS to develop OpenHarmony applications for standard- and large-system devices (for example, tablet and lite smart devices). | All systems | +| Driver | Constructed using the C object-oriented programming (OOP) language. It provides a unified driver platform and is compatible with different kernels by means of platform decoupling and kernel decoupling. This unified driver platform is designed to provide a more precise and efficient development environment, where you develop a driver that can be deployed on different systems supporting Hardware Driver Foundation (HDF). | All systems | +| Power Management | Provides the following functions: restarting the system, managing running locks, managing and querying the system power status, querying and reporting the charging and battery status, and turning on/off the device screen, including adjusting the screen brightness. | Standard system | +| Pan-sensor | Contains sensors and misc devices. A sensor is a device to detect events or changes in an environment and send messages about the events or changes to another electronic device. Misc devices, including vibrators and LED lights, are used to send signals externally. You can call APIs to control the vibration of vibrators and lighting-on and lighting-off of LED lights. | Small system | +| Multimodal Input | OpenHarmony provides a Natural User Interface (NUI) for you to interact with your users. Unlike conventional categorization of input methods, OpenHarmony combines input methods of different dimensions into multimodal inputs, so you can easily arm your app with multi-dimensional, natural interaction features by using the application framework and system built-in UI components or APIs. Specifically, OpenHarmony currently supports traditional input methods such as key and touch inputs. | Standard system | +| Startup | Starts the OS middle layer between the time the kernel is started and the time apps are started. In addition, you can query and modify system attributes and restore factory settings. | All systems | +| Update | Supports over the air (OTA) update of OpenHarmony devices. | Standard system | +| Account | Provides interconnection with vendors' cloud account apps on the device side, and query and update of the cloud account login status. | Standard system | +| Compilation and Building | Provides a compilation and building framework based on Generate Ninja (GN) and Ninja. | All systems | +| Test | The test-driven development mode is used during the development process. You can develop new cases or modify existing cases to test new or enhanced system features. The test helps you develop high-quality code in the development phase. | All systems | +| Data Management | Provides local data management and distributed data management:<\br> - Local app data management for lightweight preference databases and relational databases<\br> - Distributed data service to provide apps with the capability to store data in the databases of different devices | Standard system | +| Programming Language Runtime | Provides the compilation and execution environment for programs developed with JavaScript or C/C++, basic libraries that support the runtime, and the runtime-associated APIs, compilers, and auxiliary tools. | All systems | +| Distributed Scheduler | Starts, registers, queries, and manages system services. | All systems | +| JS UI framework | OpenHarmony UI development framework that supports web-development-like paradigm. | All systems | +| Multimedia | Provides easy-to-use APIs for developing multimedia components such as audio, video, and camera, and enables apps to use multimedia resources of the system. | All systems | +| Event Notification | Provides the common event management capabilities that allow apps to subscribe to, unsubscribe from, publish, and receive common events (such as screen-on/off events and USB device attachment/detachment events). | Standard system | +| Misc Services | Provides the function of setting the time. | Standard system | +| Bundle management | Provides bundle installation, uninstallation, update, and query capabilities. | All systems | +| Telephony | Provides basic communication capabilities of the cellular network, such as SIM cards, network search, cellular data, cellular calls, SMS, and MMS, as well as easy-to-use APIs for you to manage multiple types of calls and data network connections. | Standard system | +| Utils | Stores basic OpenHarmony components, which can be used by OpenHarmony subsystems and upper-layer apps. | All systems | +| Development Tools | Provides a performance profiler platform for you to analyze system issues such as memory and performance, including hdc used for device debugging, APIs for performance tracing, and a performance profiler framework. | Standard system | +| DSoftBus | Provides cross-process or cross-device communication capabilities for the OpenHarmony system and consists of the DSoftBus and IPC modules. The DSoftBus module enables distributed communication between near-field devices and provides device discovery, connection, networking, and data transmission functions, regardless of the communication mode. The IPC module enables communication between processes on a device or across devices. | All systems | +| XTS | Provides a set of OpenHarmony compatibility test suites, including the currently supported application compatibility test suite (ACTS) and the device compatibility test suite (DCTS) that will be supported in the future. | All systems | +| System Apps | Provides system apps that are applicable to the OpenHarmony standard system, such as Launcher, SystemUI, and Settings. It also provides specific examples for you to build standard-system apps, which can be installed on all devices running the standard system. | Standard system | +| DFX | Provides non-functional capabilities of OpenHarmony. It provides a logging system, app and system event logging APIs, the event log subscription service, and fault information generation and collection capabilities. | All systems | +| Globalization | If OpenHarmony devices and apps need to be used globally, they must meet the requirements of users in different regions on languages and cultures. The Globalization subsystem provides multi-language and multi-cultural capabilities for global use, including resource management and internationalization (i18n). | All systems | +| Security | Provides system, data, and app security capabilities to protect system and user data of OpenHarmony. Its functions include app integrity verification, app permission management, device authentication, and key management. | All systems | ## Supported Development Boards Currently, OpenHarmony supports the development boards listed in the following table. -| System Type| Board Model| Chip Model| Function Description| Application Scenario| Code Repository| Daily Build| -| -------- | -------- | -------- | -------- | -------- | -------- | -------- | -| Standard system| Hi3516DV300 | Hi3516DV300 | Hi3516D V300 is a the next-generation system on chip (SoC) for smart HD IP cameras. It integrates the next-generation image signal processor (ISP), H.265 video compression encoder, and high-performance NNIE engine, and delivers exceptional performance in terms of low bit rate, high image quality, intelligent processing and analysis, and low power consumption.| Devices with screens, such as refrigerators and head units.| [device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](https://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon) | http://ci.openharmony.cn/dailybuilds| -| Standard system| Runhe HH-SCDAYU200| RK3568 | Bolstered by the Rockchip RK3568, the HH-SCDAYU200 development board integrates a dual-core GPU and high-efficiency NPU. Its quad-core 64-bit Cortex-A55 processor uses the advanced 22 nm fabrication process and is clocked at up to 2.0 GHz. The board is packed with Bluetooth, WiFi, audio, video, and camera features, with a wide range of expansion ports as well as video input and output ports. It comes with dual GE auto-sensing RJ45 ports, so it can be used in multi-connectivity products, such as network video recorders (NVRs) and industrial gateways.| Video and audio entertainment, smart travel, and smart home, such as kitchen hoods, ovens, and treadmills.| [device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope) | -| Lightweight| Goodix GR5515-STARTER-KIT| GR5515 | The GR5515-STARTER-KIT development board is a Bluetooth 5.1-capable single-mode Bluetooth low energy (BLE) SoC and comes with multifunctional keys and LED indicators.| Smart hardware, such as watches, wristbands, and price tags.| [device_soc_goodix](https://gitee.com/openharmony/device_soc_goodix)
[device_board_goodix](https://gitee.com/openharmony/device_board_goodix) | -| Lightweight| Langguo LANGO200| ASR582X | The LANGO200 IoT development board integrates the high-performance WiFi-BLE dual-mode chip ASR5822, external storage chip, voice playing chip, and analog-to-digital converter. It supports common peripheral interfaces like SPI, and can be connected to an external OLED display and infrared remote control.| Connection modules for smart home products.| [device_soc_asrmicro](https://gitee.com/openharmony/device_soc_asrmicro)
[device_board_lango](https://gitee.com/openharmony/device_board_lango)
[vendor_asrmicro](https://gitee.com/openharmony/vendor_asrmicro) | -| Lightweight| Fn-Link multi-modal V200ZR| BES2600 | The multi-modal V200Z-R development board is a high-performance, multi-functional, and cost-effective AIoT SoC powered by the BES2600WM chip of Bestechnic. It integrates a quad-core ARM processor with a frequency of up to 1 GHz as well as dual-mode WiFi and dual-mode Bluetooth. The board supports the 802.11 a/b/g/n/ and BT/BLE 5.2 standards. It is able to accommodate RAM of up to 42 MB and flash memory of up to 32 MB, and supports the MIPI display serial interface (DSI) and camera serial interface (CSI). It is applicable to various AIoT multi-modal VUI and GUI interaction scenarios.| Smart hardware with screens, such as speakers and watches.| [device_soc_bestechnic](https://gitee.com/openharmony/device_soc_bestechnic)
[device_board_fnlink](https://gitee.com/openharmony/device_board_fnlink)
[vendor_bestechnic](https://gitee.com/openharmony/vendor_bestechnic) | -| Lightweight| BearPi-HM_Nano| Hi3861 | The BearPi-HM_Nano development board is specially designed for OpenHarmony. It is equipped with the highly integrated 2.4 GHz WiFi SoC chip Hi3861, near field communication (NFC) circuits, and standard E53 interfaces, which can be used to connect to smart humidifiers, smart desk lamps, smart security facilities, and intelligent smoke detectors.| Connection devices like smart street lamps, smart logistics sensors, and human body infrared sensors.| [device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_bearpi](https://gitee.com/openharmony/device_board_bearpi)
[vendor_bearpi](https://gitee.com/openharmony/vendor_bearpi) | +| System Type| Board Model| Chip Model| Function Description| Application Scenario| Code Repository and Daily Build| +| -------- | -------- | -------- | -------- | -------- | -------- | +| Standard system| Hi3516DV300 | Hi3516DV300 | Hi3516D V300 is a the next-generation system on chip (SoC) for smart HD IP cameras. It integrates the next-generation image signal processor (ISP), H.265 video compression encoder, and high-performance NNIE engine, and delivers exceptional performance in terms of low bit rate, high image quality, intelligent processing and analysis, and low power consumption.| Devices with screens, such as refrigerators and head units.| Code repositories:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](https://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon)
Daily build:
http://ci.openharmony.cn/dailys/dailybuilds | +| Standard system| Runhe HH-SCDAYU200| RK3568 | Bolstered by the Rockchip RK3568, the HH-SCDAYU200 development board integrates a dual-core GPU and high-efficiency NPU. Its quad-core 64-bit Cortex-A55 processor uses the advanced 22 nm fabrication process and is clocked at up to 2.0 GHz. The board is packed with Bluetooth, WiFi, audio, video, and camera features, with a wide range of expansion ports as well as video input and output ports. It comes with dual GE auto-sensing RJ45 ports, so it can be used in multi-connectivity products, such as network video recorders (NVRs) and industrial gateways.| Video and audio entertainment, smart travel, and smart home, such as kitchen hoods, ovens, and treadmills.| Code repositories:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope)
Daily build:
http://ci.openharmony.cn/dailys/dailybuilds | +| Lightweight| Goodix GR5515-STARTER-KIT| GR5515 | The GR5515-STARTER-KIT development board is a Bluetooth 5.1-capable single-mode Bluetooth low energy (BLE) SoC and comes with multifunctional keys and LED indicators.| Smart hardware, such as watches, wristbands, and price tags.| Code repositories:
[device_soc_goodix](https://gitee.com/openharmony/device_soc_goodix)
[device_board_goodix](https://gitee.com/openharmony/device_board_goodix)
Daily build:
http://ci.openharmony.cn/dailys/dailybuilds | +| Lightweight| Langguo LANGO200| ASR582X | The LANGO200 IoT development board integrates the high-performance WiFi-BLE dual-mode chip ASR5822, external storage chip, voice playing chip, and analog-to-digital converter. It supports common peripheral interfaces like SPI, and can be connected to an external OLED display and infrared remote control.| Connection modules for smart home products.| Code repositories:
[device_soc_asrmicro](https://gitee.com/openharmony/device_soc_asrmicro)
[device_board_lango](https://gitee.com/openharmony/device_board_lango)
[vendor_asrmicro](https://gitee.com/openharmony/vendor_asrmicro)
Daily build:
http://ci.openharmony.cn/dailys/dailybuilds | +| Lightweight| Fn-Link multi-modal V200ZR| BES2600 | The multi-modal V200Z-R development board is a high-performance, multi-functional, and cost-effective AIoT SoC powered by the BES2600WM chip of Bestechnic. It integrates a quad-core ARM processor with a frequency of up to 1 GHz as well as dual-mode WiFi and dual-mode Bluetooth. The board supports the 802.11 a/b/g/n/ and BT/BLE 5.2 standards. It is able to accommodate RAM of up to 42 MB and flash memory of up to 32 MB, and supports the MIPI display serial interface (DSI) and camera serial interface (CSI). It is applicable to various AIoT multi-modal VUI and GUI interaction scenarios.| Smart hardware with screens, such as speakers and watches.| Code repositories:
[device_soc_bestechnic](https://gitee.com/openharmony/device_soc_bestechnic)
[device_board_fnlink](https://gitee.com/openharmony/device_board_fnlink)
[vendor_bestechnic](https://gitee.com/openharmony/vendor_bestechnic)
Daily build:
http://ci.openharmony.cn/dailys/dailybuilds | +| Lightweight| BearPi-HM_Nano| Hi3861 | The BearPi-HM_Nano development board is specially designed for OpenHarmony. It is equipped with the highly integrated 2.4 GHz WiFi SoC chip Hi3861, near field communication (NFC) circuits, and standard E53 interfaces, which can be used to connect to smart humidifiers, smart desk lamps, smart security facilities, and intelligent smoke detectors.| Connection devices like smart street lamps, smart logistics sensors, and human body infrared sensors.| Code repositories:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_bearpi](https://gitee.com/openharmony/device_board_bearpi)
[vendor_bearpi](https://gitee.com/openharmony/vendor_bearpi)
Daily build:
http://ci.openharmony.cn/dailys/dailybuilds | ## Getting Started -- Device development: [device-dev/quick-start/Readme.md](device-dev/quick-start/Readme-EN.md) -- Application development: [application-dev/quick-start/Readme.md](application-dev/quick-start/Readme-EN.md) - -- [Getting Started for Device Development](device-dev/quick-start/quickstart-lite-overview.md) +- [Getting Started for Device Development](device-dev/quick-start/quickstart-ide-lite-overview.md) - [Getting Started for Application Development](application-dev/quick-start/start-overview.md) ## Code Repository Addresses @@ -370,9 +181,15 @@ OpenHarmony archived projects: [https://gitee.com/openharmony-retired](https:// For details about how to obtain the source code of OpenHarmony, see [Source Code Acquisition](https://gitee.com/openharmony/docs/blob/master/en/device-dev/get-code/sourcecode-acquire.md). +## Hands-On Tutorials + +[Samples](https://gitee.com/openharmony/app_samples) + +[Codelabs](https://gitee.com/openharmony/codelabs) + ## How to Participate -For details about how to join in the OpenHarmony community, see [OpenHarmony Community](https://gitee.com/openharmony/community/blob/master/README.md). +For details about how to join in the OpenHarmony community, see [OpenHarmony Community](https://gitee.com/openharmony/community/blob/master/README-EN.md). For details about how to contribute, see [How to Contribute](contribute/how-to-contribute.md). @@ -380,7 +197,7 @@ For details about how to contribute, see [How to Contribute](contribute/how-to- OpenHarmony complies with Apache License Version 2.0. For details, see the LICENSE in each repository. -OpenHarmony uses third-party open-source software and licenses. For details, see [Third-Party Open-Source Software](https://gitee.com/openharmony/docs/blob/master/en/contribute/third-party-open-source-software-and-license-notice.md). +OpenHarmony uses third-party open-source software and licenses. For details, see [Third-Party Open-Source Software](contribute/third-party-open-source-software-and-license-notice.md). ## Contact Info diff --git a/en/application-dev/ability/fa-serviceability.md b/en/application-dev/ability/fa-serviceability.md index 77c7acb2b079ee77acc6d26d59a6234ea463ee97..131d8ec6e02527f49aa6d13e0eec6c2d867004d4 100644 --- a/en/application-dev/ability/fa-serviceability.md +++ b/en/application-dev/ability/fa-serviceability.md @@ -24,16 +24,16 @@ A Service ability is used to run tasks in the background, such as playing music ```javascript export default { - onStart(want) { + onStart() { console.log('ServiceAbility onStart'); }, - onCommand(want, restart, startId) { + onCommand(want, startId) { console.log('ServiceAbility onCommand'); }, onConnect(want) { console.log('ServiceAbility OnConnect'); }, - onDisconnect() { + onDisconnect(want) { console.log('ServiceAbility OnDisConnect'); }, onStop() { @@ -174,7 +174,7 @@ import rpc from "@ohos.rpc"; let mMyStub; export default { - onStart(want) { + onStart() { class MyStub extends rpc.RemoteObject{ constructor(des) { if (typeof des === 'string') { @@ -182,7 +182,7 @@ export default { } return null; } - onRemoteRequest(code, message, reply, option) { + onRemoteRequest(code, data, reply, option) { console.log("ServiceAbility onRemoteRequest called"); if (code === 1) { let op1 = data.readInt(); @@ -197,14 +197,14 @@ export default { } mMyStub = new MyStub("ServiceAbility-test"); }, - onCommand(want, restart, startId) { + onCommand(want, startId) { console.log('ServiceAbility onCommand'); }, onConnect(want) { console.log('ServiceAbility OnConnect'); return mMyStub; }, - onDisconnect() { + onDisconnect(want) { console.log('ServiceAbility OnDisConnect'); }, onStop() { @@ -225,12 +225,12 @@ The following code snippet shows how to implement the callbacks: ```ts let mRemote; function onConnectCallback(element, remote){ - console.log('onConnectLocalService onConnectDone element: ' + element); - console.log('onConnectLocalService onConnectDone remote: ' + remote); + console.log('onConnectRemoteService onConnectDone element: ' + element); + console.log('onConnectRemotelService onConnectDone remote: ' + remote); mRemote = remote; if (mRemote == null) { prompt.showToast({ - message: "onConnectLocalService not connected yet" + message: "onConnectRemoteService not connected yet" }); return; } @@ -243,7 +243,7 @@ function onConnectCallback(element, remote){ console.log('sendRequest success'); let msg = reply.readInt(); prompt.showToast({ - message: "onConnectLocalService connect result: " + msg, + message: "onConnectRemoteService connect result: " + msg, duration: 3000 }); }).catch((e) => { diff --git a/en/application-dev/application-dev-website.md b/en/application-dev/application-dev-website.md deleted file mode 100644 index 35ff141a933ca400736dfaa2dd15affd1d141be6..0000000000000000000000000000000000000000 --- a/en/application-dev/application-dev-website.md +++ /dev/null @@ -1,749 +0,0 @@ -# Application Development - -- [Application Development Overview](application-dev-guide.md) -- Quick Start - - Getting Started - - [Preparations](quick-start/start-overview.md) - - [Getting Started with eTS](quick-start/start-with-ets.md) - - [Getting Started with JavaScript in the Traditional Coding Approach](quick-start/start-with-js.md) - - [Getting Started with JavaScript in the Low-Code Approach](quick-start/start-with-js-low-code.md) - - Development Fundamentals - - [Directory Structure](quick-start/package-structure.md) - - [Resource File Categories](quick-start/basic-resource-file-categories.md) -- Development - - [Ability Development](ability/Readme-EN.md) - - [Ability Framework Overview](ability/ability-brief.md) - - FA Model - - [FA Model Overview](ability/fa-brief.md) - - [Page Ability Development](ability/fa-pageability.md) - - [Service Ability Development](ability/fa-serviceability.md) - - [Data Ability Development](ability/fa-dataability.md) - - [FA Widget Development](ability/fa-formability.md) - - - Other - - [Ability Assistant Usage](ability/ability-assistant-guidelines.md) - - UI - - [ArkUI Overview](ui/arkui-overview.md) - - JavaScript-based Web-Like Development Paradigm - - [Overview](ui/ui-js-overview.md) - - Framework - - [File Organization](ui/js-framework-file.md) - - ["js" Tag](ui/js-framework-js-tag.md) - - [app.js](ui/js-framework-js-file.md) - - Syntax - - [HML](ui/js-framework-syntax-hml.md) - - [CSS](ui/js-framework-syntax-css.md) - - [JavaScript](ui/js-framework-syntax-js.md) - - [Lifecycle](ui/js-framework-lifecycle.md) - - [Resource Limitations and Access](ui/js-framework-resource-restriction.md) - - [Multi-Language Capability](ui/js-framework-multiple-languages.md) - - Building the UI - - [Component Overview](ui/ui-js-building-ui-component.md) - - Building the Layout - - [Layout Description](ui/ui-js-building-ui-layout-intro.md) - - [Adding Title and Paragraph Text](ui/ui-js-building-ui-layout-text.md) - - [Adding an Image](ui/ui-js-building-ui-layout-image.md) - - [Adding a Comment](ui/ui-js-building-ui-layout-comment.md) - - [Adding a Container](ui/ui-js-building-ui-layout-external-container.md) - - [Adding Interactions](ui/ui-js-building-ui-interactions.md) - - [Developing Animations](ui/ui-js-building-ui-animation.md) - - [Defining Events](ui/ui-js-building-ui-event.md) - - [Defining Page Routes](ui/ui-js-building-ui-routes.md) - - Common Component Development Guidelines - - Container Components - - [List Development](ui/ui-js-components-list.md) - - [Dialog Development](ui/ui-js-components-dialog.md) - - [Form Development](ui/ui-js-components-form.md) - - [Stepper Development](ui/ui-js-components-stepper.md) - - [Tabs Development](ui/ui-js-component-tabs.md) - - [Swiper Development](ui/ui-js-components-swiper.md) - - Basic Components - - [Text Development](ui/ui-js-components-text.md) - - [Input Development](ui/ui-js-components-input.md) - - [Button Development](ui/ui-js-components-button.md) - - [Picker Development](ui/ui-js-components-picker.md) - - [Image Development](ui/ui-js-components-images.md) - - [Image-animator Development](ui/ui-js-components-image-animator.md) - - [Rating Development](ui/ui-js-components-rating.md) - - [Slider Development](ui/ui-js-components-slider.md) - - [Chart Development](ui/ui-js-components-chart.md) - - [Switch Development](ui/ui-js-components-switch.md) - - [Toolbar Development](ui/ui-js-components-toolbar.md) - - [Menu Development](ui/ui-js-components-menu.md) - - [Marquee Development](ui/ui-js-components-marquee.md) - - [Qrcode Development](ui/ui-js-components-qrcode.md) - - [Search Development](ui/ui-js-components-search.md) - - Canvas Development - - [CanvasRenderingContext2D](ui/ui-js-components-canvasrenderingcontext2d.md) - - [Path2D](ui/ui-js-components-path2d.md) - - [OffscreenCanvas](ui/ui-js-components-offscreencanvas.md) - - [Grid-container Development](ui/ui-js-components-calendar.md) - - Svg - - [Basics](ui/ui-js-components-svg-overview.md) - - [Graph Drawing](ui/ui-js-components-svg-graphics.md) - - [Path Drawing](ui/ui-js-components-svg-path.md) - - [Text Drawing](ui/ui-js-components-svg-text.md) - - Animation Development Guidelines - - CSS Animation - - [Defining Attribute Style Animations](ui/ui-js-animate-attribute-style.md) - - [Defining Animations with the transform Attribute](ui/ui-js-animate-transform.md) - - [Defining Animations with the background-position Attribute](ui/ui-js-animate-background-position-style.md) - - [Defining Animations for SVG Components](ui/ui-js-animate-svg.md) - - JS Animation - - [Component Animation](ui/ui-js-animate-component.md) - - Interpolator Animation - - [Animation Effect](ui/ui-js-animate-dynamic-effects.md) - - [Animation Frame](ui/ui-js-animate-frame.md) - - [Custom Components](ui/ui-js-custom-components.md) - - TypeScript-based Declarative Development Paradigm - - [Overview](ui/ui-ts-overview.md) - - Framework Overview - - File Organization - - [Directory Structure](ui/ts-framework-directory.md) - - [Rules for Accessing Application Code Files](ui/ts-framework-file-access-rules.md) - - ["js" Tag](ui/ts-framework-js-tag.md) - - Resource Access - - [Accessing Application Resources](ui/ts-application-resource-access.md) - - [Accessing System Resources](ui/ts-system-resource-access.md) - - [Media Resource Types](ui/ts-media-resource-type.md) - - [Pixel Units](ui/ts-pixel-units.md) - - [Types](ui/ts-types.md) - - Declarative Syntax - - [Overview](ui/ts-syntax-intro.md) - - General UI Description Specifications - - [Basic Concepts](ui/ts-general-ui-concepts.md) - - Declarative UI Description Specifications - - [Parameterless Configuration](ui/ts-parameterless-configuration.md) - - [Configuration with Mandatory Parameters](ui/ts-configuration-with-mandatory-parameters.md) - - [Attribution Configuration](ui/ts-attribution-configuration.md) - - [Event Configuration](ui/ts-event-configuration.md) - - [Child Component Configuration](ui/ts-child-component-configuration.md) - - Componentization - - [@Component](ui/ts-component-based-component.md) - - [@Entry](ui/ts-component-based-entry.md) - - [@Preview](ui/ts-component-based-preview.md) - - [@Builder](ui/ts-component-based-builder.md) - - [@Extend](ui/ts-component-based-extend.md) - - [@CustomDialog](ui/ts-component-based-customdialog.md) - - About UI State Management - - [Basic Concepts](ui/ts-ui-state-mgmt-concepts.md) - - Managing Component States - - [@State](ui/ts-component-states-state.md) - - [@Prop](ui/ts-component-states-prop.md) - - [@Link](ui/ts-component-states-link.md) - - Managing Application States - - [AppStorage](ui/ts-application-states-appstorage.md) - - [PersistentStorage](ui/ts-application-states-apis-persistentstorage.md) - - [Environment](ui/ts-application-states-apis-environment.md) - - Managing Other States - - [@observed and @objectLink](ui/ts-other-states-observed-objectlink.md) - - [@Consume and @Provide](ui/ts-other-states-consume-provide.md) - - [@Watch](ui/ts-other-states-watch.md) - - About Rendering Control Syntax - - [if/else](ui/ts-rending-control-syntax-if-else.md) - - [ForEach](ui/ts-rending-control-syntax-foreach.md) - - [LazyForEach](ui/ts-rending-control-syntax-lazyforeach.md) - - About @Component - - [build Function](ui/ts-function-build.md) - - [Custom Component Initialization](ui/ts-custom-component-initialization.md) - - [Custom Component Lifecycle Callbacks](ui/ts-custom-component-lifecycle-callbacks.md) - - [Example: Component Creation and Re-Initialization](ui/ts-component-creation-re-initialization.md) - - [Syntactic Sugar](ui/ts-syntactic-sugar.md) - - Common Component Development Guidelines - - [Button](ui/ui-ts-basic-components-button.md) - - [Web](ui/ui-ts-components-web.md) - - Common Layout Development Guidelines - - [Flex Layout](ui/ui-ts-layout-flex.md) - - [Grid Layout](ui/ui-ts-layout-grid-container.md) - - [Media Query](ui/ui-ts-layout-mediaquery.md) - - Experiencing the Declarative UI - - [Creating a Declarative UI Project](ui/ui-ts-creating-project.md) - - [Getting to Know Components](ui/ui-ts-components.md) - - [Creating a Simple Page](ui/ui-ts-creating-simple-page.md) - - Defining Page Layout and Connection - - [Building a Food Data Model](ui/ui-ts-building-data-model.md) - - [Building a Food Category List Layout](ui/ui-ts-building-category-list-layout.md) - - [Building a Food Category Grid Layout](ui/ui-ts-building-category-grid-layout.md) - - [Implementing Page Redirection and Data Transmission](ui/ui-ts-page-redirection-data-transmission.md) - - Basic Functions - - Window Manager - - Window - - [Window Overview](windowmanager/window-overview.md) - - [Window Development](windowmanager/window-guidelines.md) - - Display - - [Display Overview](windowmanager/display-overview.md) - - [Display Development](windowmanager/display-guidelines.md) - - Screenshot - - [Screenshot Overview](windowmanager/screenshot-overview.md) - - [Screenshot Development](windowmanager/screenshot-guidelines.md) - - WebGL - - [WebGL Overview](webgl/webgl-overview.md) - - [WebGL Development](webgl/webgl-guidelines.md) - - Media - - Audio - - [Audio Overview](media/audio-overview.md) - - [Audio Playback Development](media/audio-playback.md) - - [Audio Rendering Development](media/audio-renderer.md) - - [Audio Recording Development](media/audio-recorder.md) - - [Audio Capture Development](media/audio-capturer) - - Video - - [Video Playback Development](media/video-playback.md) - - [Video Recording Development](media/video-recorder.md) - - Image - - [Image Development](media/image.md) - - Security - - User Authentication - - [User Authentication Overview](security/userauth-overview.md) - - [User Authentication Development](security/userauth-guidelines.md) - - hapsigner - - [hapsigner Guide](security/hapsigntool-guidelines.md) - - Connectivity - - IPC & RPC - - [IPC & RPC Overview](connectivity/ipc-rpc-overview.md) - - [IPC & RPC Development Guidelines](connectivity/ipc-rpc-development-guideline.md) - - [Subscribing to State Changes of a Remote Object](connectivity/subscribe-remote-state.md) - - Data Management - - Distributed Data Service - - [Distributed Data Service Overview](database/database-mdds-overview.md) - - [Distributed Data Service Development](database/database-mdds-guidelines.md) - - Relational Database Overview - - [RDB Overview](database/database-relational-overview.md) - - [RDB Development](database/database-relational-guidelines.md) - - Lightweight Data Store - - [Lightweight Data Store Overview](database/database-preference-overview.md) - - [Lightweight Data Store Development](database/database-preference-guidelines.md) - - Agent-Powered Scheduled Reminders - - [Overview](background-agent-scheduled-reminder/background-agent-scheduled-reminder-overview.md) - - [Development Guidelines](background-agent-scheduled-reminder/background-agent-scheduled-reminder-guide.md) - - Background Task Management - - [Background Task Management Overview](background-task-management/background-task-overview.md) - - [Background Task Management Development](background-task-management/background-task-dev-guide.md) - - Device - - USB Service - - [USB Service Overview](device/usb-overview.md) - - [USB Service Development](device/usb-guidelines.md) - - Location - - [Location Overview](device/device-location-overview.md) - - [Obtaining Device Location Information](device/device-location-info.md) - - [Geocoding and Reverse Geocoding Capabilities](device/device-location-geocoding.md) - - Sensor - - [Sensor Overview](device/sensor-overview.md) - - [Sensor Development](device/sensor-guidelines.md) - - Vibrator - - [Vibrator Overview](device/vibrator-overview.md) - - [Vibrator Development](device/vibrator-guidelines.md) - - Device Usage Statistics - - [Device Usage Statistics Overview](device-usage-statistics/device-usage-statistics-overview.md) - - [Device Usage Statistics Development](device-usage-statistics/device-usage-statistics-dev-guide.md) - - DFX - - Application Event Logging - - [Overview of Application Event Logging](dfx/hiappevent-overview.md) - - [Development Guidelines on Application Event Logging](dfx/hiappevent-guidelines.md) - - Performance Tracing - - [Overview of Performance Tracing](dfx/hitracemeter-overview.md) - - [Development of Performance Tracing](dfx/hitracemeter-guidelines.md) - - Distributed Call Chain Tracing - - [Overview of Distributed Call Chain Tracing](dfx/hitracechain-overview.md) - - [Development of Distributed Call Chain Tracing](dfx/hitracechain-guidelines.md) - - Internationalization - - [Overview](internationalization/international-overview.md) - - [Internationalization Development (intl)](internationalization/intl-guidelines.md) - - [Internationalization Development (i18n)](internationalization/i18n-guidelines.md) -- Tools - - [DevEco Studio (OpenHarmony) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md) -- Hands-On Tutorials - - [Samples](https://gitee.com/openharmony/app_samples/blob/master/README.md) -- API References - - Compent Reference (JavaScript-based Web-like Development Paradigm) - - Components - - Common - - [Universal Attributes](reference/arkui-js/js-components-common-attributes.md) - - [Universal Styles](reference/arkui-js/js-components-common-styles.md) - - [Universal Events](reference/arkui-js/js-components-common-events.md) - - [Universal Methods](reference/arkui-js/js-components-common-methods.md) - - [Animation Styles](reference/arkui-js/js-components-common-animation.md) - - [Gradient Styles](reference/arkui-js/js-components-common-gradient.md) - - [Transition Styles](reference/arkui-js/js-components-common-transition.md) - - [Custom Font Styles](reference/arkui-js/js-components-common-customizing-font.md) - - [Atomic Layout](reference/arkui-js/js-components-common-atomic-layout.md) - - Container Components - - [badge](reference/arkui-js/js-components-container-badge.md) - - [dialog](reference/arkui-js/js-components-container-dialog.md) - - [div](reference/arkui-js/js-components-container-div.md) - - [form](reference/arkui-js/js-components-container-form.md) - - [list](reference/arkui-js/js-components-container-list.md) - - [list-item](reference/arkui-js/js-components-container-list-item.md) - - [list-item-group](reference/arkui-js/js-components-container-list-item-group.md) - - [panel](reference/arkui-js/js-components-container-panel.md) - - [popup](reference/arkui-js/js-components-container-popup.md) - - [refresh](reference/arkui-js/js-components-container-refresh.md) - - [stack](reference/arkui-js/js-components-container-stack.md) - - [stepper](reference/arkui-js/js-components-container-stepper.md) - - [stepper-item](reference/arkui-js/js-components-container-stepper-item.md) - - [swiper](reference/arkui-js/js-components-container-swiper.md) - - [tabs](reference/arkui-js/js-components-container-tabs.md) - - [tab-bar](reference/arkui-js/js-components-container-tab-bar.md) - - [tab-content](reference/arkui-js/js-components-container-tab-content.md) - - Basic Components - - [button](reference/arkui-js/js-components-basic-button.md) - - [chart](reference/arkui-js/js-components-basic-chart.md) - - [divider](reference/arkui-js/js-components-basic-divider.md) - - [image](reference/arkui-js/js-components-basic-image.md) - - [image-animator](reference/arkui-js/js-components-basic-image-animator.md) - - [input](reference/arkui-js/js-components-basic-input.md) - - [label](reference/arkui-js/js-components-basic-label.md) - - [marquee](reference/arkui-js/js-components-basic-marquee.md) - - [menu](reference/arkui-js/js-components-basic-menu.md) - - [option](reference/arkui-js/js-components-basic-option.md) - - [picker](reference/arkui-js/js-components-basic-picker.md) - - [picker-view](reference/arkui-js/js-components-basic-picker-view.md) - - [piece](reference/arkui-js/js-components-basic-piece.md) - - [progress](reference/arkui-js/js-components-basic-progress.md) - - [qrcode](reference/arkui-js/js-components-basic-qrcode.md) - - [rating](reference/arkui-js/js-components-basic-rating.md) - - [richtext](reference/arkui-js/js-components-basic-richtext.md) - - [search](reference/arkui-js/js-components-basic-search.md) - - [select](reference/arkui-js/js-components-basic-select.md) - - [slider](reference/arkui-js/js-components-basic-slider.md) - - [span](reference/arkui-js/js-components-basic-span.md) - - [switch](reference/arkui-js/js-components-basic-switch.md) - - [text](reference/arkui-js/js-components-basic-text.md) - - [textarea](reference/arkui-js/js-components-basic-textarea.md) - - [toolbar](reference/arkui-js/js-components-basic-toolbar.md) - - [toolbar-item](reference/arkui-js/js-components-basic-toolbar-item.md) - - [toggle](reference/arkui-js/js-components-basic-toggle.md) - - [web](reference/arkui-js/js-components-basic-web.md) - - Media Components - - [video](reference/arkui-js/js-components-media-video.md) - - Canvas Components - - [canvas](reference/arkui-js/js-components-canvas-canvas.md) - - [CanvasRenderingContext2D](reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md) - - [Image](reference/arkui-js/js-components-canvas-image.md) - - [CanvasGradient](reference/arkui-js/js-components-canvas-canvasgradient.md) - - [ImageData](reference/arkui-js/js-components-canvas-imagedata.md) - - [Path2D](reference/arkui-js/js-components-canvas-path2d.md) - - [ImageBitmap](reference/arkui-js/js-components-canvas-imagebitmap.md) - - [OffscreenCanvas](reference/arkui-js/js-components-canvas-offscreencanvas.md) - - [OffscreenCanvasRenderingContext2D](reference/arkui-js/js-offscreencanvasrenderingcontext2d.md) - - Grid - - [Basic Concepts](reference/arkui-js/js-components-grid-basic-concepts.md) - - [grid-container](reference/arkui-js/js-components-grid-container.md) - - [grid-row](reference/arkui-js/js-components-grid-row.md) - - [grid-col](reference/arkui-js/js-components-grid-col.md) - - SVG Components - - [Universal Attributes](reference/arkui-js/js-components-svg-common-attributes.md) - - [svg](reference/arkui-js/js-components-svg.md) - - [rect](reference/arkui-js/js-components-svg-rect.md) - - [circle](reference/arkui-js/js-components-svg-circle.md) - - [ellipse](reference/arkui-js/js-components-svg-ellipse.md) - - [path](reference/arkui-js/js-components-svg-path.md) - - [line](reference/arkui-js/js-components-svg-line.md) - - [polyline](reference/arkui-js/js-components-svg-polyline.md) - - [polygon](reference/arkui-js/js-components-svg-polygon.md) - - [text](reference/arkui-js/js-components-svg-text.md) - - [tspan](reference/arkui-js/js-components-svg-tspan.md) - - [textPath](reference/arkui-js/js-components-svg-textpath.md) - - [animate](reference/arkui-js/js-components-svg-animate.md) - - [animateMotion](reference/arkui-js/js-components-svg-animatemotion.md) - - [animateTransform](reference/arkui-js/js-components-svg-animatetransform.md) - - Custom Components - - [Basic Usage](reference/arkui-js/js-components-custom-basic-usage.md) - - [Custom Events](reference/arkui-js/js-components-custom-events.md) - - [props](reference/arkui-js/js-components-custom-props.md) - - [Event Parameter](reference/arkui-js/js-components-custom-event-parameter.md) - - [slot](reference/arkui-js/js-components-custom-slot.md) - - [Lifecycle Definition](reference/arkui-js/js-components-custom-lifecycle.md) - - [Type Attributes](reference/arkui-js/js-appendix-types.md) - - Compent Reference (TypeScript-based Declarative Development Paradigm) - - Components - - Universal Components - - Universal Events - - [Click Event](reference/arkui-ts/ts-universal-events-click.md) - - [Touch](reference/arkui-ts/ts-universal-events-touch.md) - - [Show/Hide Event](reference/arkui-ts/ts-universal-events-show-hide.md) - - [Drag/Drop Event](reference/arkui-ts/ts-universal-events-drag-drop.md) - - [Key Event](reference/arkui-ts/ts-universal-events-key.md) - - [Focus Event](reference/arkui-ts/ts-universal-focus-event.md) - - [Mouse Event](reference/arkui-ts/ts-universal-mouse-key.md) - - [Component Area Change Event](reference/arkui-ts/ts-universal-component-area-change-event.md) - - Universal Attributes - - [Size](reference/arkui-ts/ts-universal-attributes-size.md) - - [Location](reference/arkui-ts/ts-universal-attributes-location.md) - - [Layout Constraints](reference/arkui-ts/ts-universal-attributes-layout-constraints.md) - - [Flex Layout](reference/arkui-ts/ts-universal-attributes-flex-layout.md) - - [Border Configuration](reference/arkui-ts/ts-universal-attributes-border.md) - - [Background](reference/arkui-ts/ts-universal-attributes-background.md) - - [Opacity](reference/arkui-ts/ts-universal-attributes-opacity.md) - - [Visibility](reference/arkui-ts/ts-universal-attributes-visibility.md) - - [Enable/Disable](reference/arkui-ts/ts-universal-attributes-enable.md) - - [Overlay](reference/arkui-ts/ts-universal-attributes-overlay.md) - - [Z-order Control](reference/arkui-ts/ts-universal-attributes-z-order.md) - - [Transformation](reference/arkui-ts/ts-universal-attributes-transformation.md) - - [Image Effect Configuration](reference/arkui-ts/ts-universal-attributes-image-effect.md) - - [Shape Clipping](reference/arkui-ts/ts-universal-attributes-sharp-clipping.md) - - [Text Style](reference/arkui-ts/ts-universal-attributes-text-style.md) - - [Grid](reference/arkui-ts/ts-universal-attributes-grid.md) - - [Gradient Color](reference/arkui-ts/ts-universal-attributes-gradient-color.md) - - [Popup Control](reference/arkui-ts/ts-universal-attributes-popup.md) - - [Menu Control](reference/arkui-ts/ts-universal-attributes-menu.md) - - [Click Control](reference/arkui-ts/ts-universal-attributes-click.md) - - [Focus Control](reference/arkui-ts/ts-universal-attributes-focus.md) - - [Hover Effect](reference/arkui-ts/ts-universal-attributes-hover-effect.md) - - [Component ID](reference/arkui-ts/ts-universal-attributes-component-id.md) - - [Touch Target](reference/arkui-ts/ts-universal-attributes-touch-target.md) - - [Polymorphic Style](reference/arkui-ts/ts-universal-attributes-polymorphic-style.md) - - Gesture Processing - - [Gesture Binding Methods](reference/arkui-ts/ts-gesture-settings.md) - - Basic Gestures - - [TapGesture](reference/arkui-ts/ts-basic-gestures-tapgesture.md) - - [LongPressGesture](reference/arkui-ts/ts-basic-gestures-longpressgesture.md) - - [PanGesture](reference/arkui-ts/ts-basic-gestures-pangesture.md) - - [PinchGesture](reference/arkui-ts/ts-basic-gestures-pinchgesture.md) - - [RotationGesture](reference/arkui-ts/ts-basic-gestures-rotationgesture.md) - - [SwipeGesture](reference/arkui-ts/ts-basic-gestures-swipegesture.md) - - [Combined Gestures](reference/arkui-ts/ts-combined-gestures.md) - - Basic Components - - [Blank](reference/arkui-ts/ts-basic-components-blank.md) - - [Button](reference/arkui-ts/ts-basic-components-button.md) - - [Checkbox](reference/arkui-ts/ts-basic-components-checkbox.md) - - [CheckboxGroup](reference/arkui-ts/ts-basic-components-checkboxgroup.md) - - [DataPanel](reference/arkui-ts/ts-basic-components-datapanel.md) - - [DatePicker](reference/arkui-ts/ts-basic-components-datepicker.md) - - [Divider](reference/arkui-ts/ts-basic-components-divider.md) - - [Gauge](reference/arkui-ts/ts-basic-components-gauge.md) - - [Image](reference/arkui-ts/ts-basic-components-image.md) - - [ImageAnimator](reference/arkui-ts/ts-basic-components-imageanimator.md) - - [LoadingProgress](reference/arkui-ts/ts-basic-components-loadingprogress.md) - - [Marquee](reference/arkui-ts/ts-basic-components-marquee.md) - - [Navigation](reference/arkui-ts/ts-basic-components-navigation.md) - - [PatternLock](reference/arkui-ts/ts-basic-components-patternlock.md) - - [PluginComponent](reference/arkui-ts/ts-basic-components-plugincomponent.md) - - [Progress](reference/arkui-ts/ts-basic-components-progress.md) - - [QRCode](reference/arkui-ts/ts-basic-components-qrcode.md) - - [Radio](reference/arkui-ts/ts-basic-components-radio.md) - - [Rating](reference/arkui-ts/ts-basic-components-rating.md) - - [RichText](reference/arkui-ts/ts-basic-components-richtext.md) - - [ScrollBar](reference/arkui-ts/ts-basic-components-scrollbar.md) - - [Search](reference/arkui-ts/ts-basic-components-search.md) - - [Select](reference/arkui-ts/ts-basic-components-select.md) - - [Slider](reference/arkui-ts/ts-basic-components-slider.md) - - [Span](reference/arkui-ts/ts-basic-components-span.md) - - [Stepper](reference/arkui-ts/ts-basic-components-stepper.md) - - [StepperItem](reference/arkui-ts/ts-basic-components-stepperitem.md) - - [Text](reference/arkui-ts/ts-basic-components-text.md) - - [TextArea](reference/arkui-ts/ts-basic-components-textarea.md) - - [TextClock](reference/arkui-ts/ts-basic-components-textclock.md) - - [TextInput](reference/arkui-ts/ts-basic-components-textinput.md) - - [TextPicker](reference/arkui-ts/ts-basic-components-textpicker.md) - - [TextTimer](reference/arkui-ts/ts-basic-components-texttimer.md) - - [TimePicker](reference/arkui-ts/ts-basic-components-timepicker.md) - - [Toggle](reference/arkui-ts/ts-basic-components-toggle.md) - - [Web](reference/arkui-ts/ts-basic-components-web.md) - - [Xcomponent](reference/arkui-ts/ts-basic-components-xcomponent.md) - - Container Components - - [AlphabetIndexer](reference/arkui-ts/ts-container-alphabet-indexer.md) - - [Badge](reference/arkui-ts/ts-container-badge.md) - - [Column](reference/arkui-ts/ts-container-column.md) - - [ColumnSplit](reference/arkui-ts/ts-container-columnsplit.md) - - [Counter](reference/arkui-ts/ts-container-counter.md) - - [Flex](reference/arkui-ts/ts-container-flex.md) - - [GridContainer](reference/arkui-ts/ts-container-gridcontainer.md) - - [Grid](reference/arkui-ts/ts-container-grid.md) - - [GridItem](reference/arkui-ts/ts-container-griditem.md) - - [List](reference/arkui-ts/ts-container-list.md) - - [ListItem](reference/arkui-ts/ts-container-listitem.md) - - [Navigator](reference/arkui-ts/ts-container-navigator.md) - - [Panel](reference/arkui-ts/ts-container-panel.md) - - [Refresh](reference/arkui-ts/ts-container-refresh.md) - - [Row](reference/arkui-ts/ts-container-row.md) - - [RowSplit](reference/arkui-ts/ts-container-rowsplit.md) - - [Scroll](reference/arkui-ts/ts-container-scroll.md) - - [SideBarContainer](reference/arkui-ts/ts-container-sidebarcontainer.md) - - [Stack](reference/arkui-ts/ts-container-stack.md) - - [Swiper](reference/arkui-ts/ts-container-swiper.md) - - [Tabs](reference/arkui-ts/ts-container-tabs.md) - - [TabContent](reference/arkui-ts/ts-container-tabcontent.md) - - Media Components - - [Video](reference/arkui-ts/ts-media-components-video.md) - - Drawing Components - - [Circle](reference/arkui-ts/ts-drawing-components-circle.md) - - [Ellipse](reference/arkui-ts/ts-drawing-components-ellipse.md) - - [Line](reference/arkui-ts/ts-drawing-components-line.md) - - [Polyline](reference/arkui-ts/ts-drawing-components-polyline.md) - - [Polygon](reference/arkui-ts/ts-drawing-components-polygon.md) - - [Path](reference/arkui-ts/ts-drawing-components-path.md) - - [Rect](reference/arkui-ts/ts-drawing-components-rect.md) - - [Shape](reference/arkui-ts/ts-drawing-components-shape.md) - - Canvas Components - - [Canvas](reference/arkui-ts/ts-components-canvas-canvas.md) - - [CanvasRenderingContext2D](reference/arkui-ts/ts-canvasrenderingcontext2d.md) - - [OffscreenCanvasRenderingConxt2D](reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md) - - [Lottie](reference/arkui-ts/ts-components-canvas-lottie.md) - - [Path2D](reference/arkui-ts/ts-components-canvas-path2d.md) - - [CanvasGradient](reference/arkui-ts/ts-components-canvas-canvasgradient.md) - - [ImageBitmap](reference/arkui-ts/ts-components-canvas-imagebitmap.md) - - [ImageData](reference/arkui-ts/ts-components-canvas-imagedata.md) - - Animation - - [Attribute Animation](reference/arkui-ts/ts-animatorproperty.md) - - [Explicit Animation](reference/arkui-ts/ts-explicit-animation.md) - - Transition Animation - - [Page Transition](reference/arkui-ts/ts-page-transition-animation.md) - - [Component Transition](reference/arkui-ts/ts-transition-animation-component.md) - - [Transition of Shared Elements](reference/arkui-ts/ts-transition-animation-shared-elements.md) - - [Motion Path Animation](reference/arkui-ts/ts-motion-path-animation.md) - - [Matrix Transformation](reference/arkui-ts/ts-matrix-transformation.md) - - [Interpolation Calculation](reference/arkui-ts/ts-interpolation-calculation.md) - - Global UI Methods - - Dialog Box - - [Alert Dialog Box](reference/arkui-ts/ts-methods-alert-dialog-box.md) - - [Action Sheet](reference/arkui-ts/ts-methods-action-sheet.md) - - [Custom Dialog Box](reference/arkui-ts/ts-methods-custom-dialog-box.md) - - [Date Picker Dialog Box](reference/arkui-ts/ts-methods-datepicker-dialog.md) - - [Text Picker Dialog Box](reference/arkui-ts/ts-methods-textpicker-dialog.md) - - [Menu](reference/arkui-ts/ts-methods-menu.md) - - [Built-in Enums](reference/arkui-ts/ts-appendix-enums.md) - - APIs - - Ability Framework - - - [@ohos.ability.dataUriUtils](reference/apis/js-apis-DataUriUtils.md) - - [@ohos.ability.errorCode ](reference/apis/js-apis-ability-errorCode.md) - - [@ohos.ability.wantConstant](reference/apis/js-apis-ability-wantConstant.md) - - [@ohos.application.Ability](reference/apis/js-apis-application-ability.md) - - [@ohos.application.AbilityConstant](reference/apis/js-apis-application-abilityConstant.md) - - [@ohos.application.abilityDelegatorRegistry](reference/apis/js-apis-abilityDelegatorRegistry.md) - - [@ohos.application.AbilityStage ](reference/apis/js-apis-application-abilitystage.md) - - [@ohos.application.appManager](reference/apis/js-apis-appmanager.md) - - [@ohos.application.Configuration](reference/apis/js-apis-configuration.md) - - [@ohos.application.ConfigurationConstant](reference/apis/js-apis-configurationconstant.md) - - [@ohos.application.DataShareExtensionAbility](reference/apis/js-apis-application-DataShareExtensionAbility.md) - - [@ohos.ability.featureAbility](reference/apis/js-apis-featureAbility.md) - - [@ohos.application.formBindingData](reference/apis/js-apis-formbindingdata.md) - - [@ohos.application.FormExtension](reference/apis/js-apis-formextension.md) - - [@ohos.application.formError](reference/apis/js-apis-formerror.md) - - [@ohos.application.formHost](reference/apis/js-apis-formhost.md) - - [@ohos.application.formInfo](reference/apis/js-apis-formInfo.md) - - [@ohos.application.missionManager](reference/apis/js-apis-missionManager.md) - - [@ohos.application.formProvider](reference/apis/js-apis-formprovider.md) - - [@ohos.ability.particleAbility](reference/apis/js-apis-particleAbility.md) - - [@ohos.application.ServiceExtensionAbility](reference/apis/js-apis-service-extension-ability.md) - - [@ohos.application.StartOptions](reference/apis/js-apis-application-StartOptions.md) - - [@ohos.application.StaticSubscriberExtensionAbility](reference/apis/js-apis-application-staticSubscriberExtensionAbility.md) - - [@ohos.application.uriPermissionManager](reference/apis/js-apis-uripermissionmanager.md) - - [@ohos.application.Want](reference/apis/js-apis-application-Want.md) - - [@ohos.wantAgent](reference/apis/js-apis-wantAgent.md) - - [dataAbilityHelper](reference/apis/js-apis-dataAbilityHelper.md) - - [context](reference/apis/js-apis-Context.md) - - [AbilityContext](reference/apis/js-apis-ability-context.md) - - [abilityDelegator](reference/apis/js-apis-application-abilityDelegator.md) - - [abilityDelegatorArgs](reference/apis/js-apis-application-abilityDelegatorArgs.md) - - [abilityMonitor](reference/apis/js-apis-application-abilityMonitor.md) - - [AbilityRunningInfo](reference/apis/js-apis-abilityrunninginfo.md) - - [AbilityStageContext](reference/apis/js-apis-abilitystagecontext.md) - - [Context](reference/apis/js-apis-application-context.md) - - [ExtensionContext](reference/apis/js-apis-extension-context.md) - - [ExtensionRunningInfo](reference/apis/js-apis-extensionrunninginfo.md) - - [FormExtensionContext](reference/apis/js-apis-formextensioncontext.md) - - [MissionSnapshot](reference/apis/js-apis-application-MissionSnapshot.md) - - [PermissionRequestResult](reference/apis/js-apis-permissionrequestresult.md) - - [ProcessRunningInfo](reference/apis/js-apis-processrunninginfo.md) - - [ServiceExtensionContext](reference/apis/js-apis-service-extension-context.md) - - [shellCmdResult](reference/apis/js-apis-application-shellCmdResult.md) - - - Common Event and Notification - - - [@ohos.commonEvent](reference/apis/js-apis-commonEvent.md) - - [@ohos.events.emitter](reference/apis/js-apis-emitter.md) - - [@ohos.notification](reference/apis/js-apis-notification.md) - - [@ohos.reminderAgent](reference/apis/js-apis-reminderAgent.md) - - [EventHub](reference/apis/js-apis-eventhub.md) - - - Bundle Management - - - [@ohos.bundle](reference/apis/js-apis-Bundle.md) - - [@ohos.bundleState ](reference/apis/js-apis-deviceUsageStatistics.md) - - [@ohos.zlib](reference/apis/js-apis-zlib.md) - - - UI Page - - - [@ohos.animator](reference/apis/js-apis-animator.md) - - [@ohos.mediaquery](reference/apis/js-apis-mediaquery.md) - - [@ohos.prompt](reference/apis/js-apis-prompt.md) - - [@ohos.router](reference/apis/js-apis-router.md) - - - Graphics - - - [@ohos.display ](reference/apis/js-apis-display.md) - - [@ohos.screenshot](reference/apis/js-apis-screenshot.md) - - [@ohos.window](reference/apis/js-apis-window.md) - - [webgl](reference/apis/js-apis-webgl.md) - - [webgl2](reference/apis/js-apis-webgl2.md) - - - Media - - - [@ohos.multimedia.audio](reference/apis/js-apis-audio.md) - - [@ohos.multimedia.camera](reference/apis/js-apis-camera.md) - - [@ohos.multimedia.image](reference/apis/js-apis-image.md) - - [@ohos.multimedia.media](reference/apis/js-apis-media.md) - - [@ohos.multimedia.medialibrary](reference/apis/js-apis-medialibrary.md) - - - Resource Management - - [@ohos.i18n](reference/apis/js-apis-i18n.md) - - [@ohos.intl](reference/apis/js-apis-intl.md) - - [@ohos.resourceManager](reference/apis/js-apis-resource-manager.md) - - - Resource Scheduling - - - [@ohos.backgroundTaskManager](reference/apis/js-apis-backgroundTaskManager.md) - - [@ohos.workScheduler ](reference/apis/js-apis-workScheduler.md) - - [@ohos.WorkSchedulerExtensionAbility](reference/apis/js-apis-WorkSchedulerExtensionAbility.md) - - - Custom Management - - - [@ohos.configPolicy](reference/apis/js-apis-config-policy.md) - - [@ohos.enterpriseDeviceManager](reference/apis/js-apis-enterprise-device-manager.md) - - - Security - - - [@ohos.abilityAccessCtrl](reference/apis/js-apis-abilityAccessCtrl.md) - - [@ohos.security.huks ](reference/apis/js-apis-huks.md) - - [@ohos.userIAM.userAuth ](reference/apis/js-apis-useriam-userauth.md) - - [@system.cipher](reference/apis/js-apis-system-cipher.md) - - - Data Management - - - [@ohos.data.dataAbility ](reference/apis/js-apis-data-ability.md) - - [@ohos.data.distributedData](reference/apis/js-apis-distributed-data.md) - - [@ohos.data.distributedDataObject](reference/apis/js-apis-data-distributedobject.md) - - [@ohos.data.preferences](reference/apis/js-apis-data-preferences.md) - - [@ohos.data.rdb](reference/apis/js-apis-data-rdb.md) - - [@ohos.settings](reference/apis/js-apis-settings.md) - - [resultSet](reference/apis/js-apis-data-resultset.md) - - - File Management - - - [@ohos.environment](reference/apis/js-apis-environment.md) - - [@ohos.fileio](reference/apis/js-apis-fileio.md) - - [@ohos.fileManager](reference/apis/js-apis-filemanager.md) - - [@ohos.statfs](reference/apis/js-apis-statfs.md) - - [@ohos.storageStatistics](reference/apis/js-apis-storage-statistics.md) - - [@ohos.volumeManager](reference/apis/js-apis-volumemanager.md) - - - Telephony Service - - - [@ohos.contact](reference/apis/js-apis-contact.md) - - [@ohos.telephony.call](reference/apis/js-apis-call.md) - - [@ohos.telephony.observer](reference/apis/js-apis-observer.md) - - [@ohos.telephony.radio](reference/apis/js-apis-radio.md) - - [@ohos.telephony.sim](reference/apis/js-apis-sim.md) - - [@ohos.telephony.sms](reference/apis/js-apis-sms.md) - - [@ohos.telephony.data](reference/apis/js-apis-telephony-data.md) - - - Network Management - - [@ohos.net.connection](reference/apis/js-apis-net-connection.md) - - [@ohos.net.http](reference/apis/js-apis-http.md) - - [@ohos.request](reference/apis/js-apis-request.md) - - [@ohos.net.socket](reference/apis/js-apis-socket.md) - - [@ohos.net.webSocket](reference/apis/js-apis-webSocket.md) - - - Connectivity - - - [@ohos.bluetooth](reference/apis/js-apis-bluetooth.md) - - [@ohos.connectedTag](reference/apis/js-apis-connectedTag.md) - - [@ohos.rpc](reference/apis/js-apis-rpc.md) - - [@ohos.wifi](reference/apis/js-apis-wifi.md) - - [@ohos.wifiext](reference/apis/js-apis-wifiext.md) - - - Basic Features - - - [@ohos.accessibility](reference/apis/js-apis-accessibility.md) - - [@ohos.faultLogger](reference/apis/js-apis-faultLogger.md) - - [@ohos.hiAppEvent](reference/apis/js-apis-hiappevent.md) - - [@ohos.hichecker](reference/apis/js-apis-hichecker.md) - - [@ohos.hidebug](reference/apis/js-apis-hidebug.md) - - [@ohos.hilog](reference/apis/js-apis-hilog.md) - - [@ohos.hiTraceChain](reference/apis/js-apis-hitracechain.md) - - [@ohos.hiTraceMeter](reference/apis/js-apis-hitracemeter.md) - - [@ohos.inputMethod](reference/apis/js-apis-inputmethod.md) - - [@ohos.inputMethodEngine](reference/apis/js-apis-inputmethodengine.md) - - [@ohos.pasteboard](reference/apis/js-apis-pasteboard.md) - - [@ohos.screenLock](reference/apis/js-apis-screen-lock.md) - - [@ohos.systemTime](reference/apis/js-apis-system-time.md) - - [@ohos.wallpaper](reference/apis/js-apis-wallpaper.md) - - [Timer](reference/apis/js-apis-timer.md) - - - Device Management - - - [@ohos.batteryInfo ](reference/apis/js-apis-battery-info.md) - - [@ohos.brightness](reference/apis/js-apis-brightness.md) - - [@ohos.deviceInfo](reference/apis/js-apis-device-info.md) - - [@ohos.distributedHardware.deviceManager](reference/apis/js-apis-device-manager.md) - - [@ohos.geolocation](reference/apis/js-apis-geolocation.md) - - [@ohos.multimodalInput.inputConsumer](reference/apis/js-apis-inputconsumer.md) - - [@ohos.multimodalInput.inputDevice](reference/apis/js-apis-inputdevice.md) - - [@ohos.multimodalInput.inputEventClient](reference/apis/js-apis-inputeventclient.md) - - [@ohos.multimodalInput.inputMonitor](reference/apis/js-apis-inputmonitor.md) - - [@ohos.power](reference/apis/js-apis-power.md) - - [@ohos.runningLock](reference/apis/js-apis-runninglock.md) - - [@ohos.sensor](reference/apis/js-apis-sensor.md) - - [@ohos.systemParameter](reference/apis/js-apis-system-parameter.md) - - [@ohos.thermal](reference/apis/js-apis-thermal.md) - - [@ohos.update](reference/apis/js-apis-update.md) - - [@ohos.usb](reference/apis/js-apis-usb.md) - - [@ohos.vibrator](reference/apis/js-apis-vibrator.md) - - - Account Management - - - [@ohos.account.appAccount](reference/apis/js-apis-appAccount.md) - - [@ohos.account.distributedAccount](reference/apis/js-apis-distributed-account.md) - - [@ohos.account.osAccount](reference/apis/js-apis-osAccount.md) - - - Language Base Class Library - - - [@ohos.convertxml](reference/apis/js-apis-convertxml.md) - - [@ohos.process](reference/apis/js-apis-process.md) - - [@ohos.uri](reference/apis/js-apis-uri.md) - - [@ohos.url](reference/apis/js-apis-url.md) - - [@ohos.util](reference/apis/js-apis-util.md) - - [@ohos.util.ArrayList](reference/apis/js-apis-arraylist.md) - - [@ohos.util.Deque](reference/apis/js-apis-deque.md) - - [@ohos.util.HashMap](reference/apis/js-apis-hashmap.md) - - [@ohos.util.HashSet](reference/apis/js-apis-hashset.md) - - [@ohos.util.LightWeightMap](reference/apis/js-apis-lightweightmap.md) - - [@ohos.util.LightWeightSet](reference/apis/js-apis-lightweightset.md) - - [@ohos.util.LinkedList](reference/apis/js-apis-linkedlist.md) - - [@ohos.util.List](reference/apis/js-apis-list.md) - - [@ohos.util.PlainArray](reference/apis/js-apis-plainarray.md) - - [@ohos.util.Queue](reference/apis/js-apis-queue.md) - - [@ohos.util.Stack](reference/apis/js-apis-stack.md) - - [@ohos.util.TreeMap](reference/apis/js-apis-treemap.md) - - [@ohos.util.TreeSet](reference/apis/js-apis-treeset.md) - - [@ohos.util.Vector](reference/apis/js-apis-vector.md) - - [@ohos.worker](reference/apis/js-apis-worker.md) - - [@ohos.xml](reference/apis/js-apis-xml.md) - - - Test - - [@ohos.application.testRunner](reference/apis/js-apis-testRunner.md) - - [@ohos.uitest](reference/apis/js-apis-uitest.md) - - - APIs No Longer Maintained - - - [@ohos.bytrace](reference/apis/js-apis-bytrace.md) - - [@ohos.data.storage](reference/apis/js-apis-data-storage.md) - - [@system.app](reference/apis/js-apis-system-app.md) - - [@system.battery](reference/apis/js-apis-system-battery.md) - - [@system.brightness](reference/apis/js-apis-system-brightness.md) - - [@system.configuration](reference/apis/js-apis-system-configuration.md) - - [@system.device](reference/apis/js-apis-system-device.md) - - [@system.fetch](reference/apis/js-apis-system-fetch.md) - - [@system.file](reference/apis/js-apis-system-file.md) - - [@system.geolocation](reference/apis/js-apis-system-location.md) - - [@system.mediaquery](reference/apis/js-apis-system-mediaquery.md) - - [@system.network](reference/apis/js-apis-system-network.md) - - [@system.package](reference/apis/js-apis-system-package.md) - - [@system.prompt](reference/apis/js-apis-system-prompt.md) - - [@system.request](reference/apis/js-apis-system-request.md) - - [@system.router](reference/apis/js-apis-system-router.md) - - [@system.sensor](reference/apis/js-apis-system-sensor.md) - - [@system.storage](reference/apis/js-apis-system-storage.md) - - [@system.vibrator](reference/apis/js-apis-system-vibrate.md) - - [console](reference/apis/js-apis-logs.md) \ No newline at end of file diff --git a/en/application-dev/connectivity/Readme-EN.md b/en/application-dev/connectivity/Readme-EN.md index bb544165e5f8ac20efbdea22fcfc453d929f614b..f6187b328a6cfee0272e63fd8f98add01bd05bc7 100755 --- a/en/application-dev/connectivity/Readme-EN.md +++ b/en/application-dev/connectivity/Readme-EN.md @@ -1,9 +1,11 @@ -# Connectivity - -- [IPC & RPC] - - [IPC & RPC Overview](ipc-rpc-overview.md) - - - [IPC & RPC Development](ipc-rpc-development-guideline.md) - - - [Subscribing to State Changes of a Remote Object](subscribe-remote-state.md) +# Network and Connectivity +- Network Management + - [Network Management Overview](net-mgmt-overview.md) + - [HTTP Data Request](http-request.md) + - [WebSocket Connection](websocket-connection.md) + - [Socket Connection](socket-connection.md) +- IPC & RPC + - [IPC & RPC Overview](ipc-rpc-overview.md) + - [IPC & RPC Development Guidelines](ipc-rpc-development-guideline.md) + - [Subscribing to State Changes of a Remote Object](subscribe-remote-state.md) diff --git a/en/application-dev/connectivity/http-request.md b/en/application-dev/connectivity/http-request.md new file mode 100644 index 0000000000000000000000000000000000000000..ee4610f46c3c1f25a2509e54bbfb0e9ddb473853 --- /dev/null +++ b/en/application-dev/connectivity/http-request.md @@ -0,0 +1,73 @@ +# HTTP Data Request + +## Use Cases + +An application can initiate a data request over HTTP. Common HTTP methods include **GET**, **POST**, **OPTIONS**, **HEAD**, **PUT**, **DELETE**, **TRACE**, and **CONNECT**. + +## Available APIs + +The HTTP request function is mainly implemented by the HTTP module. + +To use related APIs, you must declare the **ohos.permission.INTERNET** permission. + +The following table describes the related APIs. + +| API | Description | +| ----------------------------------------- | ----------------------------------- | +| createHttp() | Creates an HTTP request. | +| request() | Initiates an HTTP request to a given URL. | +| 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.| + +## How to Develop + +1. Import the required HTTP module. +2. Create an **HttpRequest** object. +3. (Optional) Listen for HTTP Response Header events. +4. Initiates an HTTP request to a given URL. +5. (Optional) Process the HTTP Response Header event and the return result of the HTTP request. + +```js +import http from '@ohos.net.http'; + +// Each HttpRequest corresponds to an HttpRequestTask object 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+ +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. + "EXAMPLE_URL", + { + method: http.RequestMethod.POST, // Optional. The default value is http.RequestMethod.GET. + // You can add the header field based on service requirements. + header: { + 'Content-Type': 'application/json' + }, + // This field is used to transfer data when the POST request is used. + extraData: { + "data": "data to send", + }, + connectTimeout: 60000, // Optional. The default value is 60000, in ms. + readTimeout: 60000, // Optional. The default value is 60000, in ms. + }, (err, data) => { + if (!err) { + // data.result contains the HTTP response. 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. + console.info('header:' + JSON.stringify(data.header)); + console.info('cookies:' + data.cookies); // 8+ + } else { + console.info('error:' + JSON.stringify(err)); + // Call the destroy() method to release resources after the call is complete. + httpRequest.destroy(); + } + } +); +``` diff --git a/en/application-dev/connectivity/net-mgmt-overview.md b/en/application-dev/connectivity/net-mgmt-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..3c8eeb552b811344396afcc6e5316e5daa24ee8b --- /dev/null +++ b/en/application-dev/connectivity/net-mgmt-overview.md @@ -0,0 +1,17 @@ +# Network Management Overview + +Network management functions include: + +- [HTTP Data Request](http-request.md): Initiates a data request through HTTP. +- [WebSocket Connection](websocket-connection.md): Establishes a bidirectional connection between the server and client through WebSocket. +- [Socket Connection](socket-connection.md): Transmits data through Socket. + +## Constraints + +To use the functions of the network management module, you must obtain the permissions listed in the following table. + +| Permission | Description | +| -------------------------------- | -------------------------------------- | +| ohos.permission.GET_NETWORK_INFO | Allows an application to obtain the network connection information. | +| ohos.permission.SET_NETWORK_INFO | Allows an application to modify the network connection state. | +| ohos.permission.INTERNET | Allows an application to open network sockets to connect to the network.| diff --git a/en/application-dev/connectivity/socket-connection.md b/en/application-dev/connectivity/socket-connection.md new file mode 100644 index 0000000000000000000000000000000000000000..98b82c8064e58de21d742efc79b51ff3ef46a331 --- /dev/null +++ b/en/application-dev/connectivity/socket-connection.md @@ -0,0 +1,124 @@ +# Socket Connection + + +## Use Cases + +Your application can transmit data through Socket connections. Currently, the TCP and UDP protocols are supported. + + +## Available APIs + +The Socket connection function is mainly implemented by the Socket module. The following table describes the related APIs. + +| API| Description| +| -------- | -------- | +| constructUDPSocketInstance() | Creates a **UDPSocket** object.| +| constructTCPSocketInstance() | Creates a **TCPSocket** object.| +| bind() | Binds the IP address and port number.| +| send() | Sends data.| +| close() | Closes a Socket connection.| +| getState() | Obtains the Socket connection status.| +| connect() | Connects to the specified IP address and port. This function is supported only for TCP.| +| getRemoteAddress() | Obtains the peer address of the Socket connection. This function is supported only for TCP. The **connect** API must have been called before you use this API.| +| on(type: 'message') | Enables listening for **message** events of the Socket connection.| +| off(type: 'message') | Disables listening for **message** events of the Socket connection.| +| on(type: 'close') | Enables listening for **close** events of the Socket connection.| +| off(type: 'close') | Disables listening for **close** events of the Socket connection.| +| on(type: 'error') | Enables listening for **error** events of the Socket connection.| +| off(type: 'error') | Disables listening for **error** events of the Socket connection.| +| on(type: 'listening') | Enables listening for **listening** events of the UDPSocket connection. | +| off(type: 'listening') | Disables listening for **listening** events of the UDPSocket connection. | +| on(type: 'connect') | Enables listening for **connect** events of the TCPSocket connection. | +| off(type: 'connect') | Disables listening for **connect** events of the TCPSocket connection.| + + +## How to Develop + +The implementation is similar for UDPSocket and TCPSocket. The following uses the TCPSocket as an example. + +1. Import the required Socket module. + +2. Create a **TCPSocket** object. + +3. (Optional) Enable listening for TCPSocket events. + +4. Bind the IP address and port number. The port number can be specified or randomly allocated by the system. + +5. Set up a connection to the specified IP address and port number. + +6. Send data. + +7. Enable the TCPSocket connection to be automatically closed after use. + + ```js + import socket from '@ohos.net.socket' + + // Create a TCPSocket object. + let tcp = socket.constructTCPSocketInstance(); + + // Enable listening for TCPSocket events. + tcp.on('message', value => { + console.log("on message") + let buffer = value.message + let dataView = new DataView(buffer) + let str = "" + for (let i = 0;i < dataView.byteLength; ++i) { + str += String.fromCharCode(dataView.getUint8(i)) + } + console.log("on connect recevied:" + str) + }); + tcp.on('connect', () => { + console.log("on connect") + }); + tcp.on('close', () => { + console.log("on close") + }); + + // Bind the IP address and port number. + let bindAddress = { + address: '192.168.xx.xx', + port: 1234, // Bound port, for example, 1234. + family: 1 + }; + tcp.bind(bindAddress, err => { + if (err) { + console.log('bind fail'); + return; + } + console.log('bind success'); + // Set up a connection to the specified IP address and port number. + let connectAddress = { + address: '192.168.xx.xx', + port: 5678, // Connection port, for example, 5678. + family: 1 + }; + tcp.connect({ + address: connectAddress, timeout: 6000 + }, err => { + if (err) { + console.log('connect fail'); + return; + } + console.log('connect success'); + // Send data. + tcp.send({ + data: 'Hello, server!' + }, err => { + if (err) { + console.log('send fail'); + return; + } + console.log('send success'); + }) + }); + }); + // Enable the TCPSocket connection to be automatically closed after use. Then, disable listening for TCPSocket events. + setTimeout(() => { + tcp.close((err) => { + console.log('close socket.') + }); + tcp.off('message'); + tcp.off('connect'); + tcp.off('close'); + }, 30 * 1000); + ``` diff --git a/en/application-dev/connectivity/websocket-connection.md b/en/application-dev/connectivity/websocket-connection.md new file mode 100644 index 0000000000000000000000000000000000000000..42501508c4c89a6a3a2c35b1d585e73946c3a629 --- /dev/null +++ b/en/application-dev/connectivity/websocket-connection.md @@ -0,0 +1,85 @@ +# WebSocket Connection + + +## Use Cases + +You can use WebSocket to establish a bidirectional connection between a server and a client. Before doing this, you need to use the **createWebSocket** API to create a **WebSocket** object and then use the **connect** API to connect to the server. If the connection is successful, the client will receive a callback of the **open** event. Then, the client can communicate with the server using the **send** API. When the server sends a message to the client, the client will receive a callback of the **message** event. If the client no longer needs this connection, it can call the **close** API to disconnect from the server. Then, the client will receive a callback of the **close** event. + +If an error occurs in any of the preceding processes, the client will receive a callback of the **error** event. + + +## Available APIs + +The WebSocket connection function is mainly implemented by the WebSocket module. To use related APIs, you must declare the **ohos.permission.INTERNET** permission. The following table describes the related APIs. + +| API| Description| +| -------- | -------- | +| createWebSocket() | Creates a WebSocket connection.| +| connect() | Establishes a WebSocket connection to a given URL.| +| send() | Sends data through the WebSocket connection.| +| close() | Closes a WebSocket connection.| +| on(type: 'open') | Enables listening for **open** events of a WebSocket connection.| +| off(type: 'open') | Disables listening for **open** events of a WebSocket connection.| +| on(type: 'message') | Enables listening for **message** events of a WebSocket connection.| +| off(type: 'message') | Disables listening for **message** events of a WebSocket connection.| +| on(type: 'close') | Enables listening for **close** events of a WebSocket connection.| +| off(type: 'close') | Disables listening for **close** events of a WebSocket connection.| +| on(type: 'error') | Enables listening for **error** events of a WebSocket connection.| +| off(type: 'error') | Disables listening for **error** events of a WebSocket connection.| + + +## How to Develop + +1. Import the required WebSocket module. + +2. Create a **WebSocket** object. + +3. (Optional) Subscribe to WebSocket open, message, close, and error events. + +4. Establish a WebSocket connection to a given URL. + +5. Close the WebSocket connection if it is no longer needed. + + ```js + import webSocket from '@ohos.net.webSocket'; + + var defaultIpAddress = "ws://"; + let ws = webSocket.createWebSocket(); + ws.on('open', (err, value) => { + console.log("on open, status:" + JSON.stringify(value)); + // When receiving the on('open') event, the client can use the send() API to communicate with the server. + ws.send("Hello, server!", (err, value) => { + if (!err) { + console.log("send success"); + } else { + console.log("send fail, err:" + JSON.stringify(err)); + } + }); + }); + ws.on('message', (err, value) => { + console.log("on message, message:" + value); + // When receiving the `bye` message (the actual message name may differ) from the server, the client proactively disconnects from the server. + if (value === 'bye') { + ws.close((err, value) => { + if (!err) { + console.log("close success"); + } else { + console.log("close fail, err is " + JSON.stringify(err)); + } + }); + } + }); + ws.on('close', (err, value) => { + console.log("on close, code is " + value.code + ", reason is " + value.reason); + }); + ws.on('error', (err) => { + console.log("on error, error:" + JSON.stringify(err)); + }); + ws.connect(defaultIpAddress, (err, value) => { + if (!err) { + console.log("connect success"); + } else { + console.log("connect fail, err:" + JSON.stringify(err)); + } + }); + ``` diff --git a/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md b/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md index fd665b439cacbcffefc6ae5e4e2e2ee89ac80249..06edad460749ab7ef5cb00bb820489a8368c01f8 100644 --- a/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md +++ b/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md @@ -1,4 +1,4 @@ -## Device Usage Statistics Development +# Device Usage Statistics Development ## When to Use @@ -21,6 +21,7 @@ import stats from '@ohos.bundleState'; | function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback<Array<BundleStateInfo>>): void | Queries the application usage duration statistics in the specified time frame at the specified interval (daily, weekly, monthly, or annually).| | function queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void | Queries the priority group of the current invoker application.| | function isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void | Checks whether the application specified by **bundleName** is in the idle state. | +| function getRecentlyUsedModules(maxNum: number, callback: AsyncCallback<BundleActiveModuleInfo>): void | Obtains the number of FA usage records specified by **maxNum**.| ## How to Develop @@ -205,3 +206,57 @@ import stats from '@ohos.bundleState'; } }); ``` + +8. Obtain the number of FA usage records specified by **maxNum**. If **maxNum** is not specified, the default value **1000** is used. This requires the **ohos.permission.BUNDLE_ACTIVE_INFO** permission to be configured in the **config.json** file. + + ```js + import stats from '@ohos.bundleState' + + // Use a promise to return the result. + stats.getRecentlyUsedModules(1000).then( res => { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise succeeded'); + for (let i = 0; i < res.length; i++) { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise number : ' + (i + 1)); + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise result ' + JSON.stringify(res[i])); + } + }).catch( err=> { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise failed, because: ' + err.code); + }); + + // Use a promise to return the result when maxNum is not specified. + stats.getRecentlyUsedModules().then( res => { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise succeeded'); + for (let i = 0; i < res.length; i++) { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise number : ' + (i + 1)); + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise result ' + JSON.stringify(res[i])); + } + }).catch( err=> { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise failed, because: ' + err.code); + }); + + // Use an asynchronous callback to return the result. + stats.getRecentlyUsedModules(1000,(err, res) => { + if(err) { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code); + } else { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback succeeded.'); + for (let i = 0; i < res.length; i++) { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback number : ' + (i + 1)); + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback result ' + JSON.stringify(res[i])); + } + } + }); + + // Use an asynchronous callback to return the result when maxNum is not specified. + stats.getRecentlyUsedModules((err, res) => { + if(err) { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code); + } else { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback succeeded.'); + for (let i = 0; i < res.length; i++) { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback number : ' + (i + 1)); + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback result ' + JSON.stringify(res[i])); + } + } + }); + ``` diff --git a/en/application-dev/device-usage-statistics/device-usage-statistics-overview.md b/en/application-dev/device-usage-statistics/device-usage-statistics-overview.md index b34bd46548c94779dfa35ba21f1d7a5ea9ad01c3..696a32c18ca974da852fa8600d126ca692d81f7d 100644 --- a/en/application-dev/device-usage-statistics/device-usage-statistics-overview.md +++ b/en/application-dev/device-usage-statistics/device-usage-statistics-overview.md @@ -7,17 +7,26 @@ With device usage statistics APIs, you can have a better understanding of the ap Currently you can have access to statistics on the application usage, and notification and system usage statistics feature will be available for use in later versions. - **The application usage statistics is updated**: ->1. Every 30 minutes ->2. Upon system time change ->3. Upon start of a new day +1. Every 30 minutes +2. Upon system time change +3. Upon start of a new day - **The application usage statistics can include the following**: ->1. Events of all applications based on the specified start time and end time ->2. Application usage duration statistics based on the specified start time and end time ->3. Events of the current application based on the specified start time and end time ->4. Application usage duration statistics in the specified time frame at the specified interval (daily, weekly, monthly, or annually) ->5. Priority group of the current invoker application ->6. Whether a specific application is in the idle state +1. Events of all applications based on the specified start time and end time + +2. Application usage duration statistics based on the specified start time and end time + +3. Events of the current application based on the specified start time and end time + +4. Application usage duration statistics in the specified time frame at the specified interval (daily, weekly, monthly, or annually) + +5. Priority group of the current invoker application + +6. Whether a specific application is in the idle state + +7. The number of FA usage records specified by **maxNum**, sorted by time (most recent first) + + If **maxNum** is not specified, the default value **1000** will be used. ### Required Permissions - The **queryBundleActiveStates**, **queryBundleStateInfos**, and **queryBundleStateInfoByInterval** APIs used for device usage statistics are system APIs. Before calling these APIs, you need to apply for the **ohos.permission.BUNDLE_ACTIVE_INFO** permission. diff --git a/en/application-dev/device/sensor-guidelines.md b/en/application-dev/device/sensor-guidelines.md index 734d75b2573d18ef261ea4f430ab907002fe1e3c..ca434c9639e064dda463873dee8fdf701271181b 100644 --- a/en/application-dev/device/sensor-guidelines.md +++ b/en/application-dev/device/sensor-guidelines.md @@ -13,9 +13,9 @@ - Data provided by the Hall effect sensor implements the smart cover mode of your device. -- Data provided by the heart rate sensor helps your application track the health of a user. +- Data provided by the heart rate sensor helps your application track the heart health of a user. -- Data provided by the pedometer sensor helps your application obtain the number steps a user has walked. +- Data provided by the pedometer sensor helps your application obtain the number of steps a user has walked. - Data provided by the wear detection sensor helps your application detect whether a user is wearing a wearable device. @@ -31,7 +31,7 @@ ## How to Develop -1. To obtain data from a type of sensor, configure the request permissions in the **config.json** file. +1. To obtain data from a type of sensor, configure the requested permissions in the **config.json** file. ``` "reqPermissions":[ @@ -75,7 +75,7 @@ ``` import sensor from "@ohos.sensor" sensor.on(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data){ - console.info("Subscription succeeded. data = "+ data);// The call is successful, and the obtained sensor data is printed. + console.info("Subscription succeeded. data = "+ data); // The call is successful, and the obtained sensor data is printed. } ); ``` @@ -89,7 +89,7 @@ ``` import sensor from "@ohos.sensor" sensor.off(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function() { - console.info("Succeeded in unsubscribing from acceleration sensor data.");// The unsubscription is successful, and the result is printed. + console.info("Succeeded in unsubscribing from acceleration sensor data."); // The unsubscription is successful, and the result is printed. } ); ``` @@ -103,7 +103,7 @@ ``` import sensor from "@ohos.sensor" sensor.once(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data) { - console.info("Data obtained successfully. data=" + data);// The call is successful, and the obtained sensor data is printed. + console.info("Data obtained successfully. data=" + data); // The call is successful, and the obtained sensor data is printed. } ); ``` @@ -117,9 +117,14 @@ ``` try { sensor.once(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data) { - console.info("Data obtained successfully. data=" + data);// The call is successful, and the obtained sensor data is printed. + console.info("Data obtained successfully. data=" + data); // The call is successful, and the obtained sensor data is printed. }); } catch (error) { console.error(error); } ``` +## Samples + +The following sample is provided to help you better understand how to develop sensors: + +- [`Sensor`: sensor (eTS, API 8)](https://gitee.com/openharmony/app_samples/tree/master/device/Sensor) diff --git a/en/application-dev/device/sensor-overview.md b/en/application-dev/device/sensor-overview.md index c45dd69eea4372c41a1d5f1dbf93de14e4b40ea5..9951378ea182f7e7bf5635cd7a7bf963a03a6205 100644 --- a/en/application-dev/device/sensor-overview.md +++ b/en/application-dev/device/sensor-overview.md @@ -1,12 +1,12 @@ # Sensor Overview -Sensors in OpenHarmony are an abstraction of underlying hardware-based sensors. Your application can access the underlying sensors via the sensors. Using the APIs provided by sensors, you can query sensors on your device, subscribe to sensor data, customize algorithms based on sensor data, and develop various sensor-based applications, such as compass, fitness and health, and games applications. +Sensors in OpenHarmony are an abstraction of underlying sensor hardware. Your application can access the underlying sensor hardware via the sensors. Using the APIs provided by sensors, you can query sensors on your device, subscribe to sensor data, customize algorithms based on sensor data, and develop various sensor-based applications, such as compass, motion-controlled games, and fitness and health applications. A sensor is a device to detect events or changes in an environment and send messages about the events or changes to another device (for example, a CPU). Generally, a sensor is composed of sensitive components and conversion components. Sensors are the cornerstone of the IoT. A unified sensor management framework is required to achieve data sensing at a low latency and low power consumption, thereby keeping up with requirements of "1+8+N" products or business in the Seamless AI Life Strategy. The sensor list is as follows: -| Sensor Type | Sensor Name | Description | Usage | +| Type | Name | Description | Usage | | --------------------------------------- | ------------------ | ------------------------------------------------------------ | ---------------------------------------- | | SENSOR_TYPE_ACCELEROMETER | Acceleration sensor | Measures the acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s2.| Detecting the motion status | | SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED | Uncalibrated acceleration sensor| Measures the uncalibrated acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s2.| Measuring the acceleration bias estimation | @@ -56,7 +56,7 @@ The following modules work cooperatively to implement OpenHarmony sensors: Senso | Sensor | Permission | Sensitivity | Permission Description | | ------------------------- | -------------------------------- | ------------ | ----------------------- | - | Acceleration sensor, uncalibrated acceleration sensor, and linear acceleration sensor| ohos.permission.ACCELEROMETER | system_grant | Allows your application to subscribe to data of these acceleration-related sensors in the motion category.| + | Acceleration sensor, uncalibrated acceleration sensor, and linear acceleration sensor| ohos.permission.ACCELEROMETER | system_grant | Allows an application to subscribe to data of these acceleration-related sensors in the motion category.| | Gyroscope sensor and uncalibrated gyroscope sensor | ohos.permission.GYROSCOPE | system_grant | Allows an application to subscribe to data of the gyroscope-related sensors in the motion category.| | Pedometer sensor | ohos.permission.ACTIVITY_MOTION | user_grant | Allows an application to subscribe to the motion status. | | Heart rate sensor | ohos.permission.READ_HEALTH_DATA | user_grant | Allows an application to read health data. | diff --git a/en/application-dev/device/vibrator-guidelines.md b/en/application-dev/device/vibrator-guidelines.md index 982d6c9b0983684729ea41b1d3b45ab9409a43e5..b1d7f7c42bf05cbf616742d63351dd5bc542b50a 100644 --- a/en/application-dev/device/vibrator-guidelines.md +++ b/en/application-dev/device/vibrator-guidelines.md @@ -3,7 +3,7 @@ ## When to Use -You can set different vibration effects as needed, for example, customizing vibration effects with different intensities and durations for buttons on the device, and customizing one-shot or periodic vibration effects with different intensities and durations for alarm clocks and incoming calls. +You can set different vibration effects as needed, for example, customizing the vibration intensity, frequency, and duration for button touches, alarm clocks, and incoming calls. ## Available APIs @@ -62,9 +62,9 @@ You can set different vibration effects as needed, for example, customizing vibr ``` import vibrator from "@ohos.vibrator" vibrator.vibrate(1000).then((error)=>{ - if (error) {// The call fails, and error.code and error.message are printed. + if (error){ // The call fails, and error.code and error.message are printed. Console.log("Promise return failed.error.code"+error.code+"error.message"+error.message); - }else{// The call is successful, and the device starts to vibrate. + }else{ // The call is successful, and the device starts to vibrate. Console.log("Promise returned to indicate a successful vibration.") }; }) @@ -75,10 +75,16 @@ You can set different vibration effects as needed, for example, customizing vibr ``` import vibrator from "@ohos.vibrator" vibrator.stop(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_PRESET).then((error)=>{ - if (error) {// The call fails, and error.code and error.message are printed. + if(error){ // The call fails, and error.code and error.message are printed. Console.log("Promise return failed.error.code"+error.code+"error.message"+error.message); - }else{// The call is successful, and the device stops vibration. + }else{ // The call is successful, and the device stops vibration. Console.log("Promise returned to indicate a successful stop."); }; }) ``` + +## Samples + +The following sample is provided to help you better understand how to develop vibrators: + +- [`Vibrator`: vibrator (eTS, API 8)](https://gitee.com/openharmony/app_samples/tree/master/device/Vibrator) diff --git a/en/application-dev/device/vibrator-overview.md b/en/application-dev/device/vibrator-overview.md index 88460b4fe415d836a687363c10ceda68c1e98390..889f6b823cc0bbff99cd9bc9cbb2dde641766420 100644 --- a/en/application-dev/device/vibrator-overview.md +++ b/en/application-dev/device/vibrator-overview.md @@ -1,7 +1,7 @@ # Vibrator Overview -The vibrator service opens up the latest capabilities of the vibrator hardware to the maximum extent. By expanding the native vibrator service to implement integrated vibration and interaction design, the service delivers an exquisite integrated vibration experience and differentiated experience, and improves user interaction efficiency and usability. +The vibrator service is built on the native vibrator service, bolstered by the latest capabilities of the vibrator hardware. By innovatively integrating vibration and interaction, the service takes user interaction efficiency and usability to the next level. ## Working Principles @@ -12,7 +12,7 @@ The vibrator is a Misc device that consists of four modules: Vibrator API, Vibra ![0752d302-aeb9-481a-bb8f-e5524eb61eeb](figures/0752d302-aeb9-481a-bb8f-e5524eb61eeb.png) -- Vibrator API: provides basic vibrator APIs, including the APIs for querying the vibrator list, querying the vibrator by effect, and triggering and stopping vibration. +- Vibrator API: provides basic vibrator APIs, including the APIs for obtaining the vibrator list, querying the vibrator by effect, and triggering and stopping vibration. - Vibrator Framework: manages the framework layer of the vibrator and communicates with the Misc Device Service. diff --git a/en/application-dev/internationalization/i18n-guidelines.md b/en/application-dev/internationalization/i18n-guidelines.md index 0ded9fd39da8131472cdb600ffd6d3ebc7daff5f..1be7b7dff8fe59b423fa2766b81dc6c164aeec31 100644 --- a/en/application-dev/internationalization/i18n-guidelines.md +++ b/en/application-dev/internationalization/i18n-guidelines.md @@ -1,5 +1,6 @@ # Internationalization Development (i18n) +This development guide describes how to use i18n APIs that are not defined in ECMA 402. ## Obtaining System Language and Region Information diff --git a/en/application-dev/internationalization/intl-guidelines.md b/en/application-dev/internationalization/intl-guidelines.md index 57db3492c9c5a0f5d3bd2bc32f6d10db330f9b7c..76c00eb557816681efb54e9e7ec5d0a3754471b6 100644 --- a/en/application-dev/internationalization/intl-guidelines.md +++ b/en/application-dev/internationalization/intl-guidelines.md @@ -1,5 +1,6 @@ # Internationalization Development (intl) +This development guide describes how to use i18n APIs that are defined in ECMA 402. ## Setting Locale Information diff --git a/en/application-dev/napi/napi-guidelines.md b/en/application-dev/napi/napi-guidelines.md new file mode 100644 index 0000000000000000000000000000000000000000..0a1b7b89b46bc1c07311f110c6b5c654191d3a71 --- /dev/null +++ b/en/application-dev/napi/napi-guidelines.md @@ -0,0 +1,637 @@ +# Using Native APIs in Application Projects + +OpenHarmony applications need to use JavaScript (JS) when calling native APIs. The napi interfaces provided by the **arkui_napi** repository are used to implement the interaction with JS. Currently, the **arkui_napi** repository supports some third-party **Node.js** interfaces. The names of the napi interfaces are the same as those in the third-party **Node.js**. For details about the interfaces supported, see `libnapi.ndk.json` in this repository. + +## How to Develop + +The IDE has a default project that uses native APIs. You can choose `File` > `New` > `Create Project` to create a `Native C++` project. The cpp directory is generated in the main directory. You can use the napi interfaces provided by the **arkui_napi** repository for development. + +You can `import` the native .so that contains the JS processing logic. For example, `import hello from 'libhello.so'` to use the **libhello.so** capability. Then, the JS object created using the NAPI interface can be passed to the `hello` object of the application to call the native capability. + +## Development Guidelines + +### Registration + +* Add **static** to the **nm_register_func** function to prevent symbol conflicts with other .so files. +* The name of the module registration entry, that is, the function modified by **\_\_attribute\_\_((constructor))**, must be unique. +### .so Naming Rules + +Each module has a .so file. For example, if the module name is `hello`, name the .so file **libhello.so**. The `nm_modname` field in `napi_module` must be `hello`, which is the same as the module name. The sample code for importing the .so file is `import hello from 'libhello.so'`. + +### JS Objects and Threads + +The Ark engine prevents napi interfaces from being called to operate JS objects in non-JS threads. Otherwise, the application will crash. + +* The napi interfaces can be used only in JS threads. +* **env** is bound to a thread and cannot be used across threads. The JS object created by a native API can be used only in the thread, in which the object is created, that is, the JS object is bound to the **env** of the thread. + +### napi_create_async_work + +**napi_create_async_work** has two callbacks: + +* **execute**: processes service logic asynchronously. This callback is not executed by a JS thread, therefore, it cannot call any NAPI interface. The return value of **execute** is processed by the **complete** callback. + +* **complete**: calls the napi interface to encapsulate the return value of **execute** into a JS object and return it for processing. This callback is executed by a JS thread. + +```c++ +napi_status napi_create_async_work(napi_env env, + napi_value async_resource, + napi_value async_resource_name, + napi_async_execute_callback execute, + napi_async_complete_callback complete, + void* data, + napi_async_work* result) +``` + + + +## Example 1 Encapsulating Synchronous and Asynchronous APIs for the Storage Module + +### Overview + +This example shows how to encapsulate the synchronous and asynchronous APIs of the storage module. The storage module implements the functions of storing, obtaining, deleting, and clearing data. + +### API Declaration + +```typescript +import { AsyncCallback } from './basic'; +declare namespace storage { + function get(key: string, callback: AsyncCallback): void; + function get(key: string, defaultValue: string, callback: AsyncCallback): void; + function get(key: string, defaultValue?: string): Promise; + function set(key: string, value: string, callback: AsyncCallback): void; + function remove(key: string, callback: AsyncCallback): void; + function clear(callback: AsyncCallback): void; + function getSync(key: string, defaultValue?: string): string; + function setSync(key: string, value: string): void; + function removeSync(key: string): void; + function clearClear(): void; +} +export default storage; +``` + + + +### Implementation + +You can obtain the complete code from `sample/native_module_storage/` in the **arkui_napi** repository. + +#### Registering the Module + +Register four synchronous APIs (`getSync`, `setSync`, `removeSync`, and`clearSync`) and four asynchronous APIs (`get`, `set`, `remove`, and `clear`). + +```c++ +/*********************************************** + * Module export and register + ***********************************************/ +static napi_value StorgeExport(napi_env env, napi_value exports) +{ + napi_property_descriptor desc[] = { + DECLARE_NAPI_FUNCTION("get", JSStorageGet), + DECLARE_NAPI_FUNCTION("set", JSStorageSet), + DECLARE_NAPI_FUNCTION("remove", JSStorageDelete), + DECLARE_NAPI_FUNCTION("clear", JSStorageClear), + + DECLARE_NAPI_FUNCTION("getSync", JSStorageGetSync), + DECLARE_NAPI_FUNCTION("setSync", JSStorageSetSync), + DECLARE_NAPI_FUNCTION("deleteSync", JSStorageDeleteSync), + DECLARE_NAPI_FUNCTION("clearSync", JSStorageClearSync), + }; + NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc)); + return exports; +} + +// Storage module +static napi_module storage_module = {.nm_version = 1, + .nm_flags = 0, + .nm_filename = nullptr, + .nm_register_func = StorgeExport, + .nm_modname = "storage", + .nm_priv = ((void*)0), + .reserved = {0}}; + +// Register the storage module +extern "C" __attribute__((constructor)) void StorageRegister() +{ + napi_module_register(&storage_module); +} +``` + +#### Implementing getSync + +The **getSync** function registered for the storage module is **JSStorageGetSync**. Obtain data from `gKeyValueStorage`, create a string object, and return it. + +```c +static napi_value JSStorageGetSync(napi_env env, napi_callback_info info) +{ + GET_PARAMS(env, info, 2); + NAPI_ASSERT(env, argc >= 1, "requires 1 parameter"); + char key[32] = {0}; + size_t keyLen = 0; + char value[128] = {0}; + size_t valueLen = 0; + + // parse parameters + for (size_t i = 0; i < argc; i++) { + napi_valuetype valueType; + napi_typeof(env, argv[i], &valueType); + + if (i == 0 && valueType == napi_string) { + napi_get_value_string_utf8(env, argv[i], key, 31, &keyLen); + } else if (i == 1 && valueType == napi_string) { + napi_get_value_string_utf8(env, argv[i], value, 127, &valueLen); + break; + } else { + NAPI_ASSERT(env, false, "type mismatch"); + } + } + + // Service logic for obtaining data. This example simply obtains data from a global variable. + auto itr = gKeyValueStorage.find(key); + napi_value result = nullptr; + if (itr != gKeyValueStorage.end()) { + // Use the data obtained to create a JS object of the string type. + napi_create_string_utf8(env, itr->second.c_str(), itr->second.length(), &result); + } else if (valueLen > 0) { + // If no data is obtained, use the default value to create a JS object. + napi_create_string_utf8(env, value, valueLen, &result); + } else { + NAPI_ASSERT(env, false, "key does not exist"); + } + // Return the result. + return result; +} +``` + +#### Implementing get + +The `get` function registered for the storage module is `JSStorageGet`. + +```c +static napi_value JSStorageGet(napi_env env, napi_callback_info info) +{ + GET_PARAMS(env, info, 3); + NAPI_ASSERT(env, argc >= 1, "requires 1 parameter"); + + // StorageAsyncContext is a custom class used to store data during execution. + StorageAsyncContext* asyncContext = new StorageAsyncContext(); + + asyncContext->env = env; + + // Obtain parameters. + for (size_t i = 0; i < argc; i++) { + napi_valuetype valueType; + napi_typeof(env, argv[i], &valueType); + + if (i == 0 && valueType == napi_string) { + napi_get_value_string_utf8(env, argv[i], asyncContext->key, 31, &asyncContext->keyLen); + } else if (i == 1 && valueType == napi_string) { + napi_get_value_string_utf8(env, argv[i], asyncContext->value, 127, &asyncContext->valueLen); + } else if (i == 1 && valueType == napi_function) { + napi_create_reference(env, argv[i], 1, &asyncContext->callbackRef); + break; + } else if (i == 2 && valueType == napi_function) { + napi_create_reference(env, argv[i], 1, &asyncContext->callbackRef); + } else { + NAPI_ASSERT(env, false, "type mismatch"); + } + } + + napi_value result = nullptr; + + // Determine whether promise or callback is used based on the parameters. + if (asyncContext->callbackRef == nullptr) { + // Create a promise. + napi_create_promise(env, &asyncContext->deferred, &result); + } else { + napi_get_undefined(env, &result); + } + + napi_value resource = nullptr; + napi_create_string_utf8(env, "JSStorageGet", NAPI_AUTO_LENGTH, &resource); + + napi_create_async_work( + env, nullptr, resource, + // Callback 1: This callback contains the service logic to be asynchronously executed and is asynchronously executed by the napi interface. Do not operate JS objects using the napi interface because the execution is asynchronous. + [](napi_env env, void* data) { + StorageAsyncContext* asyncContext = (StorageAsyncContext*)data; + auto itr = gKeyValueStorage.find(asyncContext->key); + if (itr != gKeyValueStorage.end()) { + strncpy_s(asyncContext->value, 127, itr->second.c_str(), itr->second.length()); + asyncContext->status = 0; + } else { + asyncContext->status = 1; + } + }, + // Callback 2: This callback is invoked after callback 1 is complete. The JS thread invokes the callback passed in. + [](napi_env env, napi_status status, void* data) { + StorageAsyncContext* asyncContext = (StorageAsyncContext*)data; + napi_value result[2] = {0}; + if (!asyncContext->status) { + napi_get_undefined(env, &result[0]); + napi_create_string_utf8(env, asyncContext->value, strlen(asyncContext->value), &result[1]); + } else { + napi_value message = nullptr; + napi_create_string_utf8(env, "key does not exist", NAPI_AUTO_LENGTH, &message); + napi_create_error(env, nullptr, message, &result[0]); + napi_get_undefined(env, &result[1]); + } + if (asyncContext->deferred) { + // If a promise is used, check the result of callback 1. + if (!asyncContext->status) { + // Triggered when callback 1 is successful (status is 1), that is, invoke the callback passed in then in the promise. + napi_resolve_deferred(env, asyncContext->deferred, result[1]); + } else { + // Triggered when callback 1 fails (status is 0), that is, invoke the callback passed in catch in the promise. + napi_reject_deferred(env, asyncContext->deferred, result[0]); + } + } else { + // If a callback is used, use napi_call_function to invoke the callback to return the result. + napi_value callback = nullptr; + napi_value returnVal; + napi_get_reference_value(env, asyncContext->callbackRef, &callback); + napi_call_function(env, nullptr, callback, 2, result, &returnVal); + napi_delete_reference(env, asyncContext->callbackRef); + } + napi_delete_async_work(env, asyncContext->work); + delete asyncContext; + }, + (void*)asyncContext, &asyncContext->work); + napi_queue_async_work(env, asyncContext->work); + + return result; +} +``` + +### JS Sample Code + +```js +import storage from 'libstorage.so'; + +export default { + testGetSync() { + const name = storage.getSync('name'); + console.log('name is ' + name); + }, + testGet() { + storage.get('name') + .then(date => { + console.log('name is ' + data); + }) + .catch(error => { + console.log('error: ' + error); + }); + } +} +``` + + + +## Example 2 Binding Native and JS Objects for the NetServer Module + +### Overview + +This example shows how to implement the `on/off/once` method and bind C++ and JS objects using the **wrap** API. The NetServer module implements a network service. + +### API Declaration + +```typescript +export class NetServer { + function start(port: number): void; + function stop(): void; + function on('start' | 'stop', callback: Function): void; + function once('start' | 'stop', callback: Function): void; + function off('start' | 'stop', callback: Function): void; +} +``` + +### Implementation + +You can obtain the complete code from `sample/native_module_netserver/` in the **arkui_napi** repository. + +#### Registering the Module + +```c +static napi_value NetServer::Export(napi_env env, napi_value exports) +{ + const char className[] = "NetServer"; + napi_property_descriptor properties[] = { + DECLARE_NAPI_FUNCTION("start", JS_Start), + DECLARE_NAPI_FUNCTION("stop", JS_Stop), + DECLARE_NAPI_FUNCTION("on", JS_On), + DECLARE_NAPI_FUNCTION("once", JS_Once), + DECLARE_NAPI_FUNCTION("off", JS_Off), + }; + napi_value netServerClass = nullptr; + + napi_define_class(env, className, sizeof(className), JS_Constructor, nullptr, countof(properties), properties, + &netServerClass); + + napi_set_named_property(env, exports, "NetServer", netServerClass); + + return exports; +} +``` + +#### Binding C++ and JS Objects in a Constructor + +```c +napi_value NetServer::JS_Constructor(napi_env env, napi_callback_info cbinfo) +{ + napi_value thisVar = nullptr; + void* data = nullptr; + napi_get_cb_info(env, cbinfo, nullptr, nullptr, &thisVar, &data); + + // C++ native object to be mapped to the JS object. + NetServer* netServer = new NetServer(env, thisVar); + + // Use napi_wrap to bind netServer and thisVar (JS object created). + napi_wrap( + env, thisVar, netServer, + // The JS object is automatically released by the engine. When the JS object is released, the callback is triggered to release netServer. + [](napi_env env, void* data, void* hint) { + printf("NetServer::Destructor\n"); + NetServer* netServer = (NetServer*)data; + delete netServer; + }, + nullptr, nullptr); + + return thisVar; +} +``` + +#### Obtaining the C++ Object from the JS Object + +```c +napi_value NetServer::JS_Start(napi_env env, napi_callback_info cbinfo) +{ + size_t argc = 1; + napi_value argv[1] = {0}; + napi_value thisVar = nullptr; + void* data = nullptr; + napi_get_cb_info(env, cbinfo, &argc, argv, &thisVar, &data); + + NetServer* netServer = nullptr; + // Obtain the C++ object from thisVar using napi_unwrap. + napi_unwrap(env, thisVar, (void**)&netServer); + + NAPI_ASSERT(env, argc >= 1, "requires 1 parameter"); + + napi_valuetype valueType; + napi_typeof(env, argv[0], &valueType); + NAPI_ASSERT(env, valueType == napi_number, "type mismatch for parameter 1"); + + int32_t port = 0; + napi_get_value_int32(env, argv[0], &port); + + // Start the netServer service. + netServer->Start(port); + + napi_value result = nullptr; + napi_get_undefined(env, &result); + return result; +} +``` + +After `netServer->Start` is executed, call back the `start` event registered by `on`. + +```c +int NetServer::Start(int port) +{ + printf("NetServer::Start thread_id: %ld \n", uv_thread_self()); + + struct sockaddr_in addr; + int r; + + uv_ip4_addr("0.0.0.0", port, &addr); + + r = uv_tcp_init(loop_, &tcpServer_); + if (r) { + fprintf(stderr, "Socket creation error\n"); + return 1; + } + + r = uv_tcp_bind(&tcpServer_, (const struct sockaddr*)&addr, 0); + if (r) { + fprintf(stderr, "Bind error\n"); + return 1; + } + + r = uv_listen((uv_stream_t*)&tcpServer_, SOMAXCONN, OnConnection); + if (r) { + fprintf(stderr, "Listen error %s\n", uv_err_name(r)); + return 1; + } + + // Trigger the start event after the service is started. + Emit("start", nullptr); + + return 0; +} +``` + +#### Registering Events (on) + +```c +napi_value NetServer::JS_On(napi_env env, napi_callback_info cbinfo) +{ + size_t argc = 2; + napi_value argv[2] = {0}; + napi_value thisVar = 0; + void* data = nullptr; + napi_get_cb_info(env, cbinfo, &argc, argv, &thisVar, &data); + + NetServer* netServer = nullptr; + // Obtain the NetServer pointer using napi_unwrap. + napi_unwrap(env, thisVar, (void**)&netServer); + + NAPI_ASSERT(env, argc >= 2, "requires 2 parameter"); + + // Verify the parameter type. + napi_valuetype eventValueType; + napi_typeof(env, argv[0], &eventValueType); + NAPI_ASSERT(env, eventValueType == napi_string, "type mismatch for parameter 1"); + + napi_valuetype eventHandleType; + napi_typeof(env, argv[1], &eventHandleType); + NAPI_ASSERT(env, eventHandleType == napi_function, "type mismatch for parameter 2"); + + char type[64] = {0}; + size_t typeLen = 0; + + napi_get_value_string_utf8(env, argv[0], type, 63, &typeLen); + + // Register the event handler. + netServer->On((const char*)type, argv[1]); + + napi_value result = nullptr; + napi_get_undefined(env, &result); + return result; +} +``` + +### JS Sample Code + +```javascript +import { NetServer } from 'libnetserver.so'; + +export default { + testNetServer() { + var netServer = new NetServer(); + netServer.on('start', (event) => {}); + netServer.start(1000); // The port number is 1000. After start is executed, invoke the start callback registered. + } +} +``` + + + +## Example 3 Calling Back a JS API in a Non-JS Thread + +### Overview + +This example describes how to invoke a JS callback in a non-JS thread. For example, a sensor listener is registered for a JS application. The sensor data is reported by an SA. When the SA invokes the client through Inter-Process Communication (IPC), the execution thread is an IPC thread, which is different from the JS thread of the application. In this case, the JS callback must be thrown to the JS thread to execute. Otherwise, the application will crash. + +### Implementation + +You can obtain the complete code from `sample/native_module_callback/` in the **arkui_napi** repository. + +#### Registering the Module + +Register the `test` API to pass in a parameter. + +```c++ +/*********************************************** + * Module export and register + ***********************************************/ +static napi_value CallbackExport(napi_env env, napi_value exports) +{ + static napi_property_descriptor desc[] = { + DECLARE_NAPI_FUNCTION("test", JSTest) + }; + NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc)); + return exports; +} + +// Define the callback +static napi_module callbackModule = { + .nm_version = 1, + .nm_flags = 0, + .nm_filename = nullptr, + .nm_register_func = CallbackExport, + .nm_modname = "callback", + .nm_priv = ((void*)0), + .reserved = { 0 }, +}; + +// Register the callback +extern "C" __attribute__((constructor)) void CallbackTestRegister() +{ + napi_module_register(&callbackModule); +} +``` + +#### Obtaining the Loop in env and Throwing the Task to the JS Thread + +```c++ +#include + +#include "napi/native_api.h" +#include "napi/native_node_api.h" + +#include "uv.h" + +struct CallbackContext { + napi_env env = nullptr; + napi_ref callbackRef = nullptr; + int retData = 0; +}; + +void callbackTest(CallbackContext* context) +{ + uv_loop_s* loop = nullptr; + // Save the env when the JS callback is registered. Obtain the loop of the JS thread from env. + napi_get_uv_event_loop(context->env, &loop); + + // Create uv_work_t to transfer private data (int type 1 in this example). Note that memory must be released after the callback is complete. The logic for generating the returned data is omitted here. + uv_work_t* work = new uv_work_t; + context->retData = 1; + work->data = (void*)context; + + // Call the libuv API to throw the JS task to the loop for execution. + uv_queue_work( + loop, + work, + // This callback is executed in another common thread to process tasks asynchronously. After the callback is complete, execute the next callback. In this scenario, the callback does not need to execute any task. + [](uv_work_t* work) {}, + // This callback is executed in the JS thread bound to env. + [](uv_work_t* work, int status) { + CallbackContext* context = (CallbackContext*)work->data; + napi_handle_scope scope = nullptr; + // Open the handle scope to manage the lifecycle of napi_value. Otherwise, memory leakage occurs. + napi_open_handle_scope(context->env, &scope); + if (scope == nullptr) { + return; + } + + // Call napi interfaces. + napi_value callback = nullptr; + napi_get_reference_value(context->env, context->callbackRef, &callback); + napi_value retArg; + napi_create_int32(context->env, context->retData, &retArg); + napi_value ret; + napi_call_function(context->env, nullptr, callback, 1, &retArg, &ret); + napi_delete_reference(context->env, context->callbackRef); + + // Close the handle scope to release napi_value. + napi_close_handle_scope(context->env, scope); + + // Release the work pointer. + if (work != nullptr) { + delete work; + } + + delete context; + } + ); +} + +static napi_value JSTest(napi_env env, napi_callback_info info) +{ + size_t argc = 1; + napi_value argv[1] = { 0 }; + napi_value thisVar = nullptr; + void* data = nullptr; + napi_get_cb_info(env, info, &argc, argv, &thisVar, &data); + + // Obtain the first input parameter, that is, the callback to be invoked subsequently. + napi_valuetype valueType = napi_undefined; + napi_typeof(env, argv[0], &valueType); + if (valueType != napi_function) { + return nullptr; + } + // Save the env and callback for subsequent transfer. + auto asyncContext = new CallbackContext(); + asyncContext->env = env; + napi_create_reference(env, argv[0], 1, &asyncContext->callbackRef); + // Simulate the logic for throwing a task to a non-JS thread. + std::thread testThread(callbackTest, asyncContext); + testThread.detach(); + + return nullptr; +} +``` + +### JS Sample Code + +```js +import callback from 'libcallback.so'; + +export default { + testcallback() { + callback.test((data) => { + console.error('test result = ' + data) + }) + } +} +``` diff --git a/en/application-dev/notification/common-event.md b/en/application-dev/notification/common-event.md index cd139f0700d01475ad7f6fb358744e52ffafb913..99cbc2a32b9cfdc29e56f834e7b834ce3179ef7c 100644 --- a/en/application-dev/notification/common-event.md +++ b/en/application-dev/notification/common-event.md @@ -170,10 +170,8 @@ if (this.subscriber != null) { } ``` -## Development Example +## Samples The following sample is provided to help you better understand how to use the common event functionality: -- [CommonEvent](https://gitee.com/openharmony/app_samples/tree/master/ability/CommonEvent) - -This sample shows how to use **CommonEvent** APIs in Extended TypeScript (eTS) to create subscribers and subscribe to, publish, and unsubscribe from common events. +- [`CommonEvent`: eTS Common Event (API 7)](https://gitee.com/openharmony/app_samples/tree/master/Notification/CommonEvent) diff --git a/en/application-dev/quick-start/figures/image-20220326065201867.png b/en/application-dev/quick-start/figures/image-20220326065201867.png index e64cc86fef41a31e4a6b93a96faf2ee7eda03e86..5c3b428823d5f044a2857e641ac2465beff39114 100644 Binary files a/en/application-dev/quick-start/figures/image-20220326065201867.png and b/en/application-dev/quick-start/figures/image-20220326065201867.png differ diff --git a/en/application-dev/quick-start/syscap.md b/en/application-dev/quick-start/syscap.md index de4c08ef0228af6b42328584fa8cd7bd5a0c106a..3d9d733441f5ab19016a3cabeada6abe41d6e1bc 100644 --- a/en/application-dev/quick-start/syscap.md +++ b/en/application-dev/quick-start/syscap.md @@ -4,17 +4,17 @@ ### System Capabilities and APIs -SysCap is short for System Capability. It refers to each independent feature in the operating system, such as Bluetooth, Wi-Fi, NFC, and camera. Each system capability corresponds to multiple APIs. These APIs are bound together and their availability depends on the support on the target device. They can also be provided together with the IDE for association. +SysCap is short for System Capability. It refers to a standalone feature in the operating system, for example, Bluetooth, Wi-Fi, NFC, or camera. Each system capability corresponds to a set of bound APIs, whose availability depends on the support of the target device. Such a set of APIs can be provided in the IDE for association. ![image-20220326064841782](figures/image-20220326064841782.png) -### Supported Capability Set, Association Capability Set, and Required Capability Set +### Supported Capability Set, Associated Capability Set, and Required Capability Set -The supported capability set, association capability set, and required capability set are collections of system capabilities. +The supported capability set, associated capability set, and required capability set are collections of system capabilities. The supported capability set covers the device capabilities, and the required capability set covers the application capabilities. If the capability set required by application A is a subset of the capability set supported by device N, application A can be distributed to device N for installation and running. Otherwise, application A cannot be distributed. -The association capability set covers the system capabilities of APIs that can be associated by the IDE during application development. +The associated capability set covers the system capabilities of associated APIs that the IDE offers during application development. ![image-20220326064913834](figures/image-20220326064913834.png) @@ -22,7 +22,7 @@ The association capability set covers the system capabilities of APIs that can b ### Devices and Supported Capability Sets -Each device provides a capability set according to its hardware capability. +Each device provides a capability set that matches its hardware capability. The SDK classifies devices into general devices and custom devices. The general devices' supported capability set is defined by OpenHarmony, and the custom devices' is defined by device vendors. ![image-20220326064955505](figures/image-20220326064955505.png) @@ -31,7 +31,7 @@ The SDK classifies devices into general devices and custom devices. The general ### Mapping Between Devices and SDK Capabilities -The SDK provides full APIs for the IDE. The IDE identifies the supported capability set based on the devices supported by the project, filters the APIs contained in the capability set, and provides the supported APIs for association (to autocomplete input). +The SDK provides a full set of APIs for the IDE. The IDE identifies the supported capability set based on the devices supported by the project, filters the APIs contained in the capability set, and provides the supported APIs for association (to autocomplete input). ![image-20220326065043006](figures/image-20220326065043006.png) @@ -41,7 +41,7 @@ The SDK provides full APIs for the IDE. The IDE identifies the supported capabil ### Importing the PCID -DevEco Studio allows PCID imports for projects. After the imported PCID file is decoded, the output SysCap is written into the **syscap.json** file. +DevEco Studio allows Product Compatibility ID (PCID) imports for projects. After the imported PCID file is decoded, the SysCap is output and written into the **syscap.json** file. Right-click the project directory and choose **Import Product Compatibility ID** from the shortcut menu to upload the PCID file and import it to the **syscap.json** file. @@ -49,21 +49,22 @@ Right-click the project directory and choose **Import Product Compatibility ID** -### Configuring the Association Capability Set and Required Capability Set +### Configuring the Associated Capability Set and Required Capability Set -The IDE automatically configures the association capability set and required capability set based on the settings supported by the created project. You can modify the capability sets when necessary. -For the association capability set, you can use more APIs in the IDE by adding more system capabilities. Note that these APIs may not be supported on the device. Therefore, you need to check whether these APIs are supported before using them. +The IDE automatically configures the associated capability set and required capability set based on the settings supported by the created project. You can modify the capability sets when necessary. +You can add APIs to the associated capability set in the IDE by adding system capabilities. However, note that these APIs may not be supported on the device. Therefore, check whether these APIs are supported before using them. Exercise caution when modifying the required capability set. Incorrect modifications may cause the application to unable to be distributed to the target device. ``` /* syscap.json */ { devices: { - general: [ /* Each general device corresponds to a SysCap capability set. Multiple general devices can be configured.*/ + general: [ /* General devices. Each general device supports a SysCap set. Multiple general devices can be configured. */ + "default", "car, ... ], - custom: [ /* Vendor-defined device*/ + custom: [ /* Custom devices. */ { "Custom device": [ "SystemCapability.Communication.SoftBus.Core", @@ -73,13 +74,13 @@ Exercise caution when modifying the required capability set. Incorrect modificat ... ] }, - development: { /* The SysCap set in addedSysCaps and the SysCap set supported by each device configured in devices form the association capability set.*/ + development: { /* The SysCap set in addedSysCaps and the SysCap set supported by each device configured in devices form the associated capability set. */ addedSysCaps: [ "SystemCapability.Location.Location.Lite", ... ] }, - production: { /* Used to generate the RPCID. Exercise caution when adding this parameter. Under incorrect settings, applications may fail to be distributed to target devices.*/ + production: { /* Used to generate the RPCID. Exercise caution when adding this parameter. Under incorrect settings, applications may fail to be distributed to target devices. */ addedSysCaps: [], // Intersection of SysCap sets supported by devices configured in devices. It is the required capability set with addedSysCaps set and removedSysCaps set. removedSysCaps: [] // When the required capability set is a capability subset of a device, the application can be distributed to the device. } @@ -98,7 +99,7 @@ By default, the association capability set and required system capability set of ### Cross-Device Application Development -By default, the association capability set of the application is the union of multiple devices' supported capability sets. The capability sets must be the intersection. +By default, the associated capability set of the application is the union of multiple devices' supported capability sets. The capability sets must be the intersection. ![image-20220326065201867](figures/image-20220326065201867.png) @@ -106,17 +107,17 @@ By default, the association capability set of the application is the union of mu ### Checking Whether an API Is Available -To check whether a project supports a specific SysCap, you can use **canIUse**. +Use **canIUse** if you want to check whether a project supports a specific SysCap. ``` if (canIUse("SystemCapability.ArkUI.ArkUI.Full")) { - console.log("The application supports SystemCapability.ArkUI.ArkUI.Full."); + console.log("This application supports SystemCapability.ArkUI.ArkUI.Full."); } else { - Console.log("The application does not support SystemCapability.ArkUI.ArkUI.Full".); + Console.log("This application does not support SystemCapability.ArkUI.ArkUI.Full".); } ``` -You can import a module. If the current device does not support the module, the import result is **undefined**. When using an API, you need to check whether the API is available. +You can import a module using the **import** API. If the current device does not support the module, the import result is **undefined**. Before using an API, you must make sure the API is available. ``` import geolocation from '@ohos.geolocation'; @@ -126,7 +127,7 @@ if (geolocation) { console.log(location.latitude, location.longitude); }); } else { - Console.log('The device does not support location information.'); + Console.log('This device does not support location information.'); } ``` @@ -143,7 +144,7 @@ const authenticator = userAuth.getAuthenticator(); const result = authenticator.checkAbility('FACE_ONLY', 'S1'); if (result == authenticator.CheckAvailabilityResult.AUTH_NOT_SUPPORT) { - Console.log('The device does not support facial recognition.'); + Console.log('This device does not support facial recognition.'); } // If an unsupported API is forcibly called, an error message is returned, but no syntax error occurs. authenticator.execute('FACE_ONLY', 'S1', (err, result) => { @@ -155,24 +156,24 @@ authenticator.execute('FACE_ONLY', 'S1', (err, result) => { ``` -### How Are the SysCap Differences Between Devices Generated +### How Do SysCap Differences Arise Between Devices -The SysCap of devices varies according to the component combination assembled by the product solution vendor. The following figure shows the overall process. +The SysCap of devices varies according to the component combination defined by the product solution vendor. The following figure shows the overall process. ![image-20220326072448840](figures/image-20220326072448840.png) 1. A set of OpenHarmony source code consists of optional and mandatory components. Different components have different system capabilities. In other words, different components represent different SysCaps. -2. In a normalized released SDK, the mapping exists between APIs and SysCap. +2. In a normalized released SDK, APIs are mapped to SysCap sets. 3. Product solution vendors can assemble components based on hardware capabilities and product requirements. -4. The components configured for a product can be OpenHarmony components or private components developed by a third party. Because there is mapping between components and SysCap, the SysCap set of the product can be obtained after all components are assembled. +4. The components configured for a product can be OpenHarmony components or proprietary components developed by a third party. Since there is mapping between components and SysCap, the SysCap set of the product can be obtained after all components are assembled. -5. The SysCap set is encoded to generate the PCID. You can import the PCID to the IDE and decode it into SysCap. During development, compatibility processing is performed on the SysCap differences of devices. +5. The SysCap set is encoded to generate the PCID. You can import the PCID to the IDE and decode it into SysCap. During development, compatibility processing is performed to mitigate the SysCap differences of devices. -6. System parameters deployed on devices contain the SysCap set. The system provides native interfaces and application interfaces for components and applications in the system to check whether a SysCap set is available. +6. System parameters deployed on devices contain the SysCap set. The system provides native interfaces and application interfaces for components and applications to check whether a SysCap set is available. -7. During application development, the SysCap required by the application is encoded into the Required Product Compatibility ID (RPCID) and written into the application installation package. During application installation, the package manager decodes the RPCID to obtain the SysCap required by the application and compares it with the SysCap of the device. If the SysCap required by the application is met, the application is successfully installed. +7. During application development, the SysCap required by the application is encoded into the Required Product Compatibility ID (RPCID) and written into the application installation package. During application installation, the package manager decodes the RPCID to obtain the SysCap required by the application and compares it with the SysCap of the device. If the SysCap required by the application is met, the application can be installed. -8. When an application is running, the **canIUse** API can be used to query the SysCap of a device to ensure compatibility on different devices. +8. When an application is running, the **canIUse** API can be used to query whether the SysCap is compatible with the device. diff --git a/en/application-dev/reference/apis/js-apis-Context.md b/en/application-dev/reference/apis/js-apis-Context.md index 6a1909464162d6dfe49be1b0230efb1778de20f7..bc7b0afa88f6e9ee253b8cd8af3a5ba6633ce8b6 100644 --- a/en/application-dev/reference/apis/js-apis-Context.md +++ b/en/application-dev/reference/apis/js-apis-Context.md @@ -1,5 +1,8 @@ # Context Module +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. + ## Modules to Import ```js @@ -15,7 +18,7 @@ var context = featureAbility.getContext(); context.getOrCreateLocalDir() ``` -## Context.getOrCreateLocalDir +## Context.getOrCreateLocalDir7+ getOrCreateLocalDir(callback: AsyncCallback\): void @@ -43,7 +46,7 @@ context.getOrCreateLocalDir((err, data)=>{ -## Context.getOrCreateLocalDir +## Context.getOrCreateLocalDir7+ getOrCreateLocalDir(): Promise\ @@ -71,7 +74,7 @@ context.getOrCreateLocalDir().then((data) => { -## Context.verifyPermission +## Context.verifyPermission7+ verifyPermission(permission: string, options: PermissionOptions, callback: AsyncCallback\): void @@ -100,7 +103,7 @@ bundle.getBundleInfo('com.context.test', 1, (datainfo) =>{ -## Context.verifyPermission +## Context.verifyPermission7+ verifyPermission(permission: string, callback: AsyncCallback\): void @@ -123,7 +126,7 @@ var context = featureAbility.getContext(); context.verifyPermission("com.example.permission") ``` -## Context.verifyPermission +## Context.verifyPermission7+ verifyPermission(permission: string, options?: PermissionOptions): Promise\ @@ -158,7 +161,7 @@ context.verifyPermission('com.context.permission',Permission).then((data) => { -## Context.requestPermissionsFromUser +## Context.requestPermissionsFromUser7+ requestPermissionsFromUser(permissions: Array\, requestCode: number, resultCallback: AsyncCallback<[PermissionRequestResult](#permissionrequestresult)>): void @@ -194,7 +197,7 @@ context.requestPermissionsFromUser( -## Context.getApplicationInfo +## Context.getApplicationInfo7+ getApplicationInfo(callback: AsyncCallback\): void @@ -218,7 +221,7 @@ context.getApplicationInfo() -## Context.getApplicationInfo +## Context.getApplicationInfo7+ getApplicationInfo(): Promise\ @@ -245,7 +248,7 @@ context.getApplicationInfo().then((data) => { -## Context.getBundleName +## Context.getBundleName7+ getBundleName(callback: AsyncCallback\): void @@ -269,7 +272,7 @@ context.getBundleName() -## Context.getBundleName +## Context.getBundleName7+ getBundleName(): Promise\ @@ -296,7 +299,7 @@ context.getBundleName().then((data) => { -## Context.getProcessInfo +## Context.getProcessInfo7+ getProcessInfo(callback: AsyncCallback\): void @@ -320,7 +323,7 @@ context.getProcessInfo() -## Context.getProcessInfo +## Context.getProcessInfo7+ getProcessInfo(): Promise\ @@ -347,7 +350,7 @@ context.getProcessInfo().then((data) => { -## Context.getElementName +## Context.getElementName7+ getElementName(callback: AsyncCallback\): void @@ -373,7 +376,7 @@ context.getElementName() -## Context.getElementName +## Context.getElementName7+ getElementName(): Promise\ @@ -400,7 +403,7 @@ context.getElementName().then((data) => { }); ``` -## Context.getProcessName +## Context.getProcessName7+ getProcessName(callback: AsyncCallback\): void @@ -424,7 +427,7 @@ context.getProcessName() -## Context.getProcessName +## Context.getProcessName7+ getProcessName(): Promise\ @@ -451,7 +454,7 @@ context.getProcessName().then((data) => { -## Context.getCallingBundle +## Context.getCallingBundle7+ getCallingBundle(callback: AsyncCallback\): void @@ -475,7 +478,7 @@ context.getCallingBundle() -## Context.getCallingBundle +## Context.getCallingBundle7+ getCallingBundle(): Promise\ @@ -606,7 +609,7 @@ context.getFilesDir().then((data) => { }); ``` -## Context.getOrCreateDistributedDir +## Context.getOrCreateDistributedDir7+ getOrCreateDistributedDir(callback: AsyncCallback\): void @@ -636,7 +639,7 @@ context.getOrCreateDistributedDir((err, data) => { }); ``` -## Context.getOrCreateDistributedDir +## Context.getOrCreateDistributedDir7+ getOrCreateDistributedDir(): Promise\ @@ -662,7 +665,7 @@ context.getOrCreateDistributedDir().then((data) => { }); ``` -## Context.getAppType +## Context.getAppType7+ getAppType(callback: AsyncCallback\): void @@ -690,7 +693,7 @@ context.getAppType((err, data) => { }); ``` -## Context.getAppType +## Context.getAppType7+ getAppType(): Promise\ @@ -714,7 +717,7 @@ context.getAppType().then((data) => { }); ``` -## Context.getHapModuleInfo +## Context.getHapModuleInfo7+ getHapModuleInfo(callback: AsyncCallback\): void @@ -742,7 +745,7 @@ context.getHapModuleInfo((err, data) => { }); ``` -## Context.getHapModuleInfo +## Context.getHapModuleInfo7+ getHapModuleInfo(): Promise\ @@ -766,7 +769,7 @@ context.getHapModuleInfo().then((data) => { }); ``` -## Context.getAppVersionInfo +## Context.getAppVersionInfo7+ getAppVersionInfo(callback: AsyncCallback\): void @@ -794,7 +797,7 @@ context.getAppVersionInfo((err, data) => { }); ``` -## Context.getAppVersionInfo +## Context.getAppVersionInfo7+ getAppVersionInfo(): Promise\ @@ -818,7 +821,7 @@ context.getAppVersionInfo().then((data) => { }); ``` -## Context.getAbilityInfo +## Context.getAbilityInfo7+ getAbilityInfo(callback: AsyncCallback\): void @@ -846,7 +849,7 @@ context.getAbilityInfo((err, data) => { }); ``` -## Context.getAbilityInfo +## Context.getAbilityInfo7+ getAbilityInfo(): Promise\ @@ -870,7 +873,7 @@ context.getAbilityInfo().then((data) => { }); ``` -## Context.getApplicationContext +## Context.getApplicationContext7+ getApplicationContext(): Context @@ -891,7 +894,7 @@ import featureAbility from '@ohos.ability.featureAbility' var context = featureAbility.getContext().getApplicationContext(); ``` -## PermissionOptions +## PermissionOptions7+ **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -900,7 +903,7 @@ var context = featureAbility.getContext().getApplicationContext(); | pid | Read-only | number | No | Process ID.| | uid | Read-only | number | No | User ID.| -## PermissionRequestResult +## PermissionRequestResult7+ **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -910,7 +913,7 @@ var context = featureAbility.getContext().getApplicationContext(); | permissions | Read-only | Array\ | Yes | Permissions requested. | | authResults | Read-only | Array\ | Yes | Permission request result. | -## HapModuleInfo +## HapModuleInfo7+ Describes the HAP module information. @@ -933,7 +936,7 @@ Describes the HAP module information. | installationFree | boolean | Yes | No | When installation-free is supported. | | mainElementName | string | Yes| No| Information about the entry ability.| -## AppVersionInfo +## AppVersionInfo7+ | Name | Type| Readable | Writable | Description| | ------ | ------ | ------| ------ | ------ | diff --git a/en/application-dev/reference/apis/js-apis-ability-context.md b/en/application-dev/reference/apis/js-apis-ability-context.md index 418cd920f5e9d35ad751212b610693e06668d181..efab6fdd1273d247e6b95c5c5f6bc422abfcef96 100644 --- a/en/application-dev/reference/apis/js-apis-ability-context.md +++ b/en/application-dev/reference/apis/js-apis-ability-context.md @@ -1,6 +1,6 @@ # AbilityContext -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **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. @@ -46,7 +46,7 @@ Starts an ability. This API uses a callback to return the result. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.| + | want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** @@ -75,7 +75,7 @@ Starts an ability. This API uses a callback to return the result. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the **Want** used for starting an ability.| + | want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | options | StartOptions | Yes| Parameters used for starting the ability.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.| @@ -108,7 +108,7 @@ Starts an ability. This API uses a promise to return the result. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.| + | want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | options | StartOptions | No| Parameters used for starting the ability.| **Return value** @@ -149,7 +149,7 @@ Starts an ability. This API uses a callback to return the execution result when | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want |[Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.| + | want |[Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | callback | AsyncCallback<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Yes| Callback used to return the result.| @@ -177,7 +177,7 @@ Starts an ability. This API uses a callback to return the execution result when | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want |[Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.| + | want |[Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | options | StartOptions | Yes| Parameters used for starting the ability.| | callback | AsyncCallback<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Yes| Callback used to return the result.| @@ -210,7 +210,7 @@ Starts an ability. This API uses a promise to return the execution result when t | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.| + | want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.| | options | StartOptions | No| Parameters used for starting the ability.| @@ -357,7 +357,7 @@ Obtains the caller interface of the specified ability, and if the specified abil | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to start, including the ability name, bundle name, and device ID. If the device ID is left blank or the default value is used, the local ability will be started.| + | want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, including the ability name, bundle name, and device ID. If the device ID is left blank or the default value is used, the local ability will be started.| **Return value** diff --git a/en/application-dev/reference/apis/js-apis-application-Want.md b/en/application-dev/reference/apis/js-apis-application-Want.md index 3731cf8c99930e4bdf470946c5ad00067c142c21..5eb470dbe514f6993ed16d3e98c018d32742b8d7 100644 --- a/en/application-dev/reference/apis/js-apis-application-Want.md +++ b/en/application-dev/reference/apis/js-apis-application-Want.md @@ -1,6 +1,6 @@ # Want -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. **Want** is the basic communication component of the system. @@ -21,7 +21,7 @@ import Want from '@ohos.application.Want'; | ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | | deviceId | Read only | string | No | ID of the device running the ability. | | bundleName | Read only | string | No | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability.| -| abilityName | Read only | string | No | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability.| +| abilityName | Read only | string | No | Name of the ability. If both **package** and **AbilityName** are specified in this field in a **Want** object, the **Want** object can directly match the specified ability.| | uri | Read only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| | type | Read only | string | No | MIME type, for example, **text/plain** or **image/***. | | flags | Read only | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-featureAbility.md#flags).| diff --git a/en/application-dev/reference/apis/js-apis-application-ability.md b/en/application-dev/reference/apis/js-apis-application-ability.md index 6dd48dc410dcf8474a9b5918db4e384d83893fd4..5fce08ac4bc72bb2e7b430c4aa450f7478d80907 100644 --- a/en/application-dev/reference/apis/js-apis-application-ability.md +++ b/en/application-dev/reference/apis/js-apis-application-ability.md @@ -1,6 +1,6 @@ # Ability -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **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. @@ -21,8 +21,8 @@ import Ability from '@ohos.application.Ability'; | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | | context | [AbilityContext](js-apis-ability-context.md) | Yes| No| Context of an ability.| -| launchWant | [Want](js-apis-featureAbility.md#Want)| Yes| No| Parameters for starting the ability.| -| lastRequestWant | [Want](js-apis-featureAbility.md#Want)| Yes| No| Parameters used when the ability was started last time.| +| launchWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters for starting the ability.| +| lastRequestWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters used when the ability was started last time.| ## Ability.onCreate @@ -37,7 +37,7 @@ Called to initialize the service logic when an ability is created. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information related to this ability, including the ability name and bundle name.| + | want | [Want](js-apis-application-Want.md) | Yes| Information related to this ability, including the ability name and bundle name.| | param | AbilityConstant.LaunchParam | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.| **Example** @@ -222,7 +222,7 @@ Called when the ability startup mode is set to singleton. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want)| Yes| Want parameters, such as the ability name and bundle name.| + | want | [Want](js-apis-application-Want.md) | Yes| Want parameters, such as the ability name and bundle name.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-application-abilitystage.md b/en/application-dev/reference/apis/js-apis-application-abilitystage.md index c5183939ca5246c1f592d0a6f953864335c053fc..516698bbbc1ddf7b4a3d70a89ef372ad67b48e78 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilitystage.md +++ b/en/application-dev/reference/apis/js-apis-application-abilitystage.md @@ -1,6 +1,6 @@ # AbilityStage -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -47,7 +47,7 @@ Called when a specified ability is started. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to start, such as the ability name and bundle name.| + | want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, such as the ability name and bundle name.| **Return value** diff --git a/en/application-dev/reference/apis/js-apis-arraylist.md b/en/application-dev/reference/apis/js-apis-arraylist.md index 691dea9eaed2f4ec4cfbafc22ffb8b547c48cfbc..2290f5d295d182f700248afc45d131bb51aea79a 100644 --- a/en/application-dev/reference/apis/js-apis-arraylist.md +++ b/en/application-dev/reference/apis/js-apis-arraylist.md @@ -1,11 +1,11 @@ # Linear Container ArrayList -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```ts import ArrayList from '@ohos.util.ArrayList' ``` @@ -30,7 +30,7 @@ A constructor used to create an **ArrayList** instance. **Example** -``` +```ts let arrayList = new ArrayList(); ``` @@ -55,7 +55,7 @@ Adds an entry at the end of this container. **Example** - ``` + ```ts let arrayList = new ArrayList(); let result = arrayList.add("a"); let result1 = arrayList.add(1); @@ -80,7 +80,7 @@ Inserts an entry at the specified position in this container. **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.insert("A", 0); arrayList.insert(0, 1); @@ -107,7 +107,7 @@ Checks whether this container has the specified entry. **Example** -``` +```ts let arrayList = new ArrayList(); let result = arrayList.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); arrayList.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); @@ -134,7 +134,7 @@ Obtains the index of the first occurrence of the specified entry in this contain **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -166,7 +166,7 @@ Obtains the index of the last occurrence of the specified entry in this containe **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -198,7 +198,7 @@ Removes an entry with the specified position from this container. **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -228,7 +228,7 @@ Removes the first occurrence of the specified entry from this container. **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -252,7 +252,7 @@ Removes from this container all of the entries within a range, including the ent **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -287,7 +287,7 @@ callbackfn **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -325,7 +325,7 @@ callbackfn **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -357,7 +357,7 @@ comparator **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -389,7 +389,7 @@ Obtains entries within a range in this container, including the entry at the sta **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -408,7 +408,7 @@ Clears this container and sets its length to **0**. **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -432,7 +432,7 @@ Clones this container and returns a copy. The modification to the copy does not **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -455,7 +455,7 @@ Obtains the capacity of this container. **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -478,7 +478,7 @@ Converts this container into an array. **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -501,7 +501,7 @@ Checks whether this container is empty (contains no entry). **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -524,7 +524,7 @@ Increases the capacity of this container. **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -542,7 +542,7 @@ Trims the capacity of this container to its current length. **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); @@ -565,7 +565,7 @@ Obtains an iterator, each item of which is a JavaScript object. **Example** -``` +```ts let arrayList = new ArrayList(); arrayList.add(2); arrayList.add(4); diff --git a/en/application-dev/reference/apis/js-apis-configurationconstant.md b/en/application-dev/reference/apis/js-apis-configurationconstant.md index 55f42b926d4bfcbb4b07a48185611b22a92cbc32..ef0917ba4a9d1838832d14117a2b002d9083f1f8 100644 --- a/en/application-dev/reference/apis/js-apis-configurationconstant.md +++ b/en/application-dev/reference/apis/js-apis-configurationconstant.md @@ -1,6 +1,6 @@ # ConfigurationConstant -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -34,7 +34,7 @@ ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT | COLOR_MODE_LIGHT | 1 | Light mode.| -## ConfigurationConstant.Direction +## ConfigurationConstant.Direction9+ The value is obtained through the **ConfigurationConstant.Direction** API. @@ -48,12 +48,12 @@ ConfigurationConstant.Direction.DIRECTION_VERTICAL | Name| Value| Description| | -------- | -------- | -------- | -| DIRECTION_NOT_SET9+ | -1 | Unspecified direction.| -| DIRECTION_VERTICAL9+ | 0 | Vertical direction.| -| DIRECTION_HORIZONTAL9+ | 1 | Horizontal direction.| +| DIRECTION_NOT_SET | -1 | Unspecified direction.| +| DIRECTION_VERTICAL | 0 | Vertical direction.| +| DIRECTION_HORIZONTAL | 1 | Horizontal direction.| -## ConfigurationConstant.ScreenDensity +## ConfigurationConstant.ScreenDensity9+ The value is obtained through the **ConfigurationConstant.ScreenDensity** API. @@ -67,10 +67,10 @@ ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_NOT_SET | Name| Value| Description| | -------- | -------- | -------- | -| SCREEN_DENSITY_NOT_SET9+ | 0 | Unspecified screen resolution.| -| SCREEN_DENSITY_SDPI9+ | 120 | The screen resolution is sdpi.| -| SCREEN_DENSITY_MDPI9+ | 160 | The screen resolution is mdpi.| -| SCREEN_DENSITY_LDPI9+ | 240 | The screen resolution is ldpi.| -| SCREEN_DENSITY_XLDPI9+ | 320 | The screen resolution is xldpi.| -| SCREEN_DENSITY_XXLDPI9+ | 480 | The screen resolution is xxldpi.| -| SCREEN_DENSITY_XXXLDPI9+ | 640 | The screen resolution is xxxldpi.| +| SCREEN_DENSITY_NOT_SET | 0 | Unspecified screen resolution.| +| SCREEN_DENSITY_SDPI | 120 | The screen resolution is sdpi.| +| SCREEN_DENSITY_MDPI | 160 | The screen resolution is mdpi.| +| SCREEN_DENSITY_LDPI | 240 | The screen resolution is ldpi.| +| SCREEN_DENSITY_XLDPI | 320 | The screen resolution is xldpi.| +| SCREEN_DENSITY_XXLDPI | 480 | The screen resolution is xxldpi.| +| SCREEN_DENSITY_XXXLDPI | 640 | The screen resolution is xxxldpi.| diff --git a/en/application-dev/reference/apis/js-apis-deque.md b/en/application-dev/reference/apis/js-apis-deque.md index 128dc378de40cc7cca9cc4b8b3732b833cc678b9..b16ecfe75ea6ea083c5ff3bed796ebada1e06c58 100644 --- a/en/application-dev/reference/apis/js-apis-deque.md +++ b/en/application-dev/reference/apis/js-apis-deque.md @@ -1,12 +1,12 @@ # Linear Container Deque -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```ts import Deque from '@ohos.util.Deque' ``` @@ -30,7 +30,7 @@ A constructor used to create a **Deque** instance. **Example** -``` +```ts let deque = new Deque(); ``` @@ -48,7 +48,7 @@ Inserts an entry at the front of this container. **Example** -``` +```ts let deque = new Deque(); deque.insertFront("a"); deque.insertFront(1); @@ -72,7 +72,7 @@ Inserts an entry at the end of this container. **Example** -``` +```ts let deque = new Deque(); deque.insertEnd("a"); deque.insertEnd(1); @@ -102,7 +102,7 @@ Checks whether this container has the specified entry. **Example** -``` +```ts let deque = new Deque(); let result = deque.has("Ahfbrgrbgnutfodgorrogorg"); deque.insertFront("Ahfbrgrbgnutfodgorrogorg"); @@ -123,7 +123,7 @@ Removes the first entry of this container. **Example** -``` +```ts let deque = new Deque(); deque.insertFront(2); deque.insertFront(4); @@ -147,7 +147,7 @@ Removes the last entry of this container. **Example** -``` +```ts let deque = new Deque(); deque.insertFront(2); deque.insertEnd(4); @@ -181,7 +181,7 @@ callbackfn **Example** -``` +```ts let deque = new Deque(); deque.insertFront(2); deque.insertEnd(4); @@ -206,7 +206,7 @@ Obtains the first entry of this container. **Example** -``` +```ts let deque = new Deque(); deque.insertEnd(2); deque.insertEnd(4); @@ -229,7 +229,7 @@ Obtains the last entry of this container. **Example** -``` +```ts let deque = new Deque(); deque.insertFront(2); deque.insertFront(4); @@ -252,7 +252,7 @@ Obtains an iterator, each item of which is a JavaScript object. | IterableIterator<T> | Iterator obtained.| **Example** -``` +```ts let deque = new Deque(); deque.insertFront(2); deque.insertFront(4); diff --git a/en/application-dev/reference/apis/js-apis-device-info.md b/en/application-dev/reference/apis/js-apis-device-info.md index 3c1a3efd773b126a4ce9e7d371c2946ddada0cf6..0f5dd2a794e92690820f12d6ab8e82e9f6b3b340 100644 --- a/en/application-dev/reference/apis/js-apis-device-info.md +++ b/en/application-dev/reference/apis/js-apis-device-info.md @@ -5,7 +5,7 @@ ## Modules to Import -``` +```ts import deviceInfo from '@ohos.deviceInfo' ``` diff --git a/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md b/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md index 934bcc66d070f4f2a484944d7427d38039332f33..a21180c8cc7778088cc25f7bc6f6a9a499ed5bc7 100644 --- a/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md +++ b/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md @@ -1,6 +1,7 @@ # Device Usage Statistics -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -20,10 +21,10 @@ Checks whether the application specified by **bundleName** is in the idle state. **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | bundleName | string | Yes| Bundle name of an application.| - | callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns whether the application specified by **bundleName** is in the idle state if the value of **bundleName** is valid; returns **null** otherwise.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| bundleName | string | Yes| Bundle name of an application.| +| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns whether the application specified by **bundleName** is in the idle state if the value of **bundleName** is valid; returns **null** otherwise.| **Example** @@ -47,19 +48,19 @@ Checks whether the application specified by **bundleName** is in the idle state. **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | bundleName | string | Yes| Bundle name of an application.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| bundleName | string | Yes| Bundle name of an application.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<boolean> | Promise used to return the result. Returns whether the application specified by **bundleName** is in the idle state if the value of **bundleName** is valid; returns **null** otherwise.| +| Type| Description| +| -------- | -------- | +| Promise<boolean> | Promise used to return the result. Returns whether the application specified by **bundleName** is in the idle state if the value of **bundleName** is valid; returns **null** otherwise.| **Example** - ``` + ```js bundleState.isIdleState("com.ohos.camera").then( res => { console.log('BUNDLE_ACTIVE isIdleState promise succeeded, result: ' + JSON.stringify(res)); }).catch( err => { @@ -77,13 +78,13 @@ Queries the priority group of the current invoker application. This API uses an **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<number> | Yes| Callback used to return the result.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<number> | Yes| Callback used to return the result.| **Example** - ``` + ```js bundleState.queryAppUsagePriorityGroup((err, res) => { if (err) { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback failed. because: ' + err.code); @@ -103,13 +104,13 @@ Queries the priority group of the current invoker application. This API uses a p **Return value** - | Type| Description| - | -------- | -------- | - | Promise<number> | Promise used to return the result.| +| Type| Description| +| -------- | -------- | +| Promise<number> | Promise used to return the result.| **Example** - ``` + ```js bundleState.queryAppUsagePriorityGroup().then( res => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise succeeded. result: ' + JSON.stringify(res)); }).catch( err => { @@ -129,15 +130,15 @@ Queries the application usage duration statistics based on the specified start t **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | begin | number | Yes| Start time.| - | end | number | Yes| End time.| - | callback | AsyncCallback<[BundleActiveInfoResponse](#bundleactiveinforesponse)> | Yes| Callback used to return the result.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| begin | number | Yes| Start time.| +| end | number | Yes| End time.| +| callback | AsyncCallback<[BundleActiveInfoResponse](#bundleactiveinforesponse)> | Yes| Callback used to return the result.| **Example** - ``` + ```js bundleState.queryBundleStateInfos(0, 20000000000000, (err, res) => { if (err) { console.log('BUNDLE_ACTIVE queryBundleStateInfos callback failed, because: ' + err.code); @@ -165,20 +166,20 @@ Queries the application usage duration statistics based on the specified start t **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | begin | number | Yes| Start time.| - | end | number | Yes| End time.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| begin | number | Yes| Start time.| +| end | number | Yes| End time.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<[BundleActiveInfoResponse](#bundleactiveinforesponse)> | Promise used to return the result.| +| Type| Description| +| -------- | -------- | +| Promise<[BundleActiveInfoResponse](#bundleactiveinforesponse)> | Promise used to return the result.| **Example** - ``` + ```js bundleState.queryBundleStateInfos(0, 20000000000000).then( res => { console.log('BUNDLE_ACTIVE queryBundleStateInfos promise success.'); let i = 1; @@ -204,16 +205,16 @@ Queries the application usage duration statistics in the specified time frame at **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | byInterval | [IntervalType](#intervaltype) | Yes| Interval type.| - | begin | number | Yes| Start time.| - | end | number | Yes| End time.| - | callback | AsyncCallback<Array<[BundleStateInfo](#bundlestateinfo)>> | Yes| Callback used to return the result.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| byInterval | [IntervalType](#intervaltype) | Yes| Interval type.| +| begin | number | Yes| Start time.| +| end | number | Yes| End time.| +| callback | AsyncCallback<Array<[BundleStateInfo](#bundlestateinfo)>> | Yes| Callback used to return the result.| **Example** - ``` + ```js bundleState.queryBundleStateInfoByInterval(0, 0, 20000000000000, (err, res) => { if (err) { console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback failed, because: ' + err.code); @@ -239,21 +240,21 @@ Queries the application usage duration statistics in the specified time frame at **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | byInterval | [IntervalType](#intervaltype) | Yes| Interval type.| - | begin | number | Yes| Start time.| - | end | number | Yes| End time.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| byInterval | [IntervalType](#intervaltype) | Yes| Interval type.| +| begin | number | Yes| Start time.| +| end | number | Yes| End time.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<Array<[BundleStateInfo](#bundlestateinfo)>> | Promise used to return the result.| +| Type| Description| +| -------- | -------- | +| Promise<Array<[BundleStateInfo](#bundlestateinfo)>> | Promise used to return the result.| **Example** - ``` + ```js bundleState.queryBundleStateInfoByInterval(0, 0, 20000000000000).then( res => { console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval promise success.'); for (let i = 0; i < res.length; i++) { @@ -277,15 +278,15 @@ Queries events of all applications based on the specified start time and end tim **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | begin | number | Yes| Start time.| - | end | number | Yes| End time.| - | callback | AsyncCallback<Array<[BundleActiveState](#bundleactivestate)>> | Yes| Callback used to return the result.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| begin | number | Yes| Start time.| +| end | number | Yes| End time.| +| callback | AsyncCallback<Array<[BundleActiveState](#bundleactivestate)>> | Yes| Callback used to return the result.| **Example** - ``` + ```js bundleState.queryBundleActiveStates(0, 20000000000000, (err, res) => { if (err) { console.log('BUNDLE_ACTIVE queryBundleActiveStates callback failed, because: ' + err.code); @@ -311,20 +312,20 @@ Queries events of all applications based on the specified start time and end tim **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | begin | number | Yes| Start time.| - | end | number | Yes| End time.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| begin | number | Yes| Start time.| +| end | number | Yes| End time.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<Array<[BundleActiveState](#bundleactivestate)>> | Promise used to return the result.| +| Type| Description| +| -------- | -------- | +| Promise<Array<[BundleActiveState](#bundleactivestate)>> | Promise used to return the result.| **Example** - ``` + ```js bundleState.queryBundleActiveStates(0, 20000000000000).then( res => { console.log('BUNDLE_ACTIVE queryBundleActiveStates promise success.'); for (let i = 0; i < res.length; i++) { @@ -346,15 +347,15 @@ Queries events of this application based on the specified start time and end tim **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | begin | number | Yes| Start time.| - | end | number | Yes| End time.| - | callback | AsyncCallback<Array<[BundleActiveState](#bundleactivestate)>> | Yes| Callback used to return the result.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| begin | number | Yes| Start time.| +| end | number | Yes| End time.| +| callback | AsyncCallback<Array<[BundleActiveState](#bundleactivestate)>> | Yes| Callback used to return the result.| **Example** - ``` + ```js bundleState.queryCurrentBundleActiveStates(0, 20000000000000, (err, res) => { if (err) { console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback failed, because: ' + err.code); @@ -378,20 +379,20 @@ Queries events of this application based on the specified start time and end tim **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | begin | number | Yes| Start time.| - | end | number | Yes| End time.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| begin | number | Yes| Start time.| +| end | number | Yes| End time.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<Array<[BundleActiveState](#bundleactivestate)>> | Promise used to return the result.| +| Type| Description| +| -------- | -------- | +| Promise<Array<[BundleActiveState](#bundleactivestate)>> | Promise used to return the result.| **Example** - ``` + ```js bundleState.queryCurrentBundleActiveStates(0, 20000000000000).then( res => { console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates promise success.'); for (let i = 0; i < res.length; i++) { @@ -403,6 +404,133 @@ Queries events of this application based on the specified start time and end tim }); ``` +## bundleState.getRecentlyUsedModules9+ + +getRecentlyUsedModules(maxNum: number): Promise<Array<BundleActiveModuleInfo>> + +Obtains the number of FA usage records specified by **maxNum**. This API uses a promise to return the records sorted by time (most recent first). + +**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO + +**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App + +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| maxNum | number | No| Maximum number of returned records. The maximum and default value is **1000**. If this parameter is not specified, **1000** is used.| + +**Return value** + +| Type| Description| +| -------- | -------- | +| Promise<Array<[BundleActiveModuleInfo](#bundleactivemoduleinfo9)>> | Promise used to return the result.| + +**Example** + + ```js + bundleState.getRecentlyUsedModules(this.maxNum).then( res => { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise succeeded'); + for (let i = 0; i < res.length; i++) { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise number : ' + (i + 1)); + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise result ' + JSON.stringify(res[i])); + } + }).catch( err=> { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise failed, because: ' + err.code); + }); + + // Invocation when maxNum is not passed + bundleState.getRecentlyUsedModules().then( res => { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise succeeded'); + for (let i = 0; i < res.length; i++) { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise number : ' + (i + 1)); + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise result ' + JSON.stringify(res[i])); + } + }).catch( err=> { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise failed, because: ' + err.code); + }); + ``` + +## bundleState.getRecentlyUsedModules9+ + +getRecentlyUsedModules(maxNum: number, callback: AsyncCallback<Array<BundleActiveModuleInfo>>): void + +Obtains the number of FA usage records specified by **maxNum**. This API uses an asynchronous callback to return the records sorted by time (most recent first). + +**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO + +**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App + +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| maxNum | number | No| Maximum number of returned records. The maximum and default value is **1000**. If this parameter is not specified, **1000** is used.| +| callback | AsyncCallback<Array<[BundleActiveModuleInfo](#bundleactivemoduleinfo9)>> | Yes| Callback used to return the result.| + +**Example** + + ```js + bundleState.getRecentlyUsedModules(this.maxNum,(err, res) => { + if(err) { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code); + } else { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback succeeded.'); + for (let i = 0; i < res.length; i++) { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback number : ' + (i + 1)); + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback result ' + JSON.stringify(res[i])); + } + } + }); + + // Invocation when maxNum is not passed + stats.getRecentlyUsedModules((err, res) => { + if(err) { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code); + } else { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback succeeded.'); + for (let i = 0; i < res.length; i++) { + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback number : ' + (i + 1)); + console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback result ' + JSON.stringify(res[i])); + } + } + }); + ``` + +## BundleActiveModuleInfo9+ +Provides the information about the FA usage. + +**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| deviceId | string | No| ID of the device to which the FA belongs.| +| bundleName | string | Yes| Name of the application bundle to which the FA belongs.| +| moduleName | string | Yes| Name of the module to which the FA belongs.| +| abilityName | string | No| **MainAbility** name of the FA.| +| appLabelId | number | No| Application label ID of the FA.| +| labelId | number | No| Label ID of the module to which the FA belongs.| +| descriptionId | number | No| Description ID of the application to which the FA belongs.| +| abilityLableId | number | No| **MainAbility** label ID of the FA.| +| abilityDescriptionId | number | No| **MainAbility** description ID of the FA.| +| abilityIconId | number | No| **MainAbility** icon ID of the FA.| +| launchedCount | number | Yes| Number of FA startup times.| +| lastModuleUsedTime | number | Yes| Last time when the FA is used.| +| formRecords | Array<[BundleActiveFormInfo](#bundleactiveforminfo9)> | Yes| Array of widget usage records in the FA.| + +## BundleActiveFormInfo9+ +Provides the FA widget usage information. + +**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| formName | number | Yes| Widget name.| +| formDimension | number | Yes| Widget dimensions.| +| formId | number | Yes| Widget ID.| +| formLastUsedTime | number | Yes| Last time when the widget was clicked.| +| count | number | Yes| Number of clicks on the widget.| + ## BundleStateInfo Provides the usage duration information of an application. @@ -435,9 +563,9 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | toMerge | [BundleStateInfo](#bundlestateinfo) | Yes| Application usage information to merge.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| toMerge | [BundleStateInfo](#bundlestateinfo) | Yes| Application usage information to merge.| ## BundleActiveState diff --git a/en/application-dev/reference/apis/js-apis-extension-context.md b/en/application-dev/reference/apis/js-apis-extension-context.md index 3a18f757b31e1e6ce33f31ae11f23c7ea840b0f8..51ce88f1cfd16bd960b2a14290d2d51481f2085e 100644 --- a/en/application-dev/reference/apis/js-apis-extension-context.md +++ b/en/application-dev/reference/apis/js-apis-extension-context.md @@ -1,7 +1,7 @@ # ExtensionContext -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. Implements the extension context. This module is inherited from **Context**. @@ -14,3 +14,4 @@ Implements the extension context. This module is inherited from **Context**. | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | | currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP. | +| config | Configuration | Yes| No| Module configuration information.| diff --git a/en/application-dev/reference/apis/js-apis-extensionrunninginfo.md b/en/application-dev/reference/apis/js-apis-extensionrunninginfo.md index f5f75e537f719657bed473a63899b15cae850f4b..fc1542d64377ca689f9a94314a5b488471679f17 100644 --- a/en/application-dev/reference/apis/js-apis-extensionrunninginfo.md +++ b/en/application-dev/reference/apis/js-apis-extensionrunninginfo.md @@ -1,7 +1,7 @@ # ExtensionRunningInfo -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> ![icon-note.gif](public_sys-resources/icon-note.gif) **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. Provides extension running information. diff --git a/en/application-dev/reference/apis/js-apis-filemanager.md b/en/application-dev/reference/apis/js-apis-filemanager.md index fe5143ca5a4415bc01cc388b2859f1c59800568c..b7e33e70ef01cec6ed41308fbc2f102ef2176c28 100644 --- a/en/application-dev/reference/apis/js-apis-filemanager.md +++ b/en/application-dev/reference/apis/js-apis-filemanager.md @@ -1,8 +1,9 @@ -# Public File Access and Management ->![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE:** +# User File Access and Management +>![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> >- The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. >- The APIs of this module are system APIs and cannot be called by third-party applications. Currently, these APIs can be called only by **filepicker**. + ## Modules to Import ```js @@ -13,40 +14,40 @@ import filemanager from '@ohos.fileManager'; getRoot(options? : {dev? : DevInfo}) : Promise<FileInfo[]> -Obtains information about the files in the first-level directory in asynchronous mode. This method uses a promise to return the result. +Obtains information about the root album or directory in asynchronous mode. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.FileManagerService - Parameters | Name| Type| Mandatory| Description| | --- | --- | --- | -- | - | dev | [DevInfo](#devinfo) | No| Device name. The default value is **local**, which is the only value supported.| + | options | Object | No| The options are as follows:
-  **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.| - Return value | Type| Description| | --- | -- | - | Promise<[FileInfo](#fileinfo)[]> | Promise used to return the file information obtained.| + | Promise<[FileInfo](#fileinfo)[]> | Promise used to return the root album or directory information obtained.| - Example -```js -filemanager.getRoot().then((fileInfo) => { - if(Array.isArray(fileInfo)) { - for (var i = 0; i < fileInfo.length; i++) { - console.log(JSON.Stringify(fileInfo)) - } - } -}).catch((err) => { - console.log(err) -}); -``` + ```js + filemanager.getRoot().then((fileInfo) => { + if(Array.isArray(fileInfo)) { + for (var i = 0; i < fileInfo.length; i++) { + console.log("file:"+JSON.stringify(fileInfo)); + } + } + }).catch((err) => { + console.log(err) + }); + ``` ## filemanager.getRoot getRoot(options? : {dev? : DevInfo}, callback : AsyncCallback<FileInfo[]>) : void -Obtains information about the files in the first-level directory in asynchronous mode. This method uses a callback to return the result. +Obtains information about the root album or directory in asynchronous mode. This API uses a callback to return the result. **System capability**: SystemCapability.FileManagement.FileManagerService @@ -54,71 +55,72 @@ Obtains information about the files in the first-level directory in asynchronous | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ----------------------------- | - | dev | [DevInfo](#devinfo) | No | Device name. The default value is **local**, which is the only value supported.| - | callback | AsyncCallback<[FileInfo](#fileinfo)[]> | Yes | Callback invoked to return the file information obtained. | + | options | Object | No| The options are as follows:
-  **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.| + | callback | AsyncCallback<[FileInfo](#fileinfo)[]> | Yes | Callback invoked to return the root album or directory information obtained. | - Example -```js -filemanager.getRoot((err, fileInfo) => { - if(Array.isArray(fileInfo)) { - for (var i = 0; i < fileInfo.length; i++) { - console.log(JSON.Stringify(fileInfo)) - } - } -}) -``` + ```js + filemanager.getRoot((err, fileInfo) => { + if(Array.isArray(fileInfo)) { + for (var i = 0; i < fileInfo.length; i++) { + console.log("file:"+JSON.stringify(fileInfo)); + } + } + }); + ``` ## filemanager.listFile listFile(path : string, type : string, options? : {dev? : DevInfo, offset? : number, count? : number}) : Promise<FileInfo[]> -Obtains information about the files in the second-level directory in asynchronous mode. This method uses a promise to return the result. +Obtains information about the second-level album or files in asynchronous mode. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.FileManagerService - Parameters | Name| Type| Mandatory| Description| | --- | --- | --- | -- | - | type | string | Yes| Type of the files to query. The file type can be **file**, **image**, **audio**, or **video**.| | path | string | Yes| URI of the directory to query.| - | dev | [DevInfo](#devinfo) | Yes| Device name. The default value is **local**, which is the only value supported.| - | offset | number | No| Start position from which the files are to query.| - | count | number | No| Number of files to query.| - + | type | string | Yes| Type of the files to query. The file type can be **file**, **image**, **audio**, or **video**.| + | options | Object | No| The options are as follows:
-  **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.
-  **offset**: position to start the query. The value is a number.
-  **count**: number of files to query.| + - Return value | Type| Description| | --- | -- | - | Promise<FileInfo[]> | Promise used to return the file information obtained.| + | Promise<FileInfo[]> | Promise used to return the album or file information obtained.| - Error | Error Info| Error Code|Description| - | -- | --- | -- | - |No such file or directory | 2 | The directory or file of the specified URI does not exist.| - |No such process | 3 | Failed to obtain the FMS service.| - |Not a directory | 20 | The object specified by the URI is not a directory.| + | -- | --- | -- | + | No such file or directory | 2 | The directory or album of the specified URI does not exist.| + | No such process | 3 | Failed to obtain the FMS service.| + | Not a directory | 20 | The object specified by the URI is not a directory or album.| + +- Example + + ```js + // Obtain all files in the directory. + // Call listFile() and getRoot() to obtain the file URI. + let media_path = file.uri + filemanager.listFile(media_path, "file") + .then((fileInfo) => { + if(Array.isArray(fileInfo)) { + for (var i = 0; i < fileInfo.length; i++) { + console.log("file:"+JSON.stringify(fileInfo)); + } + } + }).catch((err) => { + console.log(err) + }); + ``` -```js -// Obtain all files in the directory. -// Call listFile() and getRoot() to obtain file URIs. -let media_path = file.uri -filemanager.listFile(media_path, "file") -.then((fileInfo) => { - if(Array.isArray(fileInfo)) { - for (var i = 0; i < fileInfo.length; i++) { - console.log(JSON.Stringify(fileInfo)) - } - } -}).catch((err) => { - console.log(err) -}) -``` ## filemanager.listFile listFile(path : string, type : string, options? : {dev? : DevInfo, offset? : number, count? : number}, callback : AsyncCallback<FileInfo[]>) : void -Obtains information about the files in the second-level directory in asynchronous mode. This method uses a callback to return the result. +Obtains information about the second-level album or files in asynchronous mode. This API uses a callback to return the result. **System capability**: SystemCapability.FileManagement.FileManagerService @@ -126,37 +128,37 @@ Obtains information about the files in the second-level directory in asynchronou | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | - | type | string | Yes | Type of the files to query. The file type can be **file**, **image**, **audio**, or **video**.| | path | string | Yes | URI of the directory to query. | - | dev | [DevInfo](#devinfo) | No| Device name. The default value is **local**, which is the only value supported.| - | offset | number | No| Start position from which the files are to query.| - | count | number | No| Number of files to query.| + | type | string | Yes | Type of the files to query. The file type can be **file**, **image**, **audio**, or **video**.| + | options | Object | No| The options are as follows:
-  **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.
-  **offset**: position to start the query. The value is a number.
-  **count**: number of files to query.| | callback | AsyncCallback<[FileInfo](#fileinfo)[]> | Yes | Callback invoked to return the file information obtained. | - Error | Error Info | Error Code| Description | | ------------------------- | ------ | ------------------------- | - |No such file or directory | 2 | The directory or file of the specified URI does not exist.| - |No such process | 3 | Failed to obtain the FMS service. | - |Not a directory | 20 | The object specified by the URI is not a directory.| + | No such file or directory | 2 | The directory or album of the specified URI does not exist.| + | No such process | 3 | Failed to obtain the FMS service. | + | Not a directory | 20 | The object specified by the URI is not a directory or album.| -```js -// Call listFile() and getRoot() to obtain the file URIs. -let media_path = file.uri -filemanager.listFile(media_path, "file", (err, fileInfo) => { - if(Array.isArray(fileInfo)) { - for (var i = 0; i < fileInfo.length; i++) { - console.log(JSON.Stringify(fileInfo)) - } - } -}) -``` +- Example + + ```js + // Call listFile() and getRoot() to obtain the file URI. + let media_path = file.uri + filemanager.listFile(media_path, "file", (err, fileInfo) => { + if(Array.isArray(fileInfo)) { + for (var i = 0; i < fileInfo.length; i++) { + console.log("file:"+JSON.stringify(fileInfo)); + } + } + }); + ``` ## filemanager.createFile -filemanager.createFile(path : string, filename : string, options? : {dev? : DevInfo}) : promise<string> +filemanager.createFile(path : string, filename : string, options? : {dev? : DevInfo}) : Promise<string> -Creates a file in the specified path in asynchronous mode. This method uses a promise to return the result. +Creates a file in the specified path in asynchronous mode. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.FileManagerService @@ -165,7 +167,7 @@ Creates a file in the specified path in asynchronous mode. This method uses a pr | --- | --- | --- | -- | | filename | string | Yes| Name of the file to create.| | path | string | Yes| URI of the file to create.| - | dev | [DevInfo](#devinfo) | No| Device name. The default value is **local**, which is the only value supported.| + | options | Object | No| The options are as follows:
-  **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.| - Return value @@ -177,28 +179,29 @@ Creates a file in the specified path in asynchronous mode. This method uses a pr | Error Info| Error Code|Description| | -- | --- | -- | | Operation not permitted | 1 | A file with the same name already exists.| - | No such file or directory | 2 | The directory or file of the specified URI does not exist.| + | No such file or directory | 2 | The directory or album of the specified URI does not exist.| | No such process | 3 | Failed to obtain the FMS service.| - | Not a directory | 20 | The object specified by the URI is not a directory.| + | Not a directory | 20 | The object specified by the URI is not a directory or album.| -```js -// Create a file. -let media_path = file.uri // Obtain the file URI using listFile() and getRoot(). -let name = "xxx.jpg" // File to be saved. -filemanager.createFile(media_path, name) -.then((uri) => { -// The URI of the file created is returned. -}) -.catch((err) => { - console.log(err) -}) -``` +- Example + + ```js + // Create a file. + let media_path = file.uri // Obtain the file URI using listFile() and getRoot(). + let name = "xxx.jpg" // File to be saved. + filemanager.createFile(media_path, name).then((uri) => { + // The URI of the file created is returned. + console.log("file uri:"+uri); + }).catch((err) => { + console.log(err); + }); + ``` ## filemanager.createFile createFile(path : string, filename: string, options? : {dev? : DevInfo}, callback : AsyncCallback<string>) : void -Creates a file in the specified path in asynchronous mode. This method uses a callback to return the result. +Creates a file in the specified path in asynchronous mode. This API uses a callback to return the result. **System capability**: SystemCapability.FileManagement.FileManagerService @@ -208,7 +211,7 @@ Creates a file in the specified path in asynchronous mode. This method uses a ca | -------- | ------------------------- | ---- | ----------------------------- | | filename | string | Yes | Name of the file to create. | | path | string | Yes | URI of the file to create. | - | dev | [DevInfo](#devinfo) | No| Device name. The default value is **local**, which is the only value supported.| + | options | Object | No| The options are as follows:
-  **dev**: See [DevInfo](#devinfo). It is **dev = {name: "local"}** by default if not specified. Currently, only 'local' is supported.| | callback | AsyncCallback<[FileInfo](#fileinfo)[]> | Yes | Callback invoked to return the file information obtained. | - Error @@ -216,20 +219,23 @@ Creates a file in the specified path in asynchronous mode. This method uses a ca | Error Info | Error Code| Description | | ------------------------- | ------ | ------------------------- | | Operation not permitted | 1 | A file with the same name already exists. | - | No such file or directory | 2 | The directory or file of the specified URI does not exist.| + | No such file or directory | 2 | The directory or album of the specified URI does not exist.| | No such process | 3 | Failed to obtain the FMS service. | - | Not a directory | 20 | The object specified by the URI is not a directory.| + | Not a directory | 20 | The object specified by the URI is not a directory or album.| -```js -// Create a file. -// Call listFile() and getRoot() to obtain the file URI. -let media_path = file.uri -// File to be saved. -let name = "xxx.jpg" -filemanager.createFile(media_path, name, (err, uri) => { -// The URI of the file created is returned. -}) -``` +- Example + + ```js + // Create a file. + // Call listFile() and getRoot() to obtain the file URI. + let media_path = file.uri + // File to be saved. + let name = "xxx.jpg" + filemanager.createFile(media_path, name, (err, uri) => { + // The URI of the file created is returned. + console.log("file uri:"+uri); + }); + ``` ## FileInfo Defines the file information returned by **getRoot()** or **listFile()**. @@ -248,12 +254,13 @@ Defines the file information returned by **getRoot()** or **listFile()**. | modifiedTime | number | Yes| No| Time when the file was modified.| ## DevInfo + Defines the device type. **System capability**: SystemCapability.FileManagement.FileManagerService ### Attributes - | Name| Type| Readable| Writable| Description| - | --- | -- | -- | -- | -- | - | name | string | Yes| Yes| Device name.| +| Name| Type | Readable| Writable| Description | +| ------ | ------ | ---- | ---- | -------- | +| name | string | Yes | Yes | Device name.| diff --git a/en/application-dev/reference/apis/js-apis-formextensioncontext.md b/en/application-dev/reference/apis/js-apis-formextensioncontext.md index faa3bd6c6f82018ca61c9ba1f008dbc1e72dae9f..c4eb1e6ae45c9352c9c099692d32c68613f28d39 100644 --- a/en/application-dev/reference/apis/js-apis-formextensioncontext.md +++ b/en/application-dev/reference/apis/js-apis-formextensioncontext.md @@ -1,7 +1,7 @@ # FormExtensionContext -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. Implements the context that provides the capabilities and APIs of **FormExtension**. This class is inherited from **ExtensionContext**. diff --git a/en/application-dev/reference/apis/js-apis-hashmap.md b/en/application-dev/reference/apis/js-apis-hashmap.md index 612f81c27952b106218a84edb569c09a23203863..434f68b4b0324fe381961d64a00babcbba7d1d98 100644 --- a/en/application-dev/reference/apis/js-apis-hashmap.md +++ b/en/application-dev/reference/apis/js-apis-hashmap.md @@ -1,12 +1,12 @@ # Nonlinear Container HashMap -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```ts import HashMap from '@ohos.util.HashMap' ``` @@ -32,7 +32,7 @@ A constructor used to create a **HashMap** instance. **Example** -``` +```ts let hashMap = new HashMap(); ``` @@ -51,7 +51,7 @@ Checks whether this container is empty (contains no entry). **Example** -``` +```ts const hashMap = new HashMap(); let result = hashMap.isEmpty(); ``` @@ -77,7 +77,7 @@ Checks whether this container contains the specified key. **Example** -``` +```ts let hashMap = new HashMap(); let result = hashMap.hasKey("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); @@ -105,7 +105,7 @@ Checks whether this container contains the specified value. **Example** -``` +```ts let hashMap = new HashMap(); let result = hashMap.hasValue(123); hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); @@ -133,7 +133,7 @@ Obtains the value of the specified key in this container. **Example** -``` +```ts let hashMap = new HashMap(); hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); hashMap.set("sdfs", 356); @@ -155,7 +155,7 @@ Adds all entries in a **HashMap** instance to this container. **Example** -``` +```ts let hashMap = new HashMap(); hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); hashMap.set("sdfs", 356); @@ -185,7 +185,7 @@ Adds an entry to this container. **Example** -``` +```ts let hashMap = new HashMap(); let result = hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); ``` @@ -211,7 +211,7 @@ Removes an entry with the specified key from this container. **Example** -``` +```ts let hashMap = new HashMap(); hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); hashMap.set("sdfs", 356); @@ -227,7 +227,7 @@ Clears this container and sets its length to **0**. **Example** -``` +```ts let hashMap = new HashMap(); hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); hashMap.set("sdfs", 356); @@ -249,7 +249,7 @@ Obtains an iterator that contains all the entries in this container. **Example** -``` +```ts let hashMap = new HashMap(); hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); hashMap.set("sdfs", 356); @@ -276,7 +276,7 @@ Obtains an iterator that contains all the values in this container. **Example** -``` +```ts let hashMap = new HashMap(); hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); hashMap.set("sdfs", 356); @@ -310,7 +310,7 @@ Replaces an entry in this container. **Example** -``` +```ts let hashMap = new HashMap(); hashMap.set("sdfs", 123); let result = hashMap.replace("sdfs", 357); @@ -339,7 +339,7 @@ callbackfn **Example** -``` +```ts let hashMap = new HashMap(); hashMap.set("sdfs", 123); hashMap.set("dfsghsf", 357); @@ -363,7 +363,7 @@ Obtains an iterator that contains all the entries in this container. **Example** -``` +```ts let hashMap = new HashMap(); hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); hashMap.set("sdfs", 356); @@ -390,7 +390,7 @@ Obtains an iterator, each item of which is a JavaScript object. | IterableIterator<[K, V]> | Iterator obtained.| **Example** -``` +```ts let hashMap = new HashMap(); hashMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); hashMap.set("sdfs", 356); diff --git a/en/application-dev/reference/apis/js-apis-hashset.md b/en/application-dev/reference/apis/js-apis-hashset.md index 4e33216b1a17ff78364fddc103de84035f5d3a74..605aa184364b76c5695390db18d63bcf6cbff689 100644 --- a/en/application-dev/reference/apis/js-apis-hashset.md +++ b/en/application-dev/reference/apis/js-apis-hashset.md @@ -1,12 +1,12 @@ # Nonlinear Container HashSet -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```ts import HashSet from '@ohos.util.HashSet'; ``` @@ -32,7 +32,7 @@ A constructor used to create a **HashSet** instance. **Example** -``` +```ts let hashSet = new HashSet(); ``` @@ -51,9 +51,9 @@ Checks whether this container is empty (contains no entry). **Example** -``` +```ts const hashSet = new HashSet(); -hashSet.isEmpty(); +let result = hashSet.isEmpty(); ``` @@ -77,7 +77,7 @@ Checks whether this container contains the specified entry. **Example** -``` +```ts let hashSet = new HashSet(); let result = hashSet.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); @@ -105,7 +105,7 @@ Adds an entry to this container. **Example** -``` +```ts let hashSet = new HashSet(); let result = hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); ``` @@ -131,7 +131,7 @@ Removes an entry from this container. **Example** -``` +```ts let hashSet = new HashSet(); hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); hashSet.add("sdfs"); @@ -147,7 +147,7 @@ Clears this container and sets its length to **0**. **Example** -``` +```ts let hashSet = new HashSet(); hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); hashSet.add("sdfs"); @@ -169,7 +169,7 @@ Obtains an iterator that contains all the values in this container. **Example** -``` +```ts let hashSet = new HashSet(); hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); hashSet.add("sdfs"); @@ -204,7 +204,7 @@ callbackfn **Example** -``` +```ts let hashSet = new HashSet(); hashSet.add("sdfs"); hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); @@ -227,7 +227,7 @@ Obtains an iterator that contains all the entries in this container. **Example** -``` +```ts let hashSet = new HashSet(); hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); hashSet.add("sdfs"); @@ -255,7 +255,7 @@ Obtains an iterator, each item of which is a JavaScript object. **Example** -``` +```ts let hashSet = new HashSet(); hashSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); hashSet.add("sdfs"); diff --git a/en/application-dev/reference/apis/js-apis-hidebug.md b/en/application-dev/reference/apis/js-apis-hidebug.md index c0844b51cbcc220251492c04c2d2d222b0f7f018..8aa9c1e22f1982ad58d03bed71ff30eaf05be50b 100644 --- a/en/application-dev/reference/apis/js-apis-hidebug.md +++ b/en/application-dev/reference/apis/js-apis-hidebug.md @@ -7,7 +7,7 @@ You can run the hidebug command to obtain the memory usage of an application, in ## Modules to Import -``` +```js import hidebug from '@ohos.hidebug'; ``` @@ -28,7 +28,7 @@ Obtains the total size of the native heap memory. **Example** - ``` + ```js let nativeHeapSize = hidebug.getNativeHeapSize(); ``` @@ -49,7 +49,7 @@ Obtains the size of the allocated native heap memory. **Example** - ``` + ```js let nativeHeapAllocatedSize = hidebug.getNativeHeapAllocatedSize(); ``` @@ -70,7 +70,7 @@ Obtains the size of the free native heap memory. **Example** - ``` + ```js let nativeHeapFreeSize = hidebug.getNativeHeapFreeSize(); ``` @@ -91,7 +91,7 @@ Obtains the PSS of this process. **Example** - ``` + ```js let pss = hidebug.getPss(); ``` @@ -112,7 +112,7 @@ Obtains the size of the shared dirty memory of this process. **Example** - ``` + ```js let sharedDirty = hidebug.getSharedDirty(); ``` diff --git a/en/application-dev/reference/apis/js-apis-huks.md b/en/application-dev/reference/apis/js-apis-huks.md index 790802ba3422dee736f7a6d08ec910b97c9e24b2..9a2faa3d931c963dcaebf85ce286c3278423dd0f 100644 --- a/en/application-dev/reference/apis/js-apis-huks.md +++ b/en/application-dev/reference/apis/js-apis-huks.md @@ -14,7 +14,7 @@ import huks from '@ohos.security.huks' ``` ## HuksErrorCode -Enumerates error codes. +Enumerates the error codes. **System capability**: SystemCapability.Security.Huks @@ -29,7 +29,7 @@ Enumerates error codes. | HUKS_ERROR_INSUFFICIENT_DATA | -6 |Insufficient data.| | HUKS_ERROR_BUFFER_TOO_SMALL | -7 |Insufficient buffer.| | HUKS_ERROR_INSUFFICIENT_MEMORY | -8 |Insufficient memory.| -| HUKS_ERROR_COMMUNICATION_FAILURE | -9 |Communication failed.| +| HUKS_ERROR_COMMUNICATION_FAILURE | -9 |Communication failure.| | HUKS_ERROR_STORAGE_FAILURE | -10 |Storage failure.| | HUKS_ERROR_HARDWARE_FAILURE | -11 |Hardware fault.| | HUKS_ERROR_ALREADY_EXISTS | -12 |The object already exists.| @@ -91,7 +91,7 @@ Enumerates error codes. ## HuksKeyPurpose -Represents the purpose (usage) of a key. +Enumerates the key purposes. **System capability**: SystemCapability.Security.Huks @@ -103,7 +103,7 @@ Represents the purpose (usage) of a key. | HUKS_KEY_PURPOSE_VERIFY | 8 | The key is used to verify the signed data. | | HUKS_KEY_PURPOSE_DERIVE | 16 | The key is used to derive a key. | | HUKS_KEY_PURPOSE_WRAP | 32 | The key is used for encrypted import. | -| HUKS_KEY_PURPOSE_UNWRAP | 64 | The key is exported in encrypted mode. | +| HUKS_KEY_PURPOSE_UNWRAP | 64 | The key is used for encrypted export. | | HUKS_KEY_PURPOSE_MAC | 128 | The key is used to generate a message authentication code (MAC). | | HUKS_KEY_PURPOSE_AGREE | 256 | The key is used for key agreement. | @@ -135,8 +135,8 @@ Enumerates the padding algorithms. | HUKS_PADDING_OAEP | 1 | Optimal Asymmetric Encryption Padding (OAEP).| | HUKS_PADDING_PSS | 2 | Probabilistic Signature Scheme (PSS).| | HUKS_PADDING_PKCS1_V1_5 | 3 | PKCS1_V1_5.| -| HUKS_PADDING_PKCS5 | 4 | Public Key Cryptography Standards (PKCS)#5.| -| HUKS_PADDING_PKCS7 | 5 | PKCS#7| +| HUKS_PADDING_PKCS5 | 4 | Public Key Cryptography Standards (PKCS) #5.| +| HUKS_PADDING_PKCS7 | 5 | PKCS #7| ## HuksCipherMode @@ -155,7 +155,7 @@ Enumerates the cipher modes. ## HuksKeySize -Represents the key length. +Enumerates the key sizes. **System capability**: SystemCapability.Security.Huks @@ -182,7 +182,7 @@ Represents the key length. ## HuksKeyAlg -Represents the algorithm used by a key. +Enumerates the key algorithms. **System capability**: SystemCapability.Security.Huks @@ -244,8 +244,8 @@ Enumerates the tag transfer modes. | Name | Value | Description | | -------------------- | ---- | ----------------- | -| HUKS_SEND_TYPE_ASYNC | 0 | Send the tag asynchronously.| -| HUKS_SEND_TYPE_SYNC | 1 | Send the tag synchronously.| +| HUKS_SEND_TYPE_ASYNC | 0 | The tag is sent asynchronously.| +| HUKS_SEND_TYPE_SYNC | 1 | The tag is sent synchronously.| ## HuksTagType @@ -274,7 +274,7 @@ Enumerates the tags used to invoke parameters. | HUKS_TAG_INVALID | HuksTagType.HUKS_TAG_TYPE_INVALID \| 0 | Invalid tag. | | HUKS_TAG_ALGORITHM | HUKS_TAG_TYPE_UINT \| 1 | Indicates the algorithm. | | HUKS_TAG_PURPOSE | HuksTagType.HUKS_TAG_TYPE_UINT \| 2 | Indicates the purpose of a key. | -| HUKS_TAG_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 3 | Indicates the key length. | +| HUKS_TAG_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 3 | Indicates the key size. | | HUKS_TAG_DIGEST | HuksTagType.HUKS_TAG_TYPE_UINT \| 4 | Indicates the digest algorithm. | | HUKS_TAG_PADDING | HuksTagType.HUKS_TAG_TYPE_UINT \| 5 | Indicates the padding algorithm. | | HUKS_TAG_BLOCK_MODE | HuksTagType.HUKS_TAG_TYPE_UINT \| 6 | Indicates the cipher mode. | @@ -321,7 +321,7 @@ Enumerates the tags used to invoke parameters. | HUKS_TAG_ATTESTATION_ID_UDID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 513 | Indicates the device UDID. | | HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 514 | Indicates the security credential used for the attestation. | | HUKS_TAG_ATTESTATION_ID_VERSION_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 515 | Indicates the version information used in the attestation. | -| HUKS_TAG_IS_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1001 | Indicates whether to use the tag of the alias passed during key generation.| +| HUKS_TAG_IS_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1001 | Indicates whether to use the alias passed in during key generation.| | HUKS_TAG_KEY_STORAGE_FLAG | HuksTagType.HUKS_TAG_TYPE_UINT \| 1002 | Indicates the key storage mode. | | HUKS_TAG_IS_ALLOWED_WRAP | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1003 | Reserved. | | HUKS_TAG_KEY_WRAP_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1004 | Reserved. | @@ -352,7 +352,7 @@ Enumerates the tags used to invoke parameters. generateKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\) : void -Generates a key. This method uses an asynchronous callback to return the result. +Generates a key. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Security.Huks @@ -362,7 +362,7 @@ Generates a key. This method uses an asynchronous callback to return the result. | -------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | | keyAlias | string | Yes | Alias of the key. | | options | [HuksOptions](#huksoptions) | Yes | Tags required for generating the key. | -| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If any other result is returned, see **HuksResult**.| +| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code defined in **HuksResult** will be returned.| **Example** @@ -402,7 +402,7 @@ huks.generateKey(keyAlias, options, function (err, data){}); generateKey(keyAlias: string, options: HuksOptions) : Promise\ -Generates a key. This method uses a promise to return the result. +Generates a key. This API uses a promise to return the result. **System capability**: SystemCapability.Security.Huks @@ -453,7 +453,7 @@ var result = huks.generateKey(keyAlias, options); deleteKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\) : void -Deletes a key. This method uses an asynchronous callback to return the result. +Deletes a key. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Security.Huks @@ -463,7 +463,7 @@ Deletes a key. This method uses an asynchronous callback to return the result. | -------- | ----------------------------------------- | ---- | -------------------------------------------------- | | keyAlias | string | Yes | Key alias passed in when the key was generated. | | options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). | -| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code will be returned. For details about the error codes, see **HuksResult**.| +| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code will be returned.| **Example** @@ -480,7 +480,7 @@ huks.deleteKey(keyAlias, emptyOptions, function (err, data) {}); deleteKey(keyAlias: string, options: HuksOptions) : Promise\ -Deletes a key. This method uses a promise to return the result. +Deletes a key. This API uses a promise to return the result. **System capability**: SystemCapability.Security.Huks @@ -542,7 +542,7 @@ var result = huks.getSdkVersion(emptyOptions); importKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\) : void -Imports a key. This method uses an asynchronous callback to return the result. +Imports a key. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Security.Huks @@ -552,7 +552,7 @@ Imports a key. This method uses an asynchronous callback to return the result. | -------- | ------------------------ | ---- | ------------------------------------------------- | | keyAlias | string | Yes | Key alias, which is used to hold the key pair.| | options | [HuksOptions](#huksoptions) | Yes | Tags required for the import and key pair to import.| -| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code will be returned. For details about the error codes, see **HuksResult**.| +| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code will be returned.| **Example** @@ -600,7 +600,7 @@ huks.importKey(keyAlias, options, function (err, data){}); importKey(keyAlias: string, options: HuksOptions) : Promise\ -Imports a key. This method uses a promise to return the result. +Imports a key. This API uses a promise to return the result. **System capability**: SystemCapability.Security.Huks @@ -665,7 +665,7 @@ var result = huks.importKey(keyAlias, huksoptions); exportKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\) : void -Exports a key. This method uses an asynchronous callback to return the result. +Exports a key. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Security.Huks @@ -692,7 +692,7 @@ huks.exportKey(keyAlias, emptyOptions, function (err, data){}); exportKey(keyAlias: string, options: HuksOptions) : Promise\ -Exports a key. This method uses a promise to return the result. +Exports a key. This API uses a promise to return the result. **System capability**: SystemCapability.Security.Huks @@ -707,7 +707,7 @@ Exports a key. This method uses a promise to return the result. | Type | Description | | ----------------------------------- | ------------------------------------------------------------ | -| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code will be returned. For details about the error codes, see **HuksResult**.
**outData** contains the public key exported.| +| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code will be returned. **outData** contains the public key exported.| **Example** @@ -724,7 +724,7 @@ var result = huks.exportKey(keyAlias, emptyOptions); getKeyProperties(keyAlias: string, options: HuksOptions, callback: AsyncCallback\) : void -Obtains key properties. This method uses an asynchronous callback to return the result. +Obtains key properties. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Security.Huks @@ -751,7 +751,7 @@ huks.getKeyProperties(keyAlias, emptyOptions, function (err, data){}); getKeyProperties(keyAlias: string, options: HuksOptions) : Promise\ -Obtains key properties. This method uses a promise to return the result. +Obtains key properties. This API uses a promise to return the result. **System capability**: SystemCapability.Security.Huks @@ -783,7 +783,7 @@ var result = huks.getKeyProperties(keyAlias, emptyOptions); isKeyExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback\) : void -Checks whether a key exists. This method uses an asynchronous callback to return the result. +Checks whether a key exists. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Security.Huks @@ -810,7 +810,7 @@ huks.isKeyExist(keyAlias, emptyOptions, function (err, data){}); isKeyExist(keyAlias: string, options: HuksOptions) : Promise\ -Checks whether a key exists. This method uses a promise to return the result. +Checks whether a key exists. This API uses a promise to return the result. **System capability**: SystemCapability.Security.Huks @@ -844,7 +844,7 @@ var result = huks.isKeyExist(keyAlias, emptyOptions); init(keyAlias: string, options: HuksOptions, callback: AsyncCallback\) : void -Initializes a key. This method uses an asynchronous callback to return the result. +Initializes a key. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Security.Huks @@ -853,15 +853,15 @@ Initializes a key. This method uses an asynchronous callback to return the resul | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------- | | keyAlias | string | Yes | Alias of the target key.| -| options | [HuksOptions](#huksoptions) | Yes | Parameter set of the **Init** operation.| -| callback | AsyncCallback\<[HuksHandle](#hukshandle)> | Yes | Callback used to return the handle of the **Init** operation.| +| options | [HuksOptions](#huksoptions) | Yes | Parameters used for initialization.| +| callback | AsyncCallback\<[HuksHandle](#hukshandle)> | Yes | Callback used to return the handle of the initialization operation.| ## huks.init init(keyAlias: string, options: HuksOptions) : Promise\ -Initializes a key. This method uses a promise to return the result. +Initializes a key. This API uses a promise to return the result. **System capability**: SystemCapability.Security.Huks @@ -870,15 +870,15 @@ Initializes a key. This method uses a promise to return the result. | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------- | | keyAlias | string | Yes | Alias of the target key.| -| options | [HuksOptions](#huksoptions) | Yes | Parameter set of the **Init** operation.| -| promise | Promise\<[HuksHandle](#hukshandle)> | Yes | Promise used to return the handle of the **Init** operation.| +| options | [HuksOptions](#huksoptions) | Yes | Parameters used for initialization.| +| promise | Promise\<[HuksHandle](#hukshandle)> | Yes | Promise used to return the handle of the initialization operation.| ## huks.update update(handle: number, token?: Uint8Array, options: HuksOptions, callback: AsyncCallback\) : void -Updates a key. This method uses an asynchronous callback to return the result. +Updates a key. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Security.Huks @@ -888,7 +888,7 @@ Updates a key. This method uses an asynchronous callback to return the result. | -------- | ---------------------- | ---- | ------------------------------------- | | handle | number | Yes | Handle of the **Update** operation.| | token | Uint8Array | No| Token of the **Update** operation.| -| options | [HuksOptions](#huksoptions) | Yes | Parameter set of the **Update** operation.| +| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation.| | callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes| Callback used to return the operation result.| @@ -896,7 +896,7 @@ Updates a key. This method uses an asynchronous callback to return the result. update(handle: number, token?: Uint8Array, options: HuksOptions) : Promise\ -Updates a key. This method uses a promise to return the result. +Updates a key. This API uses a promise to return the result. **System capability**: SystemCapability.Security.Huks @@ -906,7 +906,7 @@ Updates a key. This method uses a promise to return the result. | -------- | ---------------------- | ---- | ------------------------------------- | | handle | number | Yes | Handle of the **Update** operation.| | token | Uint8Array | No| Token of the **Update** operation.| -| options | [HuksOptions](#huksoptions) | Yes | Parameter set of the **Update** operation.| +| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation.| | promise | Promise\<[HuksResult](#huksresult)> | Yes| Promise used to return the operation result.| @@ -914,7 +914,7 @@ Updates a key. This method uses a promise to return the result. finish(handle: number, options: HuksOptions, callback: AsyncCallback\) : void -Completes the key operation and releases resources. This method uses an asynchronous callback to return the result. +Completes the key operation and releases resources. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Security.Huks @@ -923,7 +923,7 @@ Completes the key operation and releases resources. This method uses an asynchro | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------- | | handle | number | Yes | Handle of the **Finish** operation.| -| options | [HuksOptions](#huksoptions) | Yes | Parameter set of the **Finish** operation.| +| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation.| | callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes| Callback used to return the operation result.| @@ -931,7 +931,7 @@ Completes the key operation and releases resources. This method uses an asynchro finish(handle: number, options: HuksOptions) : Promise\ -Completes the key operation and releases resources. This method uses a promise to return the result. +Completes the key operation and releases resources. This API uses a promise to return the result. **System capability**: SystemCapability.Security.Huks @@ -940,7 +940,7 @@ Completes the key operation and releases resources. This method uses a promise t | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------- | | handle | number | Yes | Handle of the **Finish** operation.| -| options | [HuksOptions](#huksoptions) | Yes | Parameter set of the **Finish** operation.| +| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation.| | promise | Promise\<[HuksResult](#HuksResult)> | Yes| Promise used to return the operation result.| @@ -948,7 +948,7 @@ Completes the key operation and releases resources. This method uses a promise t abort(handle: number, options: HuksOptions, callback: AsyncCallback\) : void -Aborts the use of the key. This method uses an asynchronous callback to return the result. +Aborts the use of the key. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Security.Huks @@ -957,7 +957,7 @@ Aborts the use of the key. This method uses an asynchronous callback to return t | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------- | | handle | number | Yes | Handle of the **Abort** operation.| -| options | [HuksOptions](#huksoptions) | Yes | Parameter set of the **Abort** operation.| +| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Abort** operation.| | callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes| Callback used to return the operation result.| **Example** @@ -981,13 +981,13 @@ async function routePage() { console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`) } } -var alias = "HuksDemoRSA"; +var keyalias = "HuksDemoRSA"; var properties = new Array(); var options = { properties: properties, inData: new Uint8Array(0) }; -var handle = {}; +var handle; var resultMessage = ""; async function generateKey() { properties[0] = { @@ -1010,7 +1010,7 @@ async function generateKey() { tag: huks.HuksTag.HUKS_TAG_DIGEST, value: huks.HuksKeyDigest.HUKS_DIGEST_SHA256 }; - huks.generateKey(alias, options); + huks.generateKey(keyalias, options); } function stringToUint8Array(str) { var arr = []; @@ -1021,19 +1021,14 @@ function stringToUint8Array(str) { return tmpUint8Array; } async function huksInit() { - await huks.init(alias, options).then((data) => { + await huks.init(keyalias, options).then((data) => { console.log(`test init data: ${JSON.stringify(data)}`); - handle = { - "handle1": data.handle1, - "handle2": data.handle2 - }; + handle = data.handle; }).catch((err) => { console.log("test init err information: " + JSON.stringify(err)) }) } async function huksUpdate() { - let count = 2; - for (let i = 0; i < count; i++) { options.inData = stringToUint8Array("huksHmacTest"); await huks.update(handle, options).then((data) => { if (data.errorCode === 0) { @@ -1041,11 +1036,8 @@ async function huksUpdate() { } else { resultMessage += "update fail!"; } - }).catch((err) => { - resultMessage += "update times: " + count + (i + 1) + " fail catch errorMessage:" + JSON.stringify(err) + " " }); console.log(resultMessage); - } } function huksFinish() { options.inData = stringToUint8Array("HuksDemoHMAC"); @@ -1068,7 +1060,7 @@ async function huksAbort() { resultMessage = "abort fail errorCode: " + data.errorCode; } }).catch((err) => { - resultMessage = "Failed to abort the use of the key. catch errorMessage:" + JSON.stringify(err) + resultMessage = "Failed to abort the use of the key. catch errorMessage:" + JSON.stringify(err) }); console.log(resultMessage); } @@ -1110,7 +1102,7 @@ struct Index { generateKey() }) Button() { - Text('huksInit') + Text('Init') .fontSize(25) .fontWeight(FontWeight.Bold) }.type(ButtonType.Capsule) @@ -1124,7 +1116,7 @@ struct Index { huksInit() }) Button() { - Text('huksUpdate') + Text('Update') .fontSize(25) .fontWeight(FontWeight.Bold) }.type(ButtonType.Capsule) @@ -1138,7 +1130,7 @@ struct Index { huksUpdate() }) Button() { - Text('huksFinish') + Text('Finish') .fontSize(25) .fontWeight(FontWeight.Bold) }.type(ButtonType.Capsule) @@ -1152,7 +1144,7 @@ struct Index { huksFinish() }) Button() { - Text('huksAbort') + Text('Abort') .fontSize(25) .fontWeight(FontWeight.Bold) }.type(ButtonType.Capsule) @@ -1176,7 +1168,7 @@ struct Index { abort(handle: number, options: HuksOptions) : Promise\; -Aborts the use of the key. This method uses a promise to return the result. +Aborts the use of the key. This API uses a promise to return the result. **System capability**: SystemCapability.Security.Huks @@ -1185,7 +1177,7 @@ Aborts the use of the key. This method uses a promise to return the result. | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------- | | handle | number | Yes | Handle of the **Abort** operation.| -| options | [HuksOptions](#huksoptions) | Yes | Parameter set of the **Abort** operation.| +| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Abort** operation.| | promise | Promise\<[HuksResult](#huksresult)> | Yes| Promise used to return the operation result.| **Example** @@ -1210,13 +1202,13 @@ async function routePage() { } } -var alias = "HuksDemoRSA"; +var keyalias = "HuksDemoRSA"; var properties = new Array(); var options = { properties: properties, inData: new Uint8Array(0) }; -var handle = {}; +var handle; var resultMessage = ""; function stringToUint8Array(str) { var arr = []; @@ -1248,17 +1240,14 @@ async function generateKey() { tag: huks.HuksTag.HUKS_TAG_DIGEST, value: huks.HuksKeyDigest.HUKS_DIGEST_SHA256 }; - huks.generateKey(alias, options, function (err, data) { }); + huks.generateKey(keyalias, options, function (err, data) { }); } async function huksInit() { return new Promise((resolve, reject) => { - huks.init(alias, options, async function (err, data) { + huks.init(keyalias, options, async function (err, data) { if (data.errorCode === 0) { resultMessage = "Initialization successful!" - handle = { - "handle1": data.handle1, - "handle2": data.handle2 - } + handle = data.handle; } else { resultMessage = "init fail errorCode: " + data.errorCode } @@ -1267,8 +1256,6 @@ async function huksInit() { } async function huksUpdate() { - let count = 2; - for (let i = 0; i < count; i++) { options.inData = stringToUint8Array("huksHmacTest"); new Promise((resolve, reject) => { huks.update(handle, options, function (err, data) { @@ -1280,7 +1267,7 @@ async function huksUpdate() { }); }); console.log(resultMessage); - } + } async function huksFinish() { @@ -1341,7 +1328,7 @@ struct Index { generateKey() }) Button() { - Text('huksInit') + Text('Init') .fontSize(25) .fontWeight(FontWeight.Bold) }.type(ButtonType.Capsule) @@ -1355,7 +1342,7 @@ struct Index { huksInit() }) Button() { - Text('huksUpdate') + Text('Update') .fontSize(25) .fontWeight(FontWeight.Bold) }.type(ButtonType.Capsule) @@ -1369,7 +1356,7 @@ struct Index { huksUpdate() }) Button() { - Text('huksFinish') + Text('Finish') .fontSize(25) .fontWeight(FontWeight.Bold) }.type(ButtonType.Capsule) @@ -1383,7 +1370,7 @@ struct Index { huksFinish() }) Button() { - Text('huksAbort') + Text('Abort') .fontSize(25) .fontWeight(FontWeight.Bold) }.type(ButtonType.Capsule) @@ -1435,7 +1422,7 @@ Defines the HUKS handle structure. | ---------- | ---------------- | ---- | -------- | | errorCode | number | Yes | Error code.| | handle | number | Yes| Value of the handle.| -| token | Uint8Array | No| Reserved field.| +| token | Uint8Array | No| Reserved.| ## HuksResult diff --git a/en/application-dev/reference/apis/js-apis-lightweightmap.md b/en/application-dev/reference/apis/js-apis-lightweightmap.md index 063b77a636b193720237202185201e3bc9e5a19e..5273e9290e9be72ee4c4ed9e7aefc412c6805e2a 100644 --- a/en/application-dev/reference/apis/js-apis-lightweightmap.md +++ b/en/application-dev/reference/apis/js-apis-lightweightmap.md @@ -1,12 +1,12 @@ # Nonlinear Container LightWeightMap -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```ts import LightWeightMap from '@ohos.util.LightWeightMap' ``` @@ -32,7 +32,7 @@ A constructor used to create a **LightWeightMap** instance. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); ``` @@ -51,7 +51,7 @@ Checks whether this container is empty (contains no entry). **Example** -``` +```ts const lightWeightMap = new LightWeightMap(); let result = lightWeightMap.isEmpty(); ``` @@ -77,7 +77,7 @@ Checks whether this container contains all entries of the specified **LightWeigh **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); lightWeightMap.set("sdfs", 356); @@ -107,7 +107,7 @@ Checks whether this container contains the specified key. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); let result = lightWeightMap.hasKey; lightWeightMap.hasKey("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); @@ -136,7 +136,7 @@ Checks whether this container contains the specified value. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); let result = lightWeightMap.hasValue(123); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); @@ -158,7 +158,7 @@ Increases the capacity of this container. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.increaseCapacityTo(10); ``` @@ -184,7 +184,7 @@ Obtains the value of the specified key in this container. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); lightWeightMap.set("sdfs", 356); @@ -212,7 +212,7 @@ Obtains the index of the first occurrence of an entry with the specified key in **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); lightWeightMap.set("sdfs", 356); @@ -240,7 +240,7 @@ Obtains the index of the first occurrence of an entry with the specified value i **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); lightWeightMap.set("sdfs", 356); @@ -268,7 +268,7 @@ Obtains the key of an entry at the specified position in this container. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); lightWeightMap.set("sdfs", 356); @@ -290,7 +290,7 @@ Adds all entries in a **LightWeightMap** instance to this container. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); lightWeightMap.set("sdfs", 356); @@ -319,7 +319,7 @@ Adds an entry to this container. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); let result = lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); ``` @@ -345,7 +345,7 @@ Removes an entry with the specified key from this container. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); lightWeightMap.set("sdfs", 356); @@ -363,7 +363,7 @@ Removes an entry at the specified position from this container. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| index | number | Yes| Position index of the entry to remove.| +| index | number | Yes| Position index of the entry.| **Return value** @@ -373,7 +373,7 @@ Removes an entry at the specified position from this container. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); lightWeightMap.set("sdfs", 356); @@ -402,7 +402,7 @@ Sets a value for an entry at the specified position in this container. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); lightWeightMap.set("sdfs", 356); @@ -430,7 +430,7 @@ Obtains the value of an entry at the specified position in this container. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); lightWeightMap.set("sdfs", 356); @@ -446,7 +446,7 @@ Clears this container and sets its length to **0**. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); lightWeightMap.set("sdfs", 356); @@ -468,7 +468,7 @@ Obtains an iterator that contains all the keys in this container. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); lightWeightMap.set("sdfs", 356); @@ -495,7 +495,7 @@ Obtains an iterator that contains all the values in this container. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); lightWeightMap.set("sdfs", 356); @@ -530,7 +530,7 @@ callbackfn **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("sdfs", 123); lightWeightMap.set("dfsghsf", 357); @@ -554,7 +554,7 @@ Obtains an iterator that contains all the entries in this container. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); lightWeightMap.set("sdfs", 356); @@ -581,7 +581,7 @@ Concatenates the entries in this container into a string and returns the string. **Example** - ``` + ```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("A", 123); lightWeightMap.set("sdfs", 356); @@ -602,7 +602,7 @@ Obtains an iterator, each item of which is a JavaScript object. **Example** -``` +```ts let lightWeightMap = new LightWeightMap(); lightWeightMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); lightWeightMap.set("sdfs", 356); diff --git a/en/application-dev/reference/apis/js-apis-lightweightset.md b/en/application-dev/reference/apis/js-apis-lightweightset.md index 768ffc337f0cba9fce488dbfd78cbc93173271bf..a024852f8c94b4df3d6a81727cffae004cbbd67c 100644 --- a/en/application-dev/reference/apis/js-apis-lightweightset.md +++ b/en/application-dev/reference/apis/js-apis-lightweightset.md @@ -1,12 +1,12 @@ # Nonlinear Container LightWeightSet -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```ts import LightWeightSet from '@ohos.util.LightWeightSet' ``` @@ -32,7 +32,7 @@ A constructor used to create a **LightWeightSet** instance. **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); ``` @@ -51,7 +51,7 @@ Checks whether this container is empty. **Example** -``` +```ts const lightWeightSet = new LightWeightSet(); let result = lightWeightSet.isEmpty(); ``` @@ -76,7 +76,7 @@ Adds an entry to this container. **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); let result = lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); ``` @@ -96,7 +96,7 @@ Adds all entries in a **LightWeightSet** instance to this container. **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); lightWeightSet.add("sdfs"); @@ -126,7 +126,7 @@ Checks whether this container contains all entries of the specified **LightWeigh **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); lightWeightSet.add("sdfs"); @@ -156,7 +156,7 @@ Checks whether this container has the specified key. **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); let result = lightWeightSet.has(123); lightWeightSet.add(123); @@ -184,7 +184,7 @@ Checks whether this container contains objects of the same type as the specified **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); lightWeightSet.add("sdfs"); @@ -207,7 +207,7 @@ Increases the capacity of this container. **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); lightWeightSet.increaseCapacityTo(10); ``` @@ -233,7 +233,7 @@ Obtains the position index of the entry with the specified key in this container **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); lightWeightSet.add("sdfs"); @@ -261,7 +261,7 @@ Removes an entry of the specified key from this container. **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); lightWeightSet.add("sdfs"); @@ -289,7 +289,7 @@ Removes the entry at the specified position from this container. **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); lightWeightSet.add("sdfs"); @@ -317,7 +317,7 @@ Obtains the value of the entry at the specified position in this container. **Parameters** -``` +```ts let lightWeightSet = new LightWeightSet(); lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); lightWeightSet.add("sdfs"); @@ -333,7 +333,7 @@ Clears this container and sets its length to **0**. **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); lightWeightSet.add("sdfs"); @@ -355,7 +355,7 @@ Obtains a string that contains all entries in this container. **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); lightWeightSet.add("sdfs"); @@ -377,7 +377,7 @@ Obtains an array that contains all objects in this container. **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); lightWeightSet.add("sdfs"); @@ -399,7 +399,7 @@ Obtains an iterator that contains all the values in this container. **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); lightWeightSet.add("sdfs"); @@ -434,7 +434,7 @@ callbackfn **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); lightWeightSet.add("sdfs"); lightWeightSet.add("dfsghsf"); @@ -458,7 +458,7 @@ Obtains an iterator that contains all the entries in this container. **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); lightWeightSet.add("sdfs"); @@ -485,7 +485,7 @@ Obtains an iterator, each item of which is a JavaScript object. **Example** -``` +```ts let lightWeightSet = new LightWeightSet(); lightWeightSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); lightWeightSet.add("sdfs"); diff --git a/en/application-dev/reference/apis/js-apis-linkedlist.md b/en/application-dev/reference/apis/js-apis-linkedlist.md index cebc8bbbf05902ef541166d8688964a9fbe0f1a7..2827999afc78fe6e9c026ce976a9821e1ce35350 100644 --- a/en/application-dev/reference/apis/js-apis-linkedlist.md +++ b/en/application-dev/reference/apis/js-apis-linkedlist.md @@ -1,12 +1,12 @@ # Linear Container LinkedList -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```ts import LinkedList from '@ohos.util.LinkedList' ``` @@ -34,7 +34,7 @@ A constructor used to create a **LinkedList** instance. **Example** -``` +```ts let linkedList = new LinkedList(); ``` @@ -59,7 +59,7 @@ Adds an entry at the end of this container. **Example** -``` +```ts let linkedList = new LinkedList(); let result = linkedList.add("a"); let result1 = linkedList.add(1); @@ -83,7 +83,7 @@ Adds an entry at the top of this container. **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.addFirst("a"); linkedList.addFirst(1); @@ -108,7 +108,7 @@ Inserts an entry at the specified position in this container. **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.insert(0, "A"); linkedList.insert(1, 0); @@ -135,7 +135,7 @@ Checks whether this container has the specified entry. **Example** -``` +```ts let linkedList = new LinkedList(); let result1 = linkedList.has("Ahfbrgrbgnutfodgorrogorg"); linkedList.add("Ahfbrgrbgnutfodgorrogorg"); @@ -162,7 +162,7 @@ Obtains an entry at the specified position in this container. **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -194,7 +194,7 @@ Obtains the index of the last occurrence of the specified entry in this containe **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -226,7 +226,7 @@ Obtains the index of the first occurrence of the specified entry in this contain **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -258,7 +258,7 @@ Removes an entry at the specified position from this container. **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -282,7 +282,7 @@ Removes the first entry from this container. **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -306,7 +306,7 @@ Removes the last entry from this container. **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -336,7 +336,7 @@ Removes the first occurrence of the specified entry from this container. **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -365,7 +365,7 @@ Removes the first occurrence of the specified entry from this container. **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -394,7 +394,7 @@ Removes the last occurrence of the specified entry from this container. **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -417,7 +417,7 @@ Clones this container and returns a copy. The modification to the copy does not **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -450,7 +450,7 @@ callbackfn **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -469,7 +469,7 @@ Clears this container and sets its length to **0**. **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -499,7 +499,7 @@ Replaces an entry at the specified position in this container with a given entry **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -521,7 +521,7 @@ Converts this container into an array. | Array<T> | Array obtained.| **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -544,7 +544,7 @@ Obtains the first entry in this container. **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -567,7 +567,7 @@ Obtains the last entry in this container. **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); @@ -591,7 +591,7 @@ Obtains an iterator, each item of which is a JavaScript object. **Example** -``` +```ts let linkedList = new LinkedList(); linkedList.add(2); linkedList.add(4); diff --git a/en/application-dev/reference/apis/js-apis-list.md b/en/application-dev/reference/apis/js-apis-list.md index ad87462656501d54e206b824c51b5555ec8b3e67..661d0726ebe52f5e5fc97d68cca866938bc2660a 100644 --- a/en/application-dev/reference/apis/js-apis-list.md +++ b/en/application-dev/reference/apis/js-apis-list.md @@ -1,12 +1,12 @@ # Linear Container List -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```ts import List from '@ohos.util.List' ``` @@ -34,7 +34,7 @@ A constructor used to create a **List** instance. **Example** -``` +```ts let list = new List(); ``` @@ -59,7 +59,7 @@ Adds an entry at the end of this container. **Example** -``` +```ts let list = new List(); let result = list.add("a"); let result1 = list.add(1); @@ -84,7 +84,7 @@ Inserts an entry at the specified position in this container. **Example** -``` +```ts let list = new List(); list.insert("A", 0); list.insert(0, 1); @@ -111,7 +111,7 @@ Checks whether this container has the specified entry. **Example** -``` +```ts let list = new List(); let result = list.has("Ahfbrgrbgnutfodgorrogorg"); list.add("Ahfbrgrbgnutfodgorrogorg"); @@ -138,7 +138,7 @@ Obtains the entry at the specified position in this container. **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -170,7 +170,7 @@ Obtains the index of the last occurrence of the specified entry in this containe **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -202,7 +202,7 @@ Obtains the index of the first occurrence of the specified entry in this contain **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -235,7 +235,7 @@ Compares whether a specified object is equal to this container. **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -270,7 +270,7 @@ Removes an entry at the specified position from this container. **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -300,7 +300,7 @@ Removes the first occurrence of the specified entry from this container. **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -333,7 +333,7 @@ callbackfn **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -371,7 +371,7 @@ callbackfn **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -391,20 +391,20 @@ Sorts entries in this container. **Parameters** -| Name| Value Type | Mandatory| Description| +| Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | -| comparator | function | Yes| Callback invoked for sorting.| +| comparator | function | Yes | Callback invoked for sorting. | comparator -| Name| Value Type | Mandatory| Description| +| Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | -| firstValue | T | Yes| Previous entry.| -| secondValue | T | Yes| Next entry.| +| firstValue | T | Yes | Previous entry. | +| secondValue | T | Yes | Next entry. | **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -435,7 +435,7 @@ Obtains entries within a range in this container, including the entry at the sta **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -454,7 +454,7 @@ Clears this container and sets its length to **0**. **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -484,7 +484,7 @@ Replaces an entry at the specified position in this container with a given entry **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -502,13 +502,13 @@ Converts this container into an array. **Return value** -| Value Type | Description| +| Type | Description | | -------- | -------- | -| Array<T> | Array obtained.| +| Array<T> | Array obtained. | **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -531,7 +531,7 @@ Checks whether this container is empty (contains no entry). **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -554,7 +554,7 @@ Obtains the first entry in this container. **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -577,7 +577,7 @@ Obtains the last entry in this container. **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); @@ -601,7 +601,7 @@ Obtains an iterator, each item of which is a JavaScript object. **Example** -``` +```ts let list = new List(); list.add(2); list.add(4); diff --git a/en/application-dev/reference/apis/js-apis-plainarray.md b/en/application-dev/reference/apis/js-apis-plainarray.md index ad79f05458fa5426b6cef9f0ab2e459726e030ed..3f0475a9dccbf4efb61836c7fa735174bb060d1e 100644 --- a/en/application-dev/reference/apis/js-apis-plainarray.md +++ b/en/application-dev/reference/apis/js-apis-plainarray.md @@ -1,12 +1,12 @@ # Nonlinear Container PlainArray -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```ts import PlainArray from '@ohos.util.PlainArray' ``` @@ -32,7 +32,7 @@ A constructor used to create a **PlainArray** instance. **Example** -``` +```ts let plainArray = new PlainArray(); ``` @@ -51,7 +51,7 @@ Checks whether this container is empty. **Example** -``` +```ts const plainArray = new PlainArray(); let result = plainArray.isEmpty(); ``` @@ -77,7 +77,7 @@ Checks whether this container contains the specified key. **Example** -``` +```ts let plainArray = new PlainArray(); plainArray.has(1); plainArray.add(1, "sddfhf"); @@ -105,7 +105,7 @@ Obtains the value of the specified key in this container. **Example** -``` +```ts let plainArray = new PlainArray(); plainArray.add(1, "sddfhf"); plainArray.add(2, "sffdfhf"); @@ -133,7 +133,7 @@ Obtains the index of the first occurrence of an entry with the specified key in **Example** -``` +```ts let plainArray = new PlainArray(); plainArray.add(1, "sddfhf"); plainArray.add(2, "sffdfhf"); @@ -161,7 +161,7 @@ Obtains the index of the first occurrence of an entry with the specified value i **Example** -``` +```ts let plainArray = new PlainArray(); plainArray.add(1, "sddfhf"); plainArray.add(2, "sffdfhf"); @@ -189,7 +189,7 @@ Obtains the key of the entry at the specified position in this container. **Example** -``` +```ts let plainArray = new PlainArray(); plainArray.add(1, "sddfhf"); plainArray.add(2, "sffdfhf"); @@ -216,7 +216,7 @@ Obtains the value of an entry at the specified position in this container. **Example** - ``` + ```ts let plainArray = new PlainArray(); plainArray.add(1, "sddfhf"); plainArray.add(2, "sffdfhf"); @@ -237,7 +237,7 @@ Clones this container and returns a copy. The modification to the copy does not **Example** -``` +```ts let plainArray = new PlainArray(); plainArray.add(1, "sddfhf"); plainArray.add(2, "sffdfhf"); @@ -260,7 +260,7 @@ Adds an entry to this container. **Example** -``` +```ts let plainArray = new PlainArray(); plainArray.add(1, "sddfhf"); ``` @@ -286,7 +286,7 @@ Removes an entry with the specified key from this container. **Example** -``` +```ts let plainArray = new PlainArray(); plainArray.add(1, "sddfhf"); plainArray.add(2, "sffdfhf"); @@ -315,7 +315,7 @@ Removes an entry at the specified position from this container. **Example** -``` +```ts let plainArray = new PlainArray(); plainArray.add(1, "sddfhf"); plainArray.add(2, "sffdfhf"); @@ -345,7 +345,7 @@ Removes entries in a specified range from this container. **Example** -``` +```ts let plainArray = new PlainArray(); plainArray.add(1, "sddfhf"); plainArray.add(2, "sffdfhf"); @@ -368,7 +368,7 @@ Sets a value for an entry at the specified position in this container. **Example** -``` +```ts let plainArray = new PlainArray(); plainArray.add(1, "sddfhf"); plainArray.add(2, "sffdfhf"); @@ -390,7 +390,7 @@ Obtains a string that contains all entries in this container. **Example** -``` +```ts let plainArray = new PlainArray(); plainArray.add(1, "sddfhf"); plainArray.add(2, "sffdfhf"); @@ -406,7 +406,7 @@ Clears this container and sets its length to **0**. **Example** -``` +```ts let plainArray = new PlainArray(); plainArray.add(1, "sddfhf"); plainArray.add(2, "sffdfhf"); @@ -436,7 +436,7 @@ callbackfn **Example** -``` +```ts let plainArray = new PlainArray(); plainArray.add(1, "sddfhf"); plainArray.add(2, "sffdfhf"); @@ -460,7 +460,7 @@ Obtains an iterator, each item of which is a JavaScript object. **Example** -``` +```ts let plainArray = new PlainArray(); plainArray.add(1, "sddfhf"); plainArray.add(2, "sffdfhf"); diff --git a/en/application-dev/reference/apis/js-apis-queue.md b/en/application-dev/reference/apis/js-apis-queue.md index b773be32727a995718493a767655b8445f984919..ff80fc9e5e8dc3acfe5dbe12c3041a44f5d8e57b 100644 --- a/en/application-dev/reference/apis/js-apis-queue.md +++ b/en/application-dev/reference/apis/js-apis-queue.md @@ -1,12 +1,12 @@ # Linear Container Queue -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```ts import Queue from '@ohos.util.Queue' ``` @@ -33,7 +33,7 @@ A constructor used to create a **Queue** instance. **Example** -``` +```ts let queue = new Queue(); ``` @@ -58,7 +58,7 @@ Adds an entry at the end of this container. **Example** -``` +```ts let queue = new Queue(); let result = queue.add("a"); let result1 = queue.add(1); @@ -83,7 +83,7 @@ Removes the first entry from this container. **Example** -``` +```ts let queue = new Queue(); queue.add(2); queue.add(4); @@ -107,7 +107,7 @@ Obtains the first entry of this container. **Example** -``` +```ts let queue = new Queue(); queue.add(2); queue.add(4); @@ -140,7 +140,7 @@ callbackfn **Example** -``` +```ts let queue = new Queue(); queue.add(2); queue.add(4); @@ -161,12 +161,12 @@ Obtains an iterator, each item of which is a JavaScript object. **Return value** -| Type| Description| +| Type | Description | | -------- | -------- | -| IterableIterator<T> | Iterator obtained.| +| IterableIterator<T> | Iterator obtained. | **Example** -``` +```ts let queue = new Queue(); queue.add(2); queue.add(4); diff --git a/en/application-dev/reference/apis/js-apis-service-extension-ability.md b/en/application-dev/reference/apis/js-apis-service-extension-ability.md index bb0dd569108ec77a89e9f3763fe216a364dba184..09033e607f88b02a42885b02eeb468dd8de6ec4b 100644 --- a/en/application-dev/reference/apis/js-apis-service-extension-ability.md +++ b/en/application-dev/reference/apis/js-apis-service-extension-ability.md @@ -1,6 +1,6 @@ # ServiceExtensionAbility -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **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. @@ -40,7 +40,7 @@ Called when an extension is created to initialize the service logic. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information related to this extension, including the ability name and bundle name.| + | want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.| **Example** @@ -84,7 +84,7 @@ Called after **onCreate** is invoked when an ability is started by calling **sta | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information related to this extension, including the ability name and bundle name.| + | want | [Want](js-apis-application-Want.md) | Yes| Information related to this extension, including the ability name and bundle name.| | startId | number | Yes| Number of ability start times. The initial value is **1**, and the value is automatically incremented for each ability started.| **Example** @@ -110,7 +110,7 @@ Called after **onCreate** is invoked when an ability is started by calling **con | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information related to this extension, including the ability name and bundle name.| + | want | [Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.| **Return value** @@ -150,7 +150,7 @@ Called when the ability is disconnected. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want |[Want](js-apis-featureAbility.md#Want)| Yes| Information related to this extension, including the ability name and bundle name.| + | want |[Want](js-apis-application-Want.md)| Yes| Information related to this extension, including the ability name and bundle name.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-service-extension-context.md b/en/application-dev/reference/apis/js-apis-service-extension-context.md index 0c6b7c6749e3a7bab2d40fc730742dd3daef9f05..a11942cf16b785967a8491e46a06d8ad820359aa 100644 --- a/en/application-dev/reference/apis/js-apis-service-extension-context.md +++ b/en/application-dev/reference/apis/js-apis-service-extension-context.md @@ -1,7 +1,7 @@ # ServiceExtensionContext -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. Implements the context that provides the capabilities and APIs of **ServiceExtension**. This class is inherited from **ExtensionContext**. @@ -19,7 +19,7 @@ Starts an ability. This API uses a callback to return the result. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the ability to start, such as the ability name and bundle name.| + | want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, such as the ability name and bundle name.| | callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the API is successfully called.| **Example** @@ -47,7 +47,7 @@ Starts an ability. This API uses a promise to return the result. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the ability to start, such as the ability name and bundle name.| + | want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, such as the ability name and bundle name.| **Return value** @@ -130,7 +130,7 @@ Connects this ability to a Service ability. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the ability to connect to, such as the ability name and bundle name.| + | want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to connect to, such as the ability name and bundle name.| | options | [ConnectOptions](#connectoptions) | Yes| Callback used to return the information indicating that the connection is successful, interrupted, or failed.| **Return value** diff --git a/en/application-dev/reference/apis/js-apis-socket.md b/en/application-dev/reference/apis/js-apis-socket.md index 0f3a6ab7fb02dee588d22f92390a7ed6b731662e..dcaf0416c84747d430a115d5cc5f48d132d7b675 100644 --- a/en/application-dev/reference/apis/js-apis-socket.md +++ b/en/application-dev/reference/apis/js-apis-socket.md @@ -622,7 +622,7 @@ Defines the parameters for sending data over the UDPSocket connection. | Name | Type | Mandatory| Description | | ------- | ---------------------------------- | ---- | -------------- | -| data | string | Yes | Data to send. | +| data | string \| ArrayBuffer8+ | Yes | Data to send. | | address | [NetAddress](#netaddress) | Yes | Destination address.| ## UDPExtraOptions @@ -1430,7 +1430,7 @@ Defines the parameters for sending data over the TCPSocket connection. | Name | Type | Mandatory| Description | | -------- | ------ | ---- | ------------------------------------------------------------ | -| data | string | Yes | Data to send. | +| data | string\| ArrayBuffer8+ | Yes | Data to send. | | encoding | string | No | Character encoding format. The options are as follows: **UTF-8**, **UTF-16BE**, **UTF-16LE**, **UTF-16**, **US-AECII**, and **ISO-8859-1**. The default value is **UTF-8**.| ## TCPExtraOptions diff --git a/en/application-dev/reference/apis/js-apis-stack.md b/en/application-dev/reference/apis/js-apis-stack.md index 3a8edec81681964ebd5cf171c1d837b2b335e792..245f4f88fd48e8b3b3ba2263e67fe0a33e95959b 100644 --- a/en/application-dev/reference/apis/js-apis-stack.md +++ b/en/application-dev/reference/apis/js-apis-stack.md @@ -1,12 +1,12 @@ # Linear Container Stack -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```ts import Stack from '@ohos.util.Stack' ``` @@ -33,7 +33,7 @@ A constructor used to create a **Stack** instance. **Example** -``` +```ts let stack = new Stack(); ``` @@ -58,7 +58,7 @@ Adds an entry at the top of this container. **Example** -``` +```ts let stack = new Stack(); let result = stack.push("a"); let result1 = stack.push(1); @@ -82,7 +82,7 @@ Removes the top entry from this container. **Example** -``` +```ts let stack = new Stack(); stack.push(2); stack.push(4); @@ -106,7 +106,7 @@ Obtains the top entry of this container. **Example** -``` +```ts let stack = new Stack(); stack.push(2); stack.push(4); @@ -135,7 +135,7 @@ Obtains the index of the first occurrence of the specified entry in this contain **Example** -``` +```ts let stack = new Stack(); stack.push(2); stack.push(4); @@ -168,7 +168,7 @@ callbackfn **Example** -``` +```ts let stack = new Stack(); stack.push(2); stack.push(4); @@ -193,7 +193,7 @@ Checks whether this container is empty (contains no entries). **Example** -``` +```ts let stack = new Stack(); stack.push(2); stack.push(4); @@ -216,7 +216,7 @@ Obtains an iterator, each item of which is a JavaScript object. | IterableIterator<T> | Iterator obtained.| **Example** -``` +```ts let stack = new Stack(); stack.push(2); stack.push(4); diff --git a/en/application-dev/reference/apis/js-apis-system-parameter.md b/en/application-dev/reference/apis/js-apis-system-parameter.md index 29c1e580b1e2ac03e9c0cb88922d3a640485d8bf..c111c6c2cbfa5e809816b3246a28ac8114e35f76 100644 --- a/en/application-dev/reference/apis/js-apis-system-parameter.md +++ b/en/application-dev/reference/apis/js-apis-system-parameter.md @@ -6,7 +6,7 @@ ## Modules to Import -``` +```ts import parameter from '@ohos.systemParameter' ``` @@ -34,7 +34,7 @@ Obtains the value of the attribute with the specified key. **Example** -``` +```ts try { var info = parameter.getSync("test.parameter.key"); console.log(JSON.stringify(info)); @@ -61,7 +61,7 @@ Obtains the value of the attribute with the specified key. This API uses an asyn **Example** -``` +```ts try { parameter.get("test.parameter.key", function (err, data) { if (err == undefined) { @@ -93,7 +93,7 @@ Obtains the value of the attribute with the specified key. This API uses an asyn **Example** -``` +```ts try { parameter.get("test.parameter.key", "default", function (err, data) { if (err == undefined) { @@ -131,7 +131,7 @@ Obtains the value of the attribute with the specified key. This API uses a promi **Example** -``` +```ts try { var p = parameter.get("test.parameter.key"); p.then(function (value) { @@ -162,7 +162,7 @@ Sets a value for the attribute with the specified key. **Example** -``` +```ts try { parameter.setSync("test.parameter.key", "default"); }catch(e){ @@ -189,7 +189,7 @@ Sets a value for the attribute with the specified key. This API uses an asynchro **Example** -``` +```ts try { parameter.set("test.parameter.key", "testValue", function (err, data) { if (err == undefined) { @@ -226,7 +226,7 @@ Sets a value for the attribute with the specified key. This API uses a promise t **Example** -``` +```ts try { var p = para.set("test.parameter.key", "testValue"); p.then(function (value) { diff --git a/en/application-dev/reference/apis/js-apis-system-storage.md b/en/application-dev/reference/apis/js-apis-system-storage.md index 038558c55e164f3a381c21ad5a98949d75191c52..d80bf1ea12d54ac3d2bae32ec81c88cd293dfa62 100644 --- a/en/application-dev/reference/apis/js-apis-system-storage.md +++ b/en/application-dev/reference/apis/js-apis-system-storage.md @@ -2,7 +2,7 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> -> - The APIs of this module are no longer maintained since API Version 6. You are advised to use [`@ohos.data.storage`](js-apis-data-storage.md). From API Version 9, you are advised to use [`@ohos.data.preferences`](js-apis-data-preferences.md). +> - The APIs of this module are no longer maintained since API Version 6, and you are advised to use [`@ohos.data.storage`](js-apis-data-storage.md). From API Version 9, you are advised to use [`@ohos.data.preferences`](js-apis-data-preferences.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. @@ -10,7 +10,7 @@ ## Modules to Import -``` +```js import storage from '@system.storage'; ``` @@ -19,7 +19,7 @@ import storage from '@system.storage'; get(Object): void -Obtains the stored data. +Reads the value stored in the cache based on the specified key. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core @@ -27,15 +27,15 @@ Obtains the stored data. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| key | string | Yes| Index of the data to obtain.| +| key | string | Yes| Key of the data to read.| | default | string | No| Default value returned when the **key** does not exist.| -| success | Function | No| Called when the stored data is successfully obtained.| -| fail | Function | No| Called when the stored data failed to be obtained.| -| complete | Function | No| Called when the execution is complete.| +| success | Function | No| Called to return the value obtained when **storage.get()** is successful.| +| fail | Function | No| Called when **storage.get()** fails. In the callback, **data** indicates the error information, and **code** indicates the error code.| +| complete | Function | No| Called when **storage.get()** is complete.| **Example** -``` +```js export default { storageGet() { storage.get({ @@ -59,7 +59,7 @@ export default { set(Object): void -Modifies the stored data. +Sets the value in the cache based on the specified key. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core @@ -67,15 +67,15 @@ Modifies the stored data. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| key | string | Yes| Index of the data to modify.| -| value | string | No| New value to set. The maximum length is 128 bytes.| -| success | Function | No| Called when the data is successfully modified.| -| fail | Function | No| Called when the data failed to be modified.| -| complete | Function | No| Called when the execution is complete.| +| key | string | Yes| Key of the value to set.| +| value | string | Yes| New value to set. The maximum length is 128 bytes.| +| success | Function | No| Called when **storage.set()** is successful.| +| fail | Function | No| Called when **storage.set()** fails. In the callback, **data** indicates the error information, and **code** indicates the error code.| +| complete | Function | No| Called when **storage.set()** is complete.| **Example** -``` +```js export default { storageSet() { storage.set({ @@ -97,7 +97,7 @@ export default { clear(Object): void -Clears the stored data. +Clears the key-value pairs from the cache. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core @@ -105,13 +105,13 @@ Clears the stored data. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| success | Function | No| Called when the data is successfully cleared.| -| fail | Function | No| Called when the data failed to be cleared.| -| complete | Function | No| Called when the execution is complete.| +| success | Function | No| Called when **storage.clear()** is successful.| +| fail | Function | No| Called when **storage.clear()** fails. In the callback, **data** indicates the error information, and **code** indicates the error code.| +| complete | Function | No| Called when **storage.clear()** is complete.| **Example** -``` +```js export default { storageClear() { storage.clear({ @@ -131,7 +131,7 @@ export default { delete(Object): void -Deletes the stored data. +Deletes the key-value pair based on the specified key. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core @@ -139,14 +139,14 @@ Deletes the stored data. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| key | string | Yes| Index of the data to delete.| -| success | Function | No| Called when the data is deleted.| -| fail | Function | No| Called when the data failed to be deleted.| -| complete | Function | No| Called when the execution is complete.| +| key | string | Yes| Key of the data to delete.| +| success | Function | No| Called when **storage.delete()** is successful.| +| fail | Function | No| Called when **storage.delete()** fails. In the callback, **data** indicates the error information, and **code** indicates the error code.| +| complete | Function | No| Called when **storage.delete()** is complete.| **Example** -``` +```js export default { storageDelete() { storage.delete({ diff --git a/en/application-dev/reference/apis/js-apis-treemap.md b/en/application-dev/reference/apis/js-apis-treemap.md index 8aa15caf96fdf5886027bfae520473081cedef87..c3d62b882dbb74012ba561135f5934dae3b3e22e 100644 --- a/en/application-dev/reference/apis/js-apis-treemap.md +++ b/en/application-dev/reference/apis/js-apis-treemap.md @@ -1,12 +1,12 @@ # Nonlinear Container TreeMap -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```ts import TreeMap from '@ohos.util.TreeMap' ``` @@ -38,7 +38,7 @@ A constructor used to create a **TreeMap** instance. **Example** -``` +```ts let treeMap = new TreeMap(); ``` @@ -57,7 +57,7 @@ Checks whether this container is empty (contains no entry). **Example** -``` +```ts const treeMap = new TreeMap(); let result = treeMap.isEmpty(); ``` @@ -83,7 +83,7 @@ Checks whether this container has the specified key. **Example** -``` +```ts let treeMap = new TreeMap(); let result = treeMap.hasKey("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); @@ -111,7 +111,7 @@ Checks whether this container has the specified value. **Example** -``` +```ts let treeMap = new TreeMap(); let result = treeMap.hasValue(123); treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); @@ -139,7 +139,7 @@ Obtains the value of the specified key in this container. **Example** -``` +```ts let treeMap = new TreeMap(); treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); treeMap.set("sdfs", 356); @@ -161,7 +161,7 @@ Obtains the first key in this container. **Example** -``` +```ts let treeMap = new TreeMap(); treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); treeMap.set("sdfs", 356); @@ -183,7 +183,7 @@ Obtains the last key in this container. **Example** -``` +```ts let treeMap = new TreeMap(); treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); treeMap.set("sdfs", 356); @@ -205,7 +205,7 @@ Adds all entries in a **TreeMap** instance to this container. **Example** -``` +```ts let treeMap = new TreeMap(); treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); treeMap.set("sdfs", 356); @@ -235,7 +235,7 @@ Adds an entry to this container. **Example** -``` +```ts let treeMap = new TreeMap(); treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); ``` @@ -261,7 +261,7 @@ Removes the entry with the specified key from this container. **Example** -``` +```ts let treeMap = new TreeMap(); treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); treeMap.set("sdfs", 356); @@ -289,7 +289,7 @@ Obtains the key that is placed in front of the input key in this container. **Example** -``` +```ts let treeMap = new TreeMap(); treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); treeMap.set("sdfs", 356); @@ -318,7 +318,7 @@ Obtains the key that is placed next to the input key in this container. **Example** -``` +```ts let treeMap = new TreeMap(); treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); treeMap.set("sdfs", 356); @@ -347,7 +347,7 @@ Replaces an entry in this container. **Example** -``` +```ts let treeMap = new TreeMap(); treeMap.set("sdfs", 123); let result = treeMap.replace("sdfs", 357); @@ -362,7 +362,7 @@ Clears this container and sets its length to **0**. **Example** -``` +```ts let treeMap = new TreeMap(); treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); treeMap.set("sdfs", 356); @@ -384,7 +384,7 @@ Obtains an iterator that contains all the keys in this container. **Example** -``` +```ts let treeMap = new TreeMap(); treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); treeMap.set("sdfs", 356); @@ -411,7 +411,7 @@ Obtains an iterator that contains all the values in this container. **Example** -``` +```ts let treeMap = new TreeMap(); treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); treeMap.set("sdfs", 356); @@ -446,7 +446,7 @@ callbackfn **Example** -``` +```ts let treeMap = new TreeMap(); treeMap.set("sdfs", 123); treeMap.set("dfsghsf", 357); @@ -470,7 +470,7 @@ Obtains an iterator that contains all the entries in this container. **Example** -``` +```ts let treeMap = new TreeMap(); treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); treeMap.set("sdfs", 356); @@ -498,7 +498,7 @@ Obtains an iterator, each item of which is a JavaScript object. **Example** -``` +```ts let treeMap = new TreeMap(); treeMap.set("Ahfbrgrbgnutfodgorrogorgrogofdfdf", 123); treeMap.set("sdfs", 356); diff --git a/en/application-dev/reference/apis/js-apis-treeset.md b/en/application-dev/reference/apis/js-apis-treeset.md index a37b5515c9aed096bb708c40eb2482acf35311d0..4c535ab446abcb7ad2e6f5dc0e7956b3ab8b88b2 100644 --- a/en/application-dev/reference/apis/js-apis-treeset.md +++ b/en/application-dev/reference/apis/js-apis-treeset.md @@ -1,12 +1,12 @@ # Nonlinear Container TreeSet -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```ts import TreeSet from '@ohos.util.TreeSet' ``` @@ -38,7 +38,7 @@ A constructor used to create a **TreeSet** instance. **Example** -``` +```ts let treeSet = new TreeSet(); ``` @@ -57,7 +57,7 @@ Checks whether this container is empty (contains no entry). **Example** -``` +```ts const treeSet = new TreeSet(); let result = treeSet.isEmpty(); ``` @@ -83,7 +83,7 @@ Checks whether this container has the specified value. **Example** -``` +```ts let treeSet = new TreeSet(); treeSet.has(123); treeSet.add(123); @@ -105,7 +105,7 @@ Obtains the value of the first entry in this container. **Example** -``` +```ts let treeSet = new TreeSet(); treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); treeSet.add("sdfs"); @@ -127,7 +127,7 @@ Obtains the value of the last entry in this container. **Example** -``` +```ts let treeSet = new TreeSet(); treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); treeSet.add("sdfs"); @@ -155,7 +155,7 @@ Adds an entry to this container. **Example** -``` +```ts let treeSet = new TreeSet(); let result = treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); ``` @@ -181,7 +181,7 @@ Removes the entry with the specified key from this container. **Example** -``` +```ts let treeSet = new TreeSet(); treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); treeSet.add("sdfs"); @@ -209,7 +209,7 @@ Obtains the value that is placed in front of the input key in this container. **Example** -``` +```ts let treeSet = new TreeSet(); treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); treeSet.add("sdfs"); @@ -238,7 +238,7 @@ Obtains the value that is placed next to the input key in this container. **Example** -``` +```ts let treeSet = new TreeSet(); treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); treeSet.add("sdfs"); @@ -261,7 +261,7 @@ Removes the first entry in this container. **Return value** -``` +```ts let treeSet = new TreeSet(); treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); treeSet.add("sdfs"); @@ -283,7 +283,7 @@ Removes the last entry in this container. **Return value** -``` +```ts let treeSet = new TreeSet(); treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); treeSet.add("sdfs"); @@ -299,7 +299,7 @@ Clears this container and sets its length to **0**. **Example** -``` +```ts let treeSet = new TreeSet(); treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); treeSet.add("sdfs"); @@ -321,7 +321,7 @@ Obtains an iterator that contains all the values in this container. **Example** -``` +```ts let treeSet = new TreeSet(); treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); treeSet.add("sdfs"); @@ -356,7 +356,7 @@ callbackfn **Example** -``` +```ts let treeSet = new TreeSet(); treeSet.add("sdfs"); treeSet.add("dfsghsf"); @@ -380,7 +380,7 @@ Obtains an iterator that contains all the entries in this container. **Example** -``` +```ts let treeSet = new TreeSet(); treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); treeSet.add("sdfs"); @@ -409,7 +409,7 @@ Obtains an iterator, each item of which is a JavaScript object. **Example** -``` +```ts let treeSet = new TreeSet(); treeSet.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); treeSet.add("sdfs"); diff --git a/en/application-dev/reference/apis/js-apis-vector.md b/en/application-dev/reference/apis/js-apis-vector.md index 149fdc42e3179d86a052ad72b87d4e4c1fd4f4e5..dd540d63eb2153ffd6166df967481d63a9ec13d5 100644 --- a/en/application-dev/reference/apis/js-apis-vector.md +++ b/en/application-dev/reference/apis/js-apis-vector.md @@ -1,12 +1,12 @@ # Linear Container Vector -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import -``` +```ts import Vector from '@ohos.util.Vector' ``` @@ -33,7 +33,7 @@ A constructor used to create a **Vector** instance. **Example** -``` +```ts let vector = new Vector(); ``` @@ -58,7 +58,7 @@ Adds an entry at the end of this container. **Example** -``` +```ts let vector = new Vector(); let result = vector.add("a"); let result1 = vector.add(1); @@ -83,7 +83,7 @@ Inserts an entry at the specified position in this container. **Example** -``` +```ts let vector = new Vector(); vector.insert("A", 0); vector.insert(0, 1); @@ -110,7 +110,7 @@ Checks whether this container has the specified entry. **Example** -``` +```ts let vector = new Vector(); let result = vector.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); vector.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf"); @@ -137,7 +137,7 @@ Obtains the index of the first occurrence of the specified entry in this contain **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -169,7 +169,7 @@ Obtains the index of the last occurrence of the specified entry in this containe **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -201,7 +201,7 @@ Removes an entry at the specified position from this container. **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -231,7 +231,7 @@ Removes the first occurrence of the specified entry from this container. **Return value** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -255,7 +255,7 @@ Removes from this container all of the entries within a range, including the ent **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -290,7 +290,7 @@ callbackfn **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -328,7 +328,7 @@ callbackfn **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -348,20 +348,20 @@ Sorts entries in this container. **Parameters** -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | -| comparator | function | No| Callback invoked for sorting.| +| comparator | function | No | Callback invoked for sorting. | comparator -| Name| Type| Mandatory| Description| +| Name | Type | Mandatory | Description | | -------- | -------- | -------- | -------- | -| firstValue | T | Yes| Previous entry.| -| secondValue | T | Yes| Next entry.| +| firstValue | T | Yes | Previous entry. | +| secondValue | T | Yes | Next entry. | **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -393,7 +393,7 @@ Obtains entries within a range in this container, including the entry at the sta **Return value** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -413,7 +413,7 @@ Clears all entries in this container and sets its length to **0**. **Return value** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -436,7 +436,7 @@ Clones this container and returns a copy. The modification to the copy does not **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -459,7 +459,7 @@ Obtains the capacity of this container. **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -482,7 +482,7 @@ Converts this container into an array. **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -505,7 +505,7 @@ Checks whether this container is empty (contains no entries). **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -528,7 +528,7 @@ Increases the capacity of this container. **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -546,7 +546,7 @@ Trims the capacity of this container into its current length. **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -569,7 +569,7 @@ Uses commas (,) to concatenate entries in this container into a string. **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -592,7 +592,7 @@ Copies entries in this container into an array to overwrite elements of the same **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -616,7 +616,7 @@ Obtains the first entry in this container. **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -639,7 +639,7 @@ Obtains the last entry in this container. **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -669,7 +669,7 @@ Searches for an entry backward from the specified position index and returns the **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -700,7 +700,7 @@ Searches for an entry forward from the specified position index and returns the **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -724,7 +724,7 @@ Sets a new length for this container. **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -754,7 +754,7 @@ Obtains an entry at the specified position in this container. **Example** - ``` + ```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -783,7 +783,7 @@ Replaces an entry at the specified position in this container with a given entry **Example** - ``` + ```ts let vector = new Vector(); vector.add(2); vector.add(4); @@ -806,7 +806,7 @@ Obtains an iterator. Each item of the iterator is a JavaScript object. **Example** -``` +```ts let vector = new Vector(); vector.add(2); vector.add(4); diff --git a/en/application-dev/reference/apis/js-apis-window.md b/en/application-dev/reference/apis/js-apis-window.md index e14e89574b22f9a5275dfc4757299bb52a09bde5..e5ea12a05b129e87acde3ea417e617b2c11f6a34 100644 --- a/en/application-dev/reference/apis/js-apis-window.md +++ b/en/application-dev/reference/apis/js-apis-window.md @@ -1,7 +1,8 @@ # Window -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> ## Modules to Import @@ -15,10 +16,10 @@ Enumerates the window types. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Default Value | Description | -| ----------------- | ------------- | ---------------------- | -| TYPE_APP | 0 | Application subwindow. | -| TYPE_SYSTEM_ALERT | 1 | System alert window. | +| Name | Default Value| Description | +| ----------------- | ------ | ------------------ | +| TYPE_APP | 0 | Application subwindow. | +| TYPE_SYSTEM_ALERT | 1 | System alert window.| ## AvoidAreaType7+ @@ -26,10 +27,10 @@ Enumerates the types of the area where the window cannot be displayed. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Default Value | Description | -| ----------- | ------------- | --------------------------- | -| TYPE_SYSTEM | 0 | Default area of the system. | -| TYPE_CUTOUT | 1 | Notch. | +| Name | Default Value| Description | +| ----------- | ------ | ------------------ | +| TYPE_SYSTEM | 0 | Default area of the system.| +| TYPE_CUTOUT | 1 | Notch. | ## WindowMode7+ @@ -39,13 +40,13 @@ This is a system API and cannot be called by third-party applications. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Default Value | Description | -| ---------- | ------------- | ------------------------------------------------------------ | -| UNDEFINED | 1 | The window mode is not defined by the application. | -| FULLSCREEN | 2 | The application is displayed in full screen. | -| PRIMARY | 3 | The application is displayed in the primary window in split-screen mode. | -| SECONDARY | 4 | The application is displayed in the secondary window in split-screen mode. | -| FLOATING | 5 | The application is displayed in a floating window. | +| Name | Default Value| Description | +| ---------- | ------ | ----------------------------- | +| UNDEFINED | 1 | The window mode is not defined by the application. | +| FULLSCREEN | 2 | The application is displayed in full screen. | +| PRIMARY | 3 | The application is displayed in the primary window in split-screen mode. | +| SECONDARY | 4 | The application is displayed in the secondary window in split-screen mode. | +| FLOATING | 5 | The application is displayed in a floating window.| ## SystemBarProperties @@ -53,14 +54,14 @@ Describes the properties of the status bar and navigation bar. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Type | Readable | Writable | Description | -| -------------------------------------- | ------- | -------- | -------- | ------------------------------------------------------------ | -| statusBarColor | string | Yes | Yes | Background color of the status bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**. | -| isStatusBarLightIcon7+ | boolean | No | Yes | Whether any icon on the status bar is highlighted. | -| statusBarContentColor8+ | string | No | Yes | Color of the text on the status bar. | -| navigationBarColor | string | Yes | Yes | Background color of the navigation bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**. | -| isNavigationBarLightIcon7+ | boolean | No | No | Whether any icon on the navigation bar is highlighted. | -| navigationBarContentColor8+ | string | No | Yes | Color of the text on the navigation bar. | +| Name | Type| Readable| Writable| Description | +| -------------------------------------- | -------- | ---- | ---- | ------------------------------------------------------------ | +| statusBarColor | string | Yes | Yes | Background color of the status bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**.| +| isStatusBarLightIcon7+ | boolean | No | Yes | Whether any icon on the status bar is highlighted. | +| statusBarContentColor8+ | string | No | Yes | Color of the text on the status bar. | +| navigationBarColor | string | Yes | Yes | Background color of the navigation bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**.| +| isNavigationBarLightIcon7+ | boolean | No | No | Whether any icon on the navigation bar is highlighted. | +| navigationBarContentColor8+ | string | No | Yes | Color of the text on the navigation bar. | ## SystemBarRegionTint8+ @@ -70,13 +71,13 @@ This is a system API and cannot be called by third-party applications. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Type | Readable | Writable | Description | -| --------------- | ------------------------- | -------- | -------- | ------------------------------------------------------------ | -| type | [WindowType](#windowtype) | Yes | Yes | Type of the system bar whose properties are changed. Only the navigation bar and status bar are supported. | -| isEnable | boolean | Yes | Yes | Whether the system bar is displayed. | -| region | [Rect](#rect) | Yes | Yes | Current position and size of the system bar. | -| backgroundColor | string | Yes | Yes | Background color of the system bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**. | -| contentColor | string | Yes | Yes | Color of the text on the system bar. | +| Name | Type | Readable| Writable| Description | +| --------------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ | +| type | [WindowType](#windowtype) | Yes | Yes | Type of the system bar whose properties are changed. Only the navigation bar and status bar are supported.| +| isEnable | boolean | Yes | Yes | Whether the system bar is displayed. | +| region | [Rect](#rect) | Yes | Yes | Current position and size of the system bar. | +| backgroundColor | string | Yes | Yes | Background color of the system bar. The value is a hexadecimal RGB or aRGB color value, for example, **\#00FF00** or **\#FF00FF00**.| +| contentColor | string | Yes | Yes | Color of the text on the system bar. | ## SystemBarTintState8+ @@ -86,10 +87,10 @@ This is a system API and cannot be called by third-party applications. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Type | Readable | Writable | Description | -| ---------- | -------------------------------------------------- | -------- | -------- | ----------------------------------- | -| displayId | number | Yes | No | ID of the current physical screen. | -| regionTint | Array<[SystemBarRegionTint](#systembartegiontint)> | Yes | Yes | All system bar information changed. | +| Name | Type | Readable| Writable| Description | +| ---------- | -------------------------------------------------- | ---- | ---- | -------------------------- | +| displayId | number | Yes | No | ID of the current physical screen. | +| regionTint | Array<[SystemBarRegionTint](#systembartegiontint)> | Yes | Yes | All system bar information changed.| ## Rect7+ @@ -97,12 +98,12 @@ Describes a rectangle. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Type | Readable | Writable | Description | -| ------ | ------ | -------- | -------- | ------------------------------- | -| left | number | Yes | Yes | Left boundary of the rectangle. | -| top | number | Yes | Yes | Top boundary of the rectangle. | -| width | number | Yes | Yes | Width of the rectangle. | -| height | number | Yes | Yes | Height of the rectangle. | +| Name | Type| Readable| Writable| Description | +| ------ | -------- | ---- | ---- | ------------------ | +| left | number | Yes | Yes | Left boundary of the rectangle.| +| top | number | Yes | Yes | Top boundary of the rectangle.| +| width | number | Yes | Yes | Width of the rectangle. | +| height | number | Yes | Yes | Height of the rectangle. | ## AvoidArea7+ @@ -110,12 +111,12 @@ Describes the area where the window cannot be displayed. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Type | Readable | Writable | Description | -| ---------- | ------------- | -------- | -------- | -------------------------------------- | -| leftRect | [Rect](#rect) | Yes | Yes | Rectangle on the left of the screen. | -| topRect | [Rect](#rect) | Yes | Yes | Rectangle at the top of the screen. | -| rightRect | [Rect](#rect) | Yes | Yes | Rectangle on the right of the screen. | -| bottomRect | [Rect](#rect) | Yes | Yes | Rectangle at the bottom of the screen. | +| Name | Type | Readable| Writable| Description | +| ---------- | ------------- | ---- | ---- | ------------------ | +| leftRect | [Rect](#rect) | Yes | Yes | Rectangle on the left of the screen.| +| topRect | [Rect](#rect) | Yes | Yes | Rectangle at the top of the screen.| +| rightRect | [Rect](#rect) | Yes | Yes | Rectangle on the right of the screen.| +| bottomRect | [Rect](#rect) | Yes | Yes | Rectangle at the bottom of the screen.| ## Size7+ @@ -123,10 +124,10 @@ Describes the window size. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Type | Readable | Writable | Description | -| ------ | ------ | -------- | -------- | -------------- | -| width | number | Yes | Yes | Window width. | -| height | number | Yes | Yes | Window height. | +| Name | Type| Readable| Writable| Description | +| ------ | -------- | ---- | ---- | ---------- | +| width | number | Yes | Yes | Window width.| +| height | number | Yes | Yes | Window height.| ## WindowProperties @@ -134,20 +135,20 @@ Describes the window properties. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Type | Readable | Writable | Description | -| ------------------------------- | ------------------------- | -------- | -------- | ------------------------------------------------------------ | -| windowRect7+ | [Rect](#rect) | Yes | Yes | Window size. | -| type7+ | [WindowType](#windowtype) | Yes | Yes | Window type. | -| isFullScreen | boolean | Yes | Yes | Whether the window is displayed in full screen mode. The default value is **false**. | -| isLayoutFullScreen7+ | boolean | Yes | Yes | Whether the window layout is in full-screen mode (whether the window is immersive). The default value is **false**. | -| focusable7+ | boolean | Yes | No | Whether the window can gain focus. The default value is **true**. | -| touchable7+ | boolean | Yes | No | Whether the window is touchable. The default value is **true**. | -| brightness | number | Yes | Yes | Screen brightness. The value ranges from 0 to 1. The value **1** indicates the maximum brightness.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. | -| dimBehindValue7+ | number | Yes | Yes | Dimness of the window that is not on top. The value ranges from 0 to 1. The value **1** indicates the maximum dimness.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. | -| isKeepScreenOn | boolean | Yes | Yes | Whether the screen is always on. The default value is **false**.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. | -| isPrivacyMode7+ | boolean | Yes | Yes | Whether the window is in privacy mode. The default value is **false**.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. | -| isRoundCorner7+ | boolean | Yes | Yes | Whether the window has rounded corners.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. | -| isTransparent7+ | boolean | Yes | Yes | Whether the window is transparent. The default value is **false**.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. | +| Name | Type | Readable| Writable| Description | +| ------------------------------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ | +| windowRect7+ | [Rect](#rect) | Yes | Yes | Window size. | +| type7+ | [WindowType](#windowtype) | Yes | Yes | Window type. | +| isFullScreen | boolean | Yes | Yes | Whether the window is displayed in full screen mode. The default value is **false**. | +| isLayoutFullScreen7+ | boolean | Yes | Yes | Whether the window layout is in full-screen mode (whether the window is immersive). The default value is **false**. | +| focusable7+ | boolean | Yes | No | Whether the window can gain focus. The default value is **true**. | +| touchable7+ | boolean | Yes | No | Whether the window is touchable. The default value is **true**. | +| brightness | number | Yes | Yes | Screen brightness. The value ranges from 0 to 1. The value **1** indicates the maximum brightness.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| +| dimBehindValue7+ | number | Yes | Yes | Dimness of the window that is not on top. The value ranges from 0 to 1. The value **1** indicates the maximum dimness.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| +| isKeepScreenOn | boolean | Yes | Yes | Whether the screen is always on. The default value is **false**.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| +| isPrivacyMode7+ | boolean | Yes | Yes | Whether the window is in privacy mode. The default value is **false**.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| +| isRoundCorner7+ | boolean | Yes | Yes | Whether the window has rounded corners.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| +| isTransparent7+ | boolean | Yes | Yes | Whether the window is transparent. The default value is **false**.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| ## ColorSpace8+ @@ -155,10 +156,10 @@ Describes the color gamut mode. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Default Value | Description | -| ---------- | ------------- | ------------------------- | -| DEFAULT | 0 | Default color gamut mode. | -| WIDE_GAMUT | 1 | Wide color gamut mode. | +| Name | Default Value| Description | +| ---------- | ------ | -------------- | +| DEFAULT | 0 | Default color gamut mode.| +| WIDE_GAMUT | 1 | Wide color gamut mode. | ## window.create7+ @@ -172,11 +173,11 @@ This API is discarded since API version 8. You are advised to use [window.create - Parameters - | Name | Type | Mandatory | Description | - | -------- | -------------------------------------- | --------- | ---------------------------------------------- | - | id | string | Yes | Window ID. | - | type | [WindowType](#windowtype) | Yes | Window type. | - | callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the subwindow created. | + | Name | Type | Mandatory| Description | + | -------- | -------------------------------------- | ---- | -------------------------- | + | id | string | Yes | Window ID. | + | type | [WindowType](#windowtype) | Yes | Window type. | + | callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the subwindow created.| - Example @@ -205,16 +206,16 @@ This API is discarded since API version 8. You are advised to use [window.create - Parameters - | Name | Type | Mandatory | Description | - | ---- | ------------------------- | --------- | ------------ | - | id | string | Yes | Window ID. | - | type | [WindowType](#windowtype) | Yes | Window type. | + | Name| Type | Mandatory| Description | + | ------ | ------------------------- | ---- | ---------- | + | id | string | Yes | Window ID. | + | type | [WindowType](#windowtype) | Yes | Window type.| - Return value - | Type | Description | - | -------------------------------- | --------------------------------------------- | - | Promise<[Window](#window)> | Promise used to return the subwindow created. | + | Type | Description | + | -------------------------------- | ------------------------------------------------- | + | Promise<[Window](#window)> | Promise used to return the subwindow created.| - Example @@ -233,18 +234,20 @@ This API is discarded since API version 8. You are advised to use [window.create create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback<Window>): void -Creates a system window when the context is [ServiceExtensionContext](js-apis-service-extension-context.md). This API uses an asynchronous callback to return the result. +Creates a subwindow when the context is [Context](js-apis-Context.md). This API uses an asynchronous callback to return the result. + +Creates a system window when the context is [ServiceExtensionContext](js-apis-service-extension-context.md), starting from API version 9. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.WindowManager.WindowManager.Core - Parameters - | Name | Type | Mandatory | Description | - | -------- | ----------------------------------------------- | --------- | -------------------------------------------------- | - | ctx | [Context](js-apis-service-extension-context.md) | Yes | Current application context. | - | id | string | Yes | Window ID. | - | type | [WindowType](#windowtype) | Yes | Window type. | - | callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the system window created. | + | Name | Type | Mandatory| Description | + | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | + | ctx | Context | Yes | Current application context.
For the definition of **Context** of API version 8, see [Context](js-apis-Context.md).
For the definition of **Context** of API version 9, see [Context](js-apis-service-extension-context.md).| + | id | string | Yes | Window ID. | + | type | [WindowType](#windowtype) | Yes | Window type. | + | callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the window created. | - Example @@ -265,23 +268,25 @@ Creates a system window when the context is [ServiceExtensionContext](js-apis-se create(ctx: Context, id: string, type: WindowType): Promise<Window> -Creates a system window when the context is [ServiceExtensionContext](js-apis-service-extension-context.md). This API uses a promise to return the result. +Creates a subwindow when the context is [Context](js-apis-Context.md). This API uses a promise to return the result. + +Creates a system window when the context is [ServiceExtensionContext](js-apis-service-extension-context.md), starting from API version 9. This API uses a promise to return the result. **System capability**: SystemCapability.WindowManager.WindowManager.Core - Parameters - | Name | Type | Mandatory | Description | - | ---- | ----------------------------------------------- | --------- | ---------------------------- | - | ctx | [Context](js-apis-service-extension-context.md) | Yes | Current application context. | - | id | string | Yes | Window ID. | - | type | [WindowType](#windowtype) | Yes | Window type. | + | Name| Type | Mandatory| Description | + | ------ | ------------------------- | ---- | ------------------------------------------------------------ | + | ctx | Context | Yes | Current application context.
For the definition of **Context** of API version 8, see [Context](js-apis-Context.md).
For the definition of **Context** of API version 9, see [Context](js-apis-service-extension-context.md).| + | id | string | Yes | Window ID. | + | type | [WindowType](#windowtype) | Yes | Window type. | - Return value - | Type | Description | - | -------------------------------- | ------------------------------------------------- | - | Promise<[Window](#window)> | Promise used to return the system window created. | + | Type | Description | + | -------------------------------- | ----------------------------------------------- | + | Promise<[Window](#window)> | Promise used to return the window created.| - Example @@ -296,7 +301,7 @@ Creates a system window when the context is [ServiceExtensionContext](js-apis-se }); ``` -## window.find7+ +## window.find7+ find(id: string, callback: AsyncCallback<Window>): void @@ -306,10 +311,10 @@ Finds a window based on the ID. This API uses an asynchronous callback to return - Parameters - | Name | Type | Mandatory | Description | - | -------- | -------------------------------------- | --------- | ----------------------------------------- | - | id | string | Yes | Window ID. | - | callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the window found. | + | Name | Type | Mandatory| Description | + | -------- | -------------------------------------- | ---- | ---------------------------- | + | id | string | Yes | Window ID. | + | callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the window found.| - Example @@ -335,15 +340,15 @@ Finds a window based on the ID. This API uses a promise to return the result. - Parameters - | Name | Type | Mandatory | Description | - | ---- | ------ | --------- | ----------- | - | id | string | Yes | Window ID. | + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------- | + | id | string | Yes | Window ID.| - Return value - | Type | Description | - | -------------------------------- | ---------------------------------------- | - | Promise<[Window](#window)> | Promise used to return the window found. | + | Type | Description | + | -------------------------------- | ----------------------------------------------- | + | Promise<[Window](#window)> | Promise used to return the window found.| - Example @@ -358,7 +363,7 @@ Finds a window based on the ID. This API uses a promise to return the result. }); ``` -## window.getTopWindow +## window.getTopWindow getTopWindow(callback: AsyncCallback<Window>): void @@ -368,9 +373,9 @@ Obtains the top window of the current application. This API uses an asynchronous - Parameters - | Name | Type | Mandatory | Description | - | -------- | -------------------------------------- | --------- | ------------------------------------------------ | - | callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the top window obtained. | + | Name | Type | Mandatory| Description | + | -------- | -------------------------------------- | ---- | -------------------------------------- | + | callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the top window obtained.| - Example @@ -396,9 +401,9 @@ Obtains the top window of the current application. This API uses a promise to re - Return value - | Type | Description | - | -------------------------------- | ----------------------------------------------- | - | Promise<[Window](#window)> | Promise used to return the top window obtained. | + | Type | Description | + | -------------------------------- | --------------------------------------------------------- | + | Promise<[Window](#window)> | Promise used to return the top window obtained.| - Example @@ -423,10 +428,10 @@ Obtains the top window of the current application. This API uses an asynchronous - Parameters - | Name | Type | Mandatory | Description | - | -------- | -------------------------------------- | --------- | ------------------------------------------------------------ | - | ctx | Context | Yes | Current application context.For the definition of **Context** of API version 8, see [Context](js-apis-Context.md). For the definition of **Context** of API version 9, see [Context](js-apis-ability-context.md). | - | callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the top window obtained. | + | Name | Type | Mandatory| Description | + | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | + | ctx | Context | Yes | Current application context.
For the definition of **Context** of API version 8, see [Context](js-apis-Context.md).
For the definition of **Context** of API version 9, see [Context](js-apis-ability-context.md).| + | callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the top window obtained. | - Example @@ -452,15 +457,15 @@ Obtains the top window of the current application. This API uses a promise to re - Parameters - | Name | Type | Mandatory | Description | - | ---- | ------- | --------- | ------------------------------------------------------------ | - | ctx | Context | Yes | Current application context.For the definition of **Context** of API version 8, see [Context](js-apis-Context.md). For the definition of **Context** of API version 9, see [Context](js-apis-ability-context.md). | + | Name| Type | Mandatory| Description | + | ------ | ------- | ---- | ------------------------------------------------------------ | + | ctx | Context | Yes | Current application context.
For the definition of **Context** of API version 8, see [Context](js-apis-Context.md).
For the definition of **Context** of API version 9, see [Context](js-apis-ability-context.md).| - Return value - | Type | Description | - | -------------------------------- | ----------------------------------------------- | - | Promise<[Window](#window)> | Promise used to return the top window obtained. | + | Type | Description | + | -------------------------------- | --------------------------------------------------------- | + | Promise<[Window](#window)> | Promise used to return the top window obtained.| - Example @@ -479,7 +484,7 @@ Obtains the top window of the current application. This API uses a promise to re on(type: 'systemBarTintChange', callback: Callback<SystemBarTintState>): void -Enables listening for the properties changes of the status bar and navigation bar. +Enables listening for properties changes of the status bar and navigation bar. This is a system API and cannot be called by third-party applications. @@ -487,10 +492,10 @@ This is a system API and cannot be called by third-party applications. - Parameters - | Name | Type | Mandatory | Description | - | -------- | --------------------------------------------------------- | --------- | ------------------------------------------------------------ | - | type | string | Yes | Listening type.
Set it to **systemBarTintChange**, which indicates listening for properties changes of the status bar and navigation bar. | - | callback | Callback<[SystemBarTintState](#systembartintstate)> | Yes | Callback used to return the information. | + | Name | Type | Mandatory| Description | + | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | + | type | string | Yes | Listening type.
Set it to **systemBarTintChange**, which indicates listening for properties changes of the status bar and navigation bar.| + | callback | Callback<[SystemBarTintState](#systembartintstate)> | Yes | Callback used to return the information. | - Example @@ -513,10 +518,10 @@ This is a system API and cannot be called by third-party applications. - Parameters - | Name | Type | Mandatory | Description | - | -------- | --------------------------------------------------------- | --------- | ------------------------------------------------------------ | - | type | string | Yes | Listening type.
Set it to **systemBarTintChange**, which indicates listening for properties changes of the status bar and navigation bar. | - | callback | Callback<[SystemBarTintState](#systembartintstate)> | No | Callback used to return the information. | + | Name | Type | Mandatory| Description | + | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | + | type | string | Yes | Listening type.
Set it to **systemBarTintChange**, which indicates listening for properties changes of the status bar and navigation bar.| + | callback | Callback<[SystemBarTintState](#systembartintstate)> | No | Callback used to return the information. | - Example @@ -527,7 +532,7 @@ This is a system API and cannot be called by third-party applications. ## Window -In the following API examples, you must use [getTopWindow()](#window-gettopwindow), [create()](#windowcreate7), or [find()](#window-find) to obtain a **Window** instance and then call a method in this instance. +In the following API examples, you must use [getTopWindow()](#windowgettopwindow), [create()](#windowcreate7), or [find()](#windowfind7) to obtain a **Window** instance and then call a method in this instance. ### hide7+ @@ -541,9 +546,9 @@ This is a system API and cannot be called by third-party applications. - Parameters - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | --------- | --------------------------------------------- | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | -------- | ------------------------- | ---- | ---------- | + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result.| - Example @@ -569,9 +574,9 @@ This is a system API and cannot be called by third-party applications. - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -594,9 +599,9 @@ Shows this window. This API uses an asynchronous callback to return the result. - Parameters - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | --------- | --------------------------------------------- | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | -------- | ------------------------- | ---- | ---------- | + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result.| - Example @@ -620,9 +625,9 @@ Shows this window. This API uses a promise to return the result. - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -645,9 +650,9 @@ Destroys this window. This API uses an asynchronous callback to return the resul - Parameters - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | --------- | --------------------------------------------- | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | -------- | ------------------------- | ---- | ---------- | + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result.| - Example @@ -671,9 +676,9 @@ Destroys this window. This API uses a promise to return the result. - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -696,11 +701,11 @@ Moves the position of this window. This API uses an asynchronous callback to ret - Parameters - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | --------- | ------------------------------------------------------------ | - | x | number | Yes | Distance that the window moves along the x-axis. A positive value indicates that the window moves to the right. | - | y | number | Yes | Distance that the window moves along the y-axis. A positive value indicates that the window moves downwards. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | -------- | ------------------------- | ---- | --------------------------------------- | + | x | number | Yes | Distance that the window moves along the x-axis. A positive value indicates that the window moves to the right.| + | y | number | Yes | Distance that the window moves along the y-axis. A positive value indicates that the window moves downwards.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -725,16 +730,16 @@ Moves the position of this window. This API uses a promise to return the result. - Parameters - | Name | Type | Mandatory | Description | - | ---- | ------ | --------- | ------------------------------------------------------------ | - | x | number | Yes | Distance that the window moves along the x-axis. A positive value indicates that the window moves to the right. | - | y | number | Yes | Distance that the window moves along the y-axis. A positive value indicates that the window moves downwards. | + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | --------------------------------------- | + | x | number | Yes | Distance that the window moves along the x-axis. A positive value indicates that the window moves to the right.| + | y | number | Yes | Distance that the window moves along the y-axis. A positive value indicates that the window moves downwards.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -757,11 +762,11 @@ Changes the size of this window. This API uses an asynchronous callback to retur - Parameters - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | --------- | --------------------------------------------- | - | width | number | Yes | New width of the window. | - | height | number | Yes | New height of the window. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | -------- | ------------------------- | ---- | ---------------- | + | width | number | Yes | New width of the window.| + | height | number | Yes | New height of the window.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -785,16 +790,16 @@ Changes the size of this window. This API uses a promise to return the result. - Parameters - | Name | Type | Mandatory | Description | - | ------ | ------ | --------- | ------------------------- | - | width | number | Yes | New width of the window. | - | height | number | Yes | New height of the window. | + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------- | + | width | number | Yes | New width of the window.| + | height | number | Yes | New height of the window.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -819,10 +824,10 @@ This is a system API and cannot be called by third-party applications. - Parameters - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | --------- | --------------------------------------------- | - | type | [WindowType](#windowtype) | Yes | Window type. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | -------- | ------------------------- | ---- | ---------- | + | type | [WindowType](#windowtype) | Yes | Window type.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result.| - Example @@ -849,15 +854,15 @@ This is a system API and cannot be called by third-party applications. - Parameters - | Name | Type | Mandatory | Description | - | ---- | ------------------------- | --------- | ------------ | - | type | [WindowType](#windowtype) | Yes | Window type. | + | Name| Type | Mandatory| Description | + | ------ | ------------------------- | ---- | ---------- | + | type | [WindowType](#windowtype) | Yes | Window type.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -881,9 +886,9 @@ Obtains the properties of this window. This API uses an asynchronous callback to - Parameters - | Name | Type | Mandatory | Description | - | -------- | ---------------------------------------------------------- | --------- | ---------------------------------------------- | - | callback | AsyncCallback<[WindowProperties](#windowproperties)> | Yes | Callback used to return the window properties. | + | Name | Type | Mandatory| Description | + | -------- | ---------------------------------------------------------- | ---- | ------------------ | + | callback | AsyncCallback<[WindowProperties](#windowproperties)> | Yes | Callback used to return the window properties.| - Example @@ -907,13 +912,13 @@ Obtains the properties of this window. This API uses a promise to return the res - Return value - | Type | Description | - | ---------------------------------------------------- | --------------------------------------------- | - | Promise<[WindowProperties](#windowproperties)> | Promise used to return the window properties. | + | Type | Description | + | ---------------------------------------------------- | ------------------------------------- | + | Promise<[WindowProperties](#windowproperties)> | Promise used to return the window properties.| - Example - ``` + ```js let promise = windowClass.getProperties(); promise.then((data)=> { console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data)) @@ -932,10 +937,10 @@ Obtains the area where this window cannot be displayed, for example, the system - Parameters - | Name | Type | Mandatory | Description | - | -------- | -------------------------------------------- | --------- | ------------------------------------------------------------ | - | type | [AvoidAreaType](#avoidareatype) | Yes | Type of the area. **TYPE_SYSTEM** indicates the default area of the system. **TYPE_CUTOUT** indicates the notch. | - | callback | AsyncCallback<[AvoidArea](#avoidarea)> | Yes | Callback used to return the area. | + | Name | Type | Mandatory| Description | + | -------- | -------------------------------------------- | ---- | ------------------------------------------------------------ | + | type | [AvoidAreaType](#avoidareatype) | Yes | Type of the area. **TYPE_SYSTEM** indicates the default area of the system. **TYPE_CUTOUT** indicates the notch.| + | callback | AsyncCallback<[AvoidArea](#avoidarea)> | Yes | Callback used to return the area. | - Example @@ -960,15 +965,15 @@ Obtains the area where this window cannot be displayed, for example, the system - Parameters - | Name | Type | Mandatory | Description | - | ---- | ------------------------------- | --------- | ------------------------------------------------------------ | - | type | [AvoidAreaType](#avoidareatype) | Yes | Type of the area. **TYPE_SYSTEM** indicates the default area of the system. **TYPE_CUTOUT** indicates the notch. | + | Name| Type | Mandatory| Description | + | ------ | ------------------------------- | ---- | ------------------------------------------------------------ | + | type | [AvoidAreaType](#avoidareatype) | Yes | Type of the area. **TYPE_SYSTEM** indicates the default area of the system. **TYPE_CUTOUT** indicates the notch.| - Return value - | Type | Description | - | -------------------------------------- | -------------------------------- | - | Promise<[AvoidArea](#avoidarea)> | Promise used to return the area. | + | Type | Description | + | -------------------------------------- | --------------------------------------------- | + | Promise<[AvoidArea](#avoidarea)> | Promise used to return the area.| - Example @@ -991,10 +996,10 @@ Sets whether to enable the full-screen mode for this window. This API uses an as - Parameters - | Name | Type | Mandatory | Description | - | ------------ | ------------------------- | --------- | ------------------------------------------------------------ | - | isFullScreen | boolean | Yes | Whether to enable the full-screen mode, in which the status bar and navigation bar are hidden. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | ------------ | ------------------------- | ---- | ---------------------------------------------- | + | isFullScreen | boolean | Yes | Whether to enable the full-screen mode, in which the status bar and navigation bar are hidden.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -1019,15 +1024,15 @@ Sets whether to enable the full-screen mode for this window. This API uses a pro - Parameters - | Name | Type | Mandatory | Description | - | ------------ | ------- | --------- | ------------------------------------------------------------ | - | isFullScreen | boolean | Yes | Whether to enable the full-screen mode, in which the status bar and navigation bar are hidden. | + | Name | Type | Mandatory| Description | + | ------------ | ------- | ---- | ---------------------------------------------- | + | isFullScreen | boolean | Yes | Whether to enable the full-screen mode, in which the status bar and navigation bar are hidden.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -1051,10 +1056,10 @@ Sets whether the window layout is in full-screen mode. This API uses an asynchro - Parameters - | Name | Type | Mandatory | Description | - | ------------------ | ------------------------- | --------- | ------------------------------------------------------------ | - | isLayoutFullScreen | boolean | Yes | Whether the window layout is in full-screen mode, in which the status bar and navigation bar are displayed. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | ------------------ | ------------------------- | ---- | ------------------------------------------------------------ | + | isLayoutFullScreen | boolean | Yes | Whether the window layout is in full-screen mode, in which the status bar and navigation bar are displayed.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -1079,15 +1084,15 @@ Sets whether the window layout is in full-screen mode. This API uses a promise t - Parameters - | Name | Type | Mandatory | Description | - | ------------------ | ------- | --------- | ------------------------------------------------------------ | - | isLayoutFullScreen | boolean | Yes | Whether the window layout is in full-screen mode, in which the status bar and navigation bar are displayed. | + | Name | Type | Mandatory| Description | + | ------------------ | ------- | ---- | ------------------------------------------------------------ | + | isLayoutFullScreen | boolean | Yes | Whether the window layout is in full-screen mode, in which the status bar and navigation bar are displayed.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -1111,10 +1116,10 @@ Sets whether to display the status bar and navigation bar in this window. This A - Parameters - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | --------- | ------------------------------------------------------------ | - | names | Array | Yes | Whether to display the status bar and navigation bar. For example, to display the status bar and navigation bar, set this parameter to **["status", "navigation"]**. By default, they are not displayed. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | -------- | ------------------------- | ---- | ------------------------------------------------------------ | + | names | Array | Yes | Whether to display the status bar and navigation bar. For example, to display the status bar and navigation bar, set this parameter to **["status", "navigation"]**. By default, they are not displayed.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -1139,15 +1144,15 @@ Sets whether to display the status bar and navigation bar in this window. This A - Parameters - | Name | Type | Mandatory | Description | - | ----- | ----- | --------- | ------------------------------------------------------------ | - | names | Array | Yes | Whether to display the status bar and navigation bar. For example, to display the status bar and navigation bar, set this parameter to **["status", "navigation"]**. By default, they are not displayed. | + | Name| Type | Mandatory| Description | + | ------ | ----- | ---- | ------------------------------------------------------------ | + | names | Array | Yes | Whether to display the status bar and navigation bar. For example, to display the status bar and navigation bar, set this parameter to **["status", "navigation"]**. By default, they are not displayed.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -1171,10 +1176,10 @@ Sets the properties of the status bar and navigation bar in this window. This AP - Parameters - | Name | Type | Mandatory | Description | - | ------------------- | ------------------------------------------- | --------- | ------------------------------------------------ | - | SystemBarProperties | [SystemBarProperties](#systembarproperties) | Yes | Properties of the status bar and navigation bar. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | ------------------- | ------------------------------------------- | ---- | -------------------- | + | SystemBarProperties | [SystemBarProperties](#systembarproperties) | Yes | Properties of the status bar and navigation bar.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -1208,15 +1213,15 @@ Sets the properties of the status bar and navigation bar in this window. This AP - Parameters - | Name | Type | Mandatory | Description | - | ------------------- | ------------------------------------------- | --------- | ------------------------------------------------ | - | SystemBarProperties | [SystemBarProperties](#systembarproperties) | Yes | Properties of the status bar and navigation bar. | + | Name | Type | Mandatory| Description | + | ------------------- | ------------------------------------------- | ---- | -------------------- | + | SystemBarProperties | [SystemBarProperties](#systembarproperties) | Yes | Properties of the status bar and navigation bar.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -1249,10 +1254,10 @@ Loads content to this window. This API uses an asynchronous callback to return t - Parameters - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | --------- | ------------------------------------------------------- | - | path | string | Yes | Path of the page from which the content will be loaded. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | -------- | ------------------------- | ---- | -------------------- | + | path | string | Yes | Path of the page from which the content will be loaded.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -1276,15 +1281,15 @@ Loads content to this window. This API uses a promise to return the result. - Parameters - | Name | Type | Mandatory | Description | - | ---- | ------ | --------- | ------------------------------------------------------- | - | path | string | Yes | Path of the page from which the content will be loaded. | + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------- | + | path | string | Yes | Path of the page from which the content will be loaded.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -1307,9 +1312,9 @@ Checks whether this window is displayed. This API uses an asynchronous callback - Parameters - | Name | Type | Mandatory | Description | - | -------- | ---------------------------- | --------- | -------------------------------------------------------- | - | callback | AsyncCallback<boolean> | Yes | Callback used to return whether the window is displayed. | + | Name | Type | Mandatory| Description | + | -------- | ---------------------------- | ---- | -------------------------------- | + | callback | AsyncCallback<boolean> | Yes | Callback used to return whether the window is displayed.| - Example @@ -1333,9 +1338,9 @@ Checks whether this window is displayed. This API uses a promise to return the r - Return value - | Type | Description | - | ---------------------- | ------------------------------------------------------- | - | Promise<boolean> | Promise used to return whether the window is displayed. | + | Type | Description | + | ---------------------- | ----------------------------------------------------- | + | Promise<boolean> | Promise used to return whether the window is displayed.| - Example @@ -1358,10 +1363,10 @@ Enables listening for window size changes. - Parameters - | Name | Type | Mandatory | Description | - | -------- | ----------------------------- | --------- | ------------------------------------------------------------ | - | type | string | Yes | Listening type.
Set it to **windowSizeChange**, which indicates listening for window size changes. | - | callback | Callback<[Size](#size)> | Yes | Callback used to return the information. | + | Name | Type | Mandatory| Description | + | -------- | ----------------------------- | ---- | ------------------------------------------------------------ | + | type | string | Yes | Listening type.
Set it to **windowSizeChange**, which indicates listening for window size changes.| + | callback | Callback<[Size](#size)> | Yes | Callback used to return the information. | - Example @@ -1382,10 +1387,10 @@ Disables listening for window size changes. - Parameters - | Name | Type | Mandatory | Description | - | -------- | ----------------------------- | --------- | ------------------------------------------------------------ | - | type | string | Yes | Listening type.
Set it to **windowSizeChange7+**, which indicates listening for window size changes. | - | callback | Callback<[Size](#size)> | No | Callback used to return the information. | + | Name | Type | Mandatory| Description | + | -------- | ----------------------------- | ---- | ------------------------------------------------------------ | + | type | string | Yes | Listening type.
Set it to **windowSizeChange7+**, which indicates listening for window size changes.| + | callback | Callback<[Size](#size)> | No | Callback used to return the information. | - Example @@ -1404,10 +1409,10 @@ Enables listening for changes to the area where the window cannot be displayed. - Parameters - | Name | Type | Mandatory | Description | - | -------- | --------------------------------------- | --------- | ------------------------------------------------------------ | - | type | string | Yes | Listening type.
Set it to **systemAvoidAreaChange**, which indicates listening for changes to the area where the window cannot be displayed. | - | callback | Callback<[AvoidArea](#avoidarea)> | Yes | Callback used to return the information. | + | Name | Type | Mandatory| Description | + | -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | + | type | string | Yes | Listening type.
Set it to **systemAvoidAreaChange**, which indicates listening for changes to the area where the window cannot be displayed.| + | callback | Callback<[AvoidArea](#avoidarea)> | Yes | Callback used to return the information. | - Example @@ -1428,10 +1433,10 @@ Disables listening for changes to the area where the window cannot be displayed. - Parameters - | Name | Type | Mandatory | Description | - | -------- | --------------------------------------- | --------- | ------------------------------------------------------------ | - | type | string | Yes | Listening type.
Set it to **systemAvoidAreaChange**, which indicates listening for changes to the area where the window cannot be displayed. | - | callback | Callback<[AvoidArea](#avoidarea)> | No | Callback used to return the information. | + | Name | Type | Mandatory| Description | + | -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | + | type | string | Yes | Listening type.
Set it to **systemAvoidAreaChange**, which indicates listening for changes to the area where the window cannot be displayed.| + | callback | Callback<[AvoidArea](#avoidarea)> | No | Callback used to return the information. | - Example @@ -1452,10 +1457,10 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | -------- | ---------------------- | --------- | ------------------------------------------------------------ | - | type | string | Yes | Listening type.
Set it to **keyboardHeightChange**, which indicates listening for keyboard height changes. | - | callback | Callback<number> | Yes | Callback used to return the information. | + | Name | Type | Mandatory| Description | + | -------- | ------------------ | ---- | ------------------------------------------------------------ | + | type | string | Yes | Listening type.
Set it to **keyboardHeightChange**, which indicates listening for keyboard height changes.| + | callback | Callbacknumber> | Yes | Callback used to return the information. | - Example @@ -1478,10 +1483,10 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | -------- | ---------------------- | --------- | ------------------------------------------------------------ | - | type | string | Yes | Listening type.
Set it to **keyboardHeightChange**, which indicates listening for keyboard height changes. | - | callback | Callback<number> | No | Callback used to return the information. | + | Name | Type | Mandatory| Description | + | -------- | ---------------------- | ---- | ------------------------------------------------------------ | + | type | string | Yes | Listening type.
Set it to **keyboardHeightChange**, which indicates listening for keyboard height changes.| + | callback | Callback<number> | No | Callback used to return the information. | - Example @@ -1500,9 +1505,9 @@ Checks whether this window supports the wide color gamut mode. This API uses an - Parameters - | Name | Type | Mandatory | Description | - | -------- | ---------------------------- | --------- | ------------------------------------------------------------ | - | callback | AsyncCallback<boolean> | Yes | Callback used to return whether the wide color gamut mode is supported. | + | Name | Type | Mandatory| Description | + | -------- | ---------------------------- | ---- | -------------------------------- | + | callback | AsyncCallback<boolean> | Yes | Callback used to return whether the wide color gamut mode is supported.| - Example @@ -1526,13 +1531,13 @@ Checks whether this window supports the wide color gamut mode. This API uses a p - Return value - | Type | Description | + | Type | Description | | ---------------------- | ------------------------------------------------------------ | - | Promise<boolean> | Promise used to return whether the wide color gamut mode is supported. | + | Promise<boolean> | Promise used to return whether the wide color gamut mode is supported.| - Example - ```js + ``` let promise = windowClass.isSupportWideGamut(); promise.then((data)=> { console.info('Succeeded in checking whether the window support WideGamut. Data: ' + JSON.stringify(data)) @@ -1551,10 +1556,10 @@ Sets this window to the wide or default color gamut mode. This API uses an async - Parameters - | Name | Type | Mandatory | Description | - | ---------- | ------------------------- | --------- | --------------------------------------------- | - | colorSpace | [ColorSpace](#colorspace) | Yes | Color gamut mode. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | ---------- | ------------------------- | ---- | ------------ | + | colorSpace | [ColorSpace](#colorspace) | Yes | Color gamut mode.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -1578,15 +1583,15 @@ Sets this window to the wide or default color gamut mode. This API uses a promis - Parameters - | Name | Type | Mandatory | Description | - | ---------- | ------------------------- | --------- | ----------------- | - | colorSpace | [ColorSpace](#colorspace) | Yes | Color gamut mode. | + | Name | Type | Mandatory| Description | + | ---------- | ------------------------- | ---- | ------------ | + | colorSpace | [ColorSpace](#colorspace) | Yes | Color gamut mode.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -1609,9 +1614,9 @@ Obtains the color gamut mode of this window. This API uses an asynchronous callb - Parameters - | Name | Type | Mandatory | Description | - | -------- | ---------------------------------------------- | --------- | ------------------------------------------------------ | - | callback | AsyncCallback<[ColorSpace](#colorspace)> | Yes | Callback used to return the color gamut mode obtained. | + | Name | Type | Mandatory| Description | + | -------- | ---------------------------------------------- | ---- | -------------------------- | + | callback | AsyncCallback<[ColorSpace](#colorspace)> | Yes | Callback used to return the color gamut mode obtained.| - Example @@ -1635,9 +1640,9 @@ Obtains the color gamut mode of this window. This API uses a promise to return t - Return value - | Type | Description | - | ---------------------------------------- | ----------------------------------------------------- | - | Promise<[ColorSpace](#colorspace)> | Promise used to return the color gamut mode obtained. | + | Type | Description | + | ---------------------------------------- | ----------------------------------------- | + | Promise<[ColorSpace](#colorspace)> | Promise used to return the color gamut mode obtained.| - Example @@ -1662,10 +1667,10 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | --------- | ------------------------------------------------------------ | - | color | string | Yes | Background color to set. The color is a hexadecimal value, for example, #00FF00 or #FF00FF00. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | -------- | ------------------------- | ---- | ------------------------------------------------------------ | + | color | string | Yes | Background color to set. The color is a hexadecimal value, for example, #00FF00 or #FF00FF00.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -1692,15 +1697,15 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | ----- | ------ | --------- | ------------------------------------------------------------ | - | color | string | Yes | Background color to set. The color is a hexadecimal value, for example, #00FF00 or #FF00FF00. | + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------------------------------------------ | + | color | string | Yes | Background color to set. The color is a hexadecimal value, for example, #00FF00 or #FF00FF00.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -1726,10 +1731,10 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | ---------- | ------------------------- | --------- | ------------------------------------------------------------ | - | brightness | number | Yes | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | ---------- | ------------------------- | ---- | ------------------------------------ | + | brightness | number | Yes | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -1756,15 +1761,15 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | ---------- | ------ | --------- | ------------------------------------------------------------ | - | brightness | number | Yes | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest. | + | Name | Type | Mandatory| Description | + | ---------- | ------ | ---- | ------------------------------------ | + | brightness | number | Yes | Brightness to set, which ranges from 0 to 1. The value **1** indicates the brightest.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -1790,10 +1795,10 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | -------------- | ------------------------- | --------- | ------------------------------------------------------------ | - | dimBehindValue | number | Yes | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | -------------- | ------------------------- | ---- | -------------------------------------------------- | + | dimBehindValue | number | Yes | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -1819,15 +1824,15 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | -------------- | ------ | --------- | ------------------------------------------------------------ | - | dimBehindValue | number | Yes | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest. | + | Name | Type | Mandatory| Description | + | -------------- | ------ | ---- | -------------------------------------------------- | + | dimBehindValue | number | Yes | Dimness of the window to set. The value ranges from 0 to 1. The value **1** indicates the dimmest.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -1852,10 +1857,10 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | ----------- | ------------------------- | --------- | --------------------------------------------- | - | isFocusable | boolean | Yes | Whether the window can gain focus. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | ----------- | ------------------------- | ---- | ---------------------------- | + | isFocusable | boolean | Yes | Whether the window can gain focus.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -1882,15 +1887,15 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | ----------- | ------- | --------- | ---------------------------------- | - | isFocusable | boolean | Yes | Whether the window can gain focus. | + | Name | Type | Mandatory| Description | + | ----------- | ------- | ---- | ---------------------------- | + | isFocusable | boolean | Yes | Whether the window can gain focus.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -1916,10 +1921,10 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | -------------- | ------------------------- | --------- | --------------------------------------------- | - | isKeepScreenOn | boolean | Yes | Whether to keep the screen always on. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | -------------- | ------------------------- | ---- | ------------------------ | + | isKeepScreenOn | boolean | Yes | Whether to keep the screen always on.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -1946,15 +1951,15 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | -------------- | ------- | --------- | ------------------------------------- | - | isKeepScreenOn | boolean | Yes | Whether to keep the screen always on. | + | Name | Type | Mandatory| Description | + | -------------- | ------- | ---- | ------------------------ | + | isKeepScreenOn | boolean | Yes | Whether to keep the screen always on.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -1980,10 +1985,10 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | --------- | ------------------------- | --------- | ------------------------------------------------------------ | - | touchable | boolean | Yes | Whether the area outside the subwindow is touchable. The value **true** means that such an area is touchable, and **false** means the opposite. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | --------- | ------------------------- | ---- | ---------------- | + | touchable | boolean | Yes | Whether the area outside the subwindow is touchable. The value **true** means that such an area is touchable, and **false** means the opposite.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -2009,15 +2014,15 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | --------- | ------- | --------- | ------------------------------------------------------------ | - | touchable | boolean | Yes | Whether the area outside the subwindow is touchable. The value **true** means that such an area is touchable, and **false** means the opposite. | + | Name | Type | Mandatory| Description | + | --------- | ------- | ---- | ---------------- | + | touchable | boolean | Yes | Whether the area outside the subwindow is touchable. The value **true** means that such an area is touchable, and **false** means the opposite.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -2042,10 +2047,10 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | ------------- | ------------------------- | --------- | --------------------------------------------- | - | isPrivacyMode | boolean | Yes | Whether the window is in privacy mode. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | ------------- | ------------------------- | ---- | -------------------- | + | isPrivacyMode | boolean | Yes | Whether the window is in privacy mode.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -2073,15 +2078,15 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | ------------- | ------- | --------- | -------------------------------------- | - | isPrivacyMode | boolean | Yes | Whether the window is in privacy mode. | + | Name | Type | Mandatory| Description | + | ------------- | ------- | ---- | -------------------- | + | isPrivacyMode | boolean | Yes | Whether the window is in privacy mode.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -2107,10 +2112,10 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | ----------- | ------------------------- | --------- | --------------------------------------------- | - | isTouchable | boolean | Yes | Whether the window is touchable. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | ----------- | ------------------------- | ---- | -------------------- | + | isTouchable | boolean | Yes | Whether the window is touchable.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -2138,15 +2143,15 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a - Parameters - | Name | Type | Mandatory | Description | - | ----------- | ------- | --------- | -------------------------------- | - | isTouchable | boolean | Yes | Whether the window is touchable. | + | Name | Type | Mandatory| Description | + | ----------- | ------- | ---- | -------------------- | + | isTouchable | boolean | Yes | Whether the window is touchable.| - Return value - | Type | Description | - | ------------------- | -------------------------------------------- | - | Promise<void> | Promise used to return the execution result. | + | Type | Description | + | ------------------- | ----------------------------------------------- | + | Promise<void> | Promise used to return the execution result.| - Example @@ -2166,12 +2171,12 @@ Describes the lifecycle of a window stage. **System capability**: SystemCapability.WindowManager.WindowManager.Core -| Name | Default Value | Description | -| ---------- | ------------- | ---------------------------------------------- | -| FOREGROUND | 1 | The window stage is running in the foreground. | -| ACTIVE | 2 | The window stage gains focus. | -| INACTIVE | 3 | The window stage loses focus. | -| BACKGROUND | 4 | The window stage is running in the background. | +| Name | Default Value| Description | +| ---------- | ------ | -------- | +| FOREGROUND | 1 | The window stage is running in the foreground.| +| ACTIVE | 2 | The window stage gains focus.| +| INACTIVE | 3 | The window stage loses focus.| +| BACKGROUND | 4 | The window stage is running in the background.| ## WindowStage9+ @@ -2187,9 +2192,9 @@ Obtains the main window of this window stage. This API uses a promise to return - Return value - | Type | Description | - | -------------------------------- | --------------------------------------- | - | Promise<[Window](#window)> | Promise used to return the main window. | + | Type | Description | + | -------------------------------- | ---------------------------------------------------------- | + | Promise<[Window](#window)> | Promise used to return the main window.| - Example @@ -2219,9 +2224,9 @@ Obtains the main window of this window stage. This API uses an asynchronous call - Parameters - | Name | Type | Mandatory | Description | - | -------- | -------------------------------------- | --------- | ---------------------------------------- | - | callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the main window. | + | Name | Type | Mandatory| Description | + | -------- | -------------------------------------- | ---- | --------------------------------------- | + | callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the main window.| - Example @@ -2252,15 +2257,15 @@ Creates a subwindow for this window stage. This API uses a promise to return the - Parameters - | Name | Type | Mandatory | Description | - | ---- | ------ | --------- | ---------------------- | - | name | String | Yes | Name of the subwindow. | + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------- | + | name | String | Yes | Name of the subwindow.| - Return value - | Type | Description | - | -------------------------------- | --------------------------------------------- | - | Promise<[Window](#window)> | Promise used to return the subwindow created. | + | Type | Description | + | -------------------------------- | ------------------------------------------------- | + | Promise<[Window](#window)> | Promise used to return the subwindow created.| - Example @@ -2290,10 +2295,10 @@ Creates a subwindow for this window stage. This API uses an asynchronous callbac - Parameters - | Name | Type | Mandatory | Description | - | -------- | -------------------------------------- | --------- | ---------------------------------------------- | - | name | String | Yes | Name of the subwindow. | - | callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the subwindow created. | + | Name | Type | Mandatory| Description | + | -------- | -------------------------------------- | ---- | ------------------------------ | + | name | String | Yes | Name of the subwindow. | + | callback | AsyncCallback<[Window](#window)> | Yes | Callback used to return the subwindow created.| - Example @@ -2325,9 +2330,9 @@ Obtains all the subwindows of this window stage. This API uses a promise to retu - Return value - | Type | Description | - | --------------------------------------------- | ------------------------------------------ | - | Promise<Array<[Window](#window)>> | Promise used to return all the subwindows. | + | Type | Description | + | --------------------------------------------- | ------------------------------------------------------------ | + | Promise<Array<[Window](#window)>> | Promise used to return all the subwindows.| - Example @@ -2357,9 +2362,9 @@ Obtains all the subwindows of this window stage. This API uses an asynchronous c - Parameters - | Name | Type | Mandatory | Description | - | -------- | --------------------------------------------------- | --------- | ------------------------------------------- | - | callback | AsyncCallback<Array<[Window](#window)>> | Yes | Callback used to return all the subwindows. | + | Name | Type | Mandatory| Description | + | -------- | --------------------------------------------------- | ---- | ------------------------------------------- | + | callback | AsyncCallback<Array<[Window](#window)>> | Yes | Callback used to return all the subwindows.| - Example @@ -2390,10 +2395,10 @@ Loads content to this window stage. This API uses an asynchronous callback to re - Parameters - | Name | Type | Mandatory | Description | - | -------- | ------------------------- | --------- | ------------------------------------------------------- | - | path | string | Yes | Path of the page from which the content will be loaded. | - | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | + | Name | Type | Mandatory| Description | + | -------- | ------------------------- | ---- | -------------------- | + | path | string | Yes | Path of the page from which the content will be loaded.| + | callback | AsyncCallback<void> | Yes | Callback used to return the execution result. | - Example @@ -2422,10 +2427,10 @@ Enables listening for window stage lifecycle changes. - Parameters - | Name | Type | Mandatory | Description | - | -------- | ------------------------------------------------------------ | --------- | ------------------------------------------------------------ | - | type | string | Yes | Listening type.
Set it to **windowStageEvent**, which indicates listening for window stage lifecycle changes. | - | callback | Callback<[WindowStageEventType](#windowstageeventtype9)> | Yes | Callback used to return the information. | + | Name | Type | Mandatory| Description | + | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | + | type | string | Yes | Listening type.
Set it to **windowStageEvent**, which indicates listening for window stage lifecycle changes.| + | callback | Callback<[WindowStageEventType](#windowstageeventtype9)> | Yes | Callback used to return the information. | - Example @@ -2451,10 +2456,10 @@ Disables listening for window stage lifecycle changes. - Parameters - | Name | Type | Mandatory | Description | - | -------- | ------------------------------------------------------------ | --------- | ------------------------------------------------------------ | - | type | string | Yes | Listening type.
Set it to **windowStageEvent**, which indicates listening for window stage lifecycle changes. | - | callback | Callback<[WindowStageEventType](#windowstageeventtype9)> | No | Callback used to return the information. | + | Name | Type | Mandatory| Description | + | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | + | type | string | Yes | Listening type.
Set it to **windowStageEvent**, which indicates listening for window stage lifecycle changes.| + | callback | Callback<[WindowStageEventType](#windowstageeventtype9)> | No | Callback used to return the information. | - Example diff --git a/en/application-dev/telephony/Readme-EN.md b/en/application-dev/telephony/Readme-EN.md new file mode 100644 index 0000000000000000000000000000000000000000..a5a60273c71f7002efa6f8cb862848c3f169de9d --- /dev/null +++ b/en/application-dev/telephony/Readme-EN.md @@ -0,0 +1,5 @@ +# Telephony + +- [Telephony Service Overview](telephony-overview.md) +- [Redirecting to the Dial Screen](jumping-to-the-dial-screen.md) +- [Obtaining Current Cellular Network Signal Information](cellular-network-signal-info.md) diff --git a/en/application-dev/telephony/cellular-network-signal-info.md b/en/application-dev/telephony/cellular-network-signal-info.md new file mode 100644 index 0000000000000000000000000000000000000000..41cb90c05493cb4ce12313a9bd194cb14835f4a9 --- /dev/null +++ b/en/application-dev/telephony/cellular-network-signal-info.md @@ -0,0 +1,51 @@ +# Obtaining Current Cellular Network Signal Information + + +## Use Cases + +Applications always need to obtain signal information of the registered cellular network to obtain the network quality. You can use this service to obtain the network signal information for the specified SIM card. + + +## Available APIs + +The radio module provides you with APIs to obtain network signal information. The observer module provides APIs to register or unregister the observer for cellular network status changes. The following table describes the related APIs. + +| Category| API| Description| Required Permission| +| -------- | -------- | -------- | -------- | +| Obtaining a **SignalInformation** object| radio.getSignalInformation​​() | Obtains the signal strength of the currently registered cellular network.| N/A| +| Registering the observer for signal information changes| observer.on('signalInfoChange') | Registers the observer for signal information changes.| N/A| +| Unregistering the observer for signal information changes| observer.off('signalInfoChange') | Unregisters the observer for signal information changes.| N/A| + + +## How to Develop + +1. Import required modules. + +2. Call the **getSignalInformation()** API to obtain the **SignalInformation** list. + +3. Traverse the **SignalInformation** list to obtain the signal strength for each radio access technology (RAT) indicated by **signalType**. + +4. (Optional) Register the observer for signal information changes. + + ```js + import radio from '@ohos.telephony.radio' + import observer from '@ohos.telephony.observer'; + + // Obtain the signal strength of the specified SIM card, for example, card 1. + let slotId = 0; + radio.getSignalInformation(slotId, (err, data) => { + if (!err) { + console.log("get signal information success."); + // Traverse the signal information list to obtain the signal strength for each RAT. + for (let j = 0; j < data.length; j++) { + console.log("type:" + data[j].signalType + ", level:" + data[j].signalLevel); + } + } else { + console.log("get signal information fail, err is:" + JSON.stringify(err)); + } + }); + // (Optional) Register the observer for signal information changes. + observer.on("signalInfoChange", (data) => { + console.log("signal info change, data is:" + JSON.stringify(data)); + }); + ``` diff --git a/en/application-dev/telephony/jumping-to-the-dial-screen.md b/en/application-dev/telephony/jumping-to-the-dial-screen.md new file mode 100644 index 0000000000000000000000000000000000000000..17e25b8def58082d335bd836b35fd446a6e2591c --- /dev/null +++ b/en/application-dev/telephony/jumping-to-the-dial-screen.md @@ -0,0 +1,51 @@ +# Redirecting to the Dial Screen + +You can use this service for your application to redirect users to the dial screen and display the dialed number. When the **makeCall** API is called, the phone or tablet will automatically display the dial screen. On this screen, the user can choose to make an audio or video call and specify the SIM card. + + +## Available APIs + +The call module provides APIs for call management. The observer module provides APIs to register or unregister an observer for call service status changes. The following table describes the related APIs. + +| Category| API| Description| Required Permission| +| -------- | -------- | -------- | -------- | +| Checking call capabilities| call.hasVoiceCapability() | Checks whether the voice call function is supported.| N/A| +| Redirecting to the dial screen| call.makeCall() | Enables redirection to the dial screen and display of the dialed number.| N/A| +| Registering the observer for call service status changes| observer.on('callStateChange') | Registers the observer for call service status changes.| ohos.permission.READ_CALL_LOG (required for obtaining phone numbers)| +| Unregistering the observer for call service status changes| observer.off('callStateChange') | Unregisters the observer for call service status changes.| N/A| + + +## How to Develop + +1. Import required modules. + +2. Invoke the **hasVoiceCapability()** API to check whether the call function is supported. If supported, go to step 3; otherwise, calls will be rejected. + +3. Enable redirection to the dial screen and display of the dialed number. + +4. (Optional) Register the observer for call service status changes. + + ```js + // Import the required modules. + import call from '@ohos.telephony.call'; + import observer from '@ohos.telephony.observer'; + + // Check whether the voice call function is supported. + let isSupport = call.hasVoiceCapability(); + if (!isSupport) { + console.log("not support voice capability, return."); + return; + } + // If the voice call function is supported, the user will be redirected to the dial screen and the dialed number is displayed. + call.makeCall("13xxxx", (err)=> { + if (!err) { + console.log("make call success."); + } else { + console.log("make call fail, err is:" + JSON.stringify(err)); + } + }); + // (Optional) Register the observer for call service status changes. + observer.on("callStateChange", (data) => { + console.log("call state change, data is:" + JSON.stringify(data)); + }); + ``` diff --git a/en/application-dev/telephony/telephony-overview.md b/en/application-dev/telephony/telephony-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..0622cde754c524766cc24c21b8d83a3b6df9d954 --- /dev/null +++ b/en/application-dev/telephony/telephony-overview.md @@ -0,0 +1,14 @@ +# Telephony Service Overview + +The Telephony subsystem provides a series of APIs for [making calls](../reference/apis/js-apis-call.md), [obtaining current cellular network signal information](../reference/apis/js-apis-telephony-data.md) and [managing SIM cards](../reference/apis/js-apis-sim.md). + +Your application can call related APIs to obtain the name of the currently registered network, network service status, signal strength, and SIM card information. For details, see [Obtaining Current Cellular Network Signal Information](cellular-network-signal-info.md). + +To make calls, your application needs to declear the **ohos.permission.PLACE_CALL** permission. It is recommended that the application use **makeCall()** to redirect users to the dial screen and display the dialed number. For details, see [Redirecting to the Dial Screen](jumping-to-the-dial-screen.md). + + +## Constraints + +The accommodating device must be equipped with the following hardware: + + A modem and a SIM card capable of independent cellular communication. diff --git a/en/application-dev/windowmanager/window-guidelines.md b/en/application-dev/windowmanager/window-guidelines.md index 3dbbb4b74066f85a609c53a5a5a1206834c7a8ba..e312f4c415e9067f42ef632a99b73fa853357bdf 100644 --- a/en/application-dev/windowmanager/window-guidelines.md +++ b/en/application-dev/windowmanager/window-guidelines.md @@ -12,7 +12,7 @@ For details about the APIs, see [Window](../reference/apis/js-apis-window.md). | API | Description | | :----------------------------------------------------------- | :--------------------------------------------- | | create(id: string, type: WindowType, callback: AsyncCallback\): void | Creates a subwindow. | -| moveTo(x: number, y: number): Promise\ | Moves the window position. A positive value of **x** indicates that the window moves to the right, and a positive value of **y** indicates that the window moves downwards.| +| moveTo(x: number, y: number): Promise\ | Moves the window. A positive value of **x** indicates that the window moves to the right, and a positive value of **y** indicates that the window moves downwards.| | resetSize(width: number, height: number): Promise\ | Changes the window size. | | hide(): Promise\ | Hides the window. | | destroy(): Promise\ | Destroys the window. | diff --git a/en/application-dev/windowmanager/window-overview.md b/en/application-dev/windowmanager/window-overview.md index 170a6eaf76ac73b33b73355ad0039d8d76617ab3..8e776a43741d11ca3bb1d047f3ea5d330fd90586 100644 --- a/en/application-dev/windowmanager/window-overview.md +++ b/en/application-dev/windowmanager/window-overview.md @@ -1,13 +1,13 @@ # Window Overview The Window Manager subsystem provides basic capabilities of window management. It is the basis for UI display. -The Window Manager subsystem enables multiple applications to use the same physical screen for display and interaction. For each application, you need to design the interaction interface in the fixed window area. A window acts as a display container of the application interface, and the Window Manager subsystem organizes the interaction interfaces into a form visible to end users. +The Window Manager subsystem enables multiple applications to simultaneously display on the same screen and interact with users. For each application, you need to design the interaction interface in the fixed window area. A window acts as a display container of the application UI, and the Window Manager subsystem organizes the interaction UIs into a form visible to end users. ## Basic Concepts -** Immersive**: The colors of the application interface, status bar, and navigation bar are the same to achieve the visual integrity. +**Immersive**: The colors of the application UI, status bar, and navigation bar are the same to achieve the visual integrity. ## Working Principles -To display a UI on a screen, the application and system need to request a window object from the Window Manager subsystem. This object generally represents a rectangular area on the screen and has attributes such as the position, width, height, and overlay layer. The object also loads the root node of the UI framework in the interface. The UI of the application is loaded and displayed in the window through the root node. +To display a UI on a screen, the application and system need to request a window object from the Window Manager subsystem. This object generally represents a rectangular area on the screen and has attributes such as the position, width, height, and overlay layer. The object also loads the root node of the UI framework, through which the application UI is loaded and displayed in the window. diff --git a/en/device-dev/Readme-EN.md b/en/device-dev/Readme-EN.md index ef05ff616b6163224cc4113dfb87aad509c54d4b..beaa8563a7e804992c8df5d6b9a93899a2cb2612 100644 --- a/en/device-dev/Readme-EN.md +++ b/en/device-dev/Readme-EN.md @@ -2,7 +2,7 @@ - [Device Development Overview](device-dev-guide.md) - Learn About OpenHarmony - - [OpenHarmony Community](../OpenHarmony-Overview.md) + - [OpenHarmony Project](../OpenHarmony-Overview.md) - [Glossary](../glossary.md) - [Release Notes](../release-notes/Readme.md) - Quick Start @@ -13,6 +13,7 @@ - Porting - [Third-Party Library Porting Guide for Mini and Small Systems](porting/porting-thirdparty.md) - [Mini System SoC Porting Guide](porting/porting-minichip.md) + - [Mini System SoC Porting Cases](porting/porting-minichip-cases.md) - [Small System SoC Porting Guide](porting/porting-smallchip.md) - [Standard System SoC Porting Guide](porting/standard-system-porting-guide.md) - Subsystem Development diff --git a/en/device-dev/driver/driver-peripherals-touch-des.md b/en/device-dev/driver/driver-peripherals-touch-des.md index 2402d94695593a612e1690780c49756932410ffb..461af2c0e7471a6691d9a69ab4c8cb269421a0aa 100644 --- a/en/device-dev/driver/driver-peripherals-touch-des.md +++ b/en/device-dev/driver/driver-peripherals-touch-des.md @@ -88,7 +88,7 @@ Perform the following steps: 1. Add the touchscreen driver-related descriptions. - Currently, the input driver is developed based on the HDF and is loaded and started by the HDF. Register the driver information, such as whether to load the driver and the loading priority in the configuration file. Then, the HDF starts the registered driver modules one by one. For details about the driver configuration, see [Driver Development](driver-hdf-development.md#how-to-develop). + Currently, the input driver is developed based on the HDF and is loaded and started by the HDF. Register the driver information, such as whether to load the driver and the loading priority in the configuration file. Then, the HDF starts the registered driver modules one by one. For details about the driver configuration, see [How to Develop](driver-hdf-development.md#how-to-develop). 2. Complete the board-level configuration and private data configuration of the touchscreen. diff --git a/en/device-dev/faqs/faqs.md b/en/device-dev/faqs/faqs.md deleted file mode 100644 index 30d98fdb8c641e646626d7e4b9c0a42abe01e691..0000000000000000000000000000000000000000 --- a/en/device-dev/faqs/faqs.md +++ /dev/null @@ -1,19 +0,0 @@ -# FAQs - - - -- **[FAQs Overview](faqs-overview.md)** - -- **[Environment Setup](faqs-environment-setup.md)** - -- **[Compilation and Building Subsystem](faqs-building.md)** - -- **[Burning](faqs-burning.md)** - -- **[Kernel](faqs-kernel.md)** - -- **[Porting](faqs-porting.md)** - -- **[Startup](faqs-startup.md)** - -- **[System Applications](faqs-system-applications.md)** diff --git a/en/device-dev/quick-start/quickstart-ide-lite-overview.md b/en/device-dev/quick-start/quickstart-ide-lite-overview.md index 0c8a543a8c9d0731f063ae7e4d14b4ee473a6e09..f23028f755bd48bb7c7f6ce8f1c05370551565ab 100644 --- a/en/device-dev/quick-start/quickstart-ide-lite-overview.md +++ b/en/device-dev/quick-start/quickstart-ide-lite-overview.md @@ -12,7 +12,7 @@ To accommodate different developer habits, OpenHarmony provides two modes for ge - Installation package mode: Dependency download and installation as well as building operations are performed using commands. Burning and running are performed in DevEco Device Tool. OpenHarmony also provides the [Docker environment](../get-code/gettools-acquire.md), which can significantly simplify the environment configuration before compilation. You can build your source code in the Docker environment if you are more accustomed to using the installation package mode. -This document exemplifies how to use the IDE mode. For details about the installation package mode, see [Getting Started with Mini and Small Systems (Installation Package Mode)](../quick-start/quickstart-lite-package-directory.md). +This document exemplifies how to use the IDE mode. For details about the installation package mode, see [Getting Started with Mini and Small Systems (Installation Package Mode)](../quick-start/quickstart-lite-overview.md). ## Development Environment @@ -28,7 +28,7 @@ This document describes how to develop OpenHarmony in the Windows+Ubuntu environ ## Development Boards -In this document, two development board models are used as examples: Hi3861 and Hi3516D V300. For details about these development boards, see [Appendix](../quick-start/quickstart-ide-lite-board-introduction.md). You can purchase the development board as required. +In this document, two development board models are used as examples: Hi3861 and Hi3516D V300. For details about these development boards, see [Appendix](../quick-start/quickstart-ide-lite-introduction-hi3861.md). You can purchase the development board as required. ## Development Process diff --git a/en/device-dev/quick-start/quickstart-lite-overview.md b/en/device-dev/quick-start/quickstart-lite-overview.md index d3a580e6766caf3cb699088ffbb9d2f82575255b..478e08faa121d531456a8365999fe443d2d058ee 100644 --- a/en/device-dev/quick-start/quickstart-lite-overview.md +++ b/en/device-dev/quick-start/quickstart-lite-overview.md @@ -15,7 +15,7 @@ To accommodate different developer habits, OpenHarmony provides two modes for ge - Installation package mode: Dependency download and installation as well as building operations are performed using commands. Burning and running are performed in DevEco Device Tool. OpenHarmony also provides the [Docker environment](../get-code/gettools-acquire.md), which can significantly simplify the environment configuration before compilation. You can build your source code in the Docker environment if you are more accustomed to using the installation package mode. -This document exemplifies how to use the installation package mode. For details about the IDE mode, see [Getting Started with Mini and Small Systems (IDE Mode)](../quick-start/quickstart-lite-ide-directory.md). +This document exemplifies how to use the installation package mode. For details about the IDE mode, see [Getting Started with Mini and Small Systems (IDE Mode)](../quick-start/quickstart-ide-lite-overview.md). ## Development Environment @@ -31,7 +31,7 @@ This document describes how to develop OpenHarmony in the Windows+Ubuntu environ ## Development Boards -In this document, two development board models are used as examples: Hi3861 and Hi3516D V300. For details about these development boards, see [Appendix](../quick-start/quickstart-lite-board-introduction.md). You can purchase the development board as required. +In this document, two development board models are used as examples: Hi3861 and Hi3516D V300. For details about these development boards, see [Appendix](../quick-start/quickstart-lite-introduction-hi3861.md). You can purchase the development board as required. ## Development Process diff --git a/en/device-dev/quick-start/quickstart-standard-overview.md b/en/device-dev/quick-start/quickstart-standard-overview.md index 8b2dfb427ff73c4b4247cec57a079f9e790f6f8d..b7bb434f6b1ac67d26f86d4fab96b7041e9456d8 100644 --- a/en/device-dev/quick-start/quickstart-standard-overview.md +++ b/en/device-dev/quick-start/quickstart-standard-overview.md @@ -12,7 +12,7 @@ To accommodate different developer habits, OpenHarmony provides two modes for ge - Installation package mode: Dependency download and installation as well as building operations are performed using commands. Burning and running are performed in DevEco Device Tool. OpenHarmony also provides the [Docker environment](../get-code/gettools-acquire.md), which can significantly simplify the environment configuration before compilation. You can build your source code in the Docker environment if you are more accustomed to using the installation package mode. -This document exemplifies how to use the installation package mode. For details about the IDE mode, see [Getting Started with Standard System (IDE Mode)](../quick-start/quickstart-standard-ide-directory.md). +This document exemplifies how to use the installation package mode. For details about the IDE mode, see [Getting Started with Standard System (IDE Mode)](../quick-start/quickstart-ide-standard-overview.md). ## Development Environment @@ -28,7 +28,7 @@ This document describes how to develop OpenHarmony in the Windows+Ubuntu environ ## Development Boards -In this document, two development board models are used as examples: Hi3516D V300 and RK3516. For details about these development boards, see [Appendix](../quick-start/quickstart-standard-board-introduction.md). You can purchase the development board as required. +In this document, two development board models are used as examples: Hi3516D V300 and RK3516. For details about these development boards, see [Appendix](../quick-start/quickstart-standard-board-introduction-hi3516.md). You can purchase the development board as required. ## Development Process diff --git a/en/device-dev/subsystems/Readme-EN.md b/en/device-dev/subsystems/Readme-EN.md index 7944e2584de50c8fac855e10095d1533d7b90ab2..a573b2da8c58648fa59d65e40c241a622d21368e 100644 --- a/en/device-dev/subsystems/Readme-EN.md +++ b/en/device-dev/subsystems/Readme-EN.md @@ -53,7 +53,7 @@ - [Sensor Usage Guidelines](subsys-sensor-guide.md) - [Sensor Usage Example](subsys-sensor-demo.md) - [USB](subsys-usbservice.md) - - [[USB Overview](subsys-usbservice-overview.md) + - [USB Overview](subsys-usbservice-overview.md) - [USB Usage Guidelines](subsys-usbservice-guide.md) - [USB Usage Example](subsys-usbservice-demo.md) - [Application Framework](subsys-application-framework.md) diff --git a/en/device-dev/subsystems/subsys-security-devicesecuritylevel.md b/en/device-dev/subsystems/subsys-security-devicesecuritylevel.md index e123f16859967aca7377d941f8f6075837debbe6..1cf6b52c7b81e674783d71b2d6f0c0b4b13c51a0 100644 --- a/en/device-dev/subsystems/subsys-security-devicesecuritylevel.md +++ b/en/device-dev/subsystems/subsys-security-devicesecuritylevel.md @@ -94,7 +94,8 @@ All the APIs are native C interfaces for implementing underlying capabilities an // Obtain the device security level from the device security level information. ret = GetDeviceSecurityLevelValue(info, &level); if (ret == SUCCESS) { - // The operation is successful. + //The level is successfully queried. + FreeDeviceSecurityInfo(info); return; } // Release the memory before the processing is complete. @@ -126,6 +127,7 @@ void CheckDestDeviceSecurityLevel(const DeviceIdentify *device, RequestOption *o ret = GetDeviceSecurityLevelValue(info, &level); if (ret != SUCCESS) { // Failed to obtain the security level. You can develop a retry process as required. + FreeDeviceSecurityInfo(info); return; } // After the device security level is successfully obtained, check the lowest security level required for the current operation. @@ -151,6 +153,7 @@ void DeviceSecurityInfoCallback(const DeviceIdentify *identify, struct DeviceSec int32_t ret = GetDeviceSecurityLevelValue(info, &level); if (ret != SUCCESS) { // Failed to obtain the information. You can develop a retry process as required. + FreeDeviceSecurityInfo(info); return; } // After the device security level is successfully obtained, check the lowest security level required for the current operation. diff --git a/en/device-dev/website.md b/en/device-dev/website.md index d6bd03140cbfde3c726d346bb55c62d3fdf43f1a..d3fc645c6b26a7fc8aaafff70db332f2267cba5a 100644 --- a/en/device-dev/website.md +++ b/en/device-dev/website.md @@ -21,9 +21,8 @@ - [Burning](quick-start/quickstart-ide-lite-steps-hi3516-burn.md) - [Running](quick-start/quickstart-ide-lite-steps-hi3516-running.md) - Appendix - - Introduction to Development Boards - - [Introduction to the Hi3861 Development Board](quick-start/quickstart-ide-lite-introduction-hi3861.md) - - [Introduction to the Hi3516 Development Board](quick-start/quickstart-ide-lite-introduction-hi3516.md) + - [Introduction to the Hi3861 Development Board](quick-start/quickstart-ide-lite-introduction-hi3861.md) + - [Introduction to the Hi3516 Development Board](quick-start/quickstart-ide-lite-introduction-hi3516.md) - Getting Started with Mini and Small Systems (Installation Package Mode) - [Mini and Small System Overview](quick-start/quickstart-lite-overview.md) - [Environment Preparation](quick-start/quickstart-lite-env-setup.md) @@ -69,9 +68,8 @@ - [Burning](quick-start/quickstart-ide-standard-running-rk3568-burning.md) - [Running](quick-start/quickstart-ide-standard-running-rk3568-running.md) - Appendix - - Introduction to Development Boards - - [Introduction to the Hi3516 Development Board](quick-start/quickstart-ide-standard-board-introduction-hi3516.md) - - [Introduction to the RK3568 Development Board](quick-start/quickstart-ide-standard-board-introduction-rk3568.md) + - [Introduction to the Hi3516 Development Board](quick-start/quickstart-ide-standard-board-introduction-hi3516.md) + - [Introduction to the RK3568 Development Board](quick-start/quickstart-ide-standard-board-introduction-rk3568.md) - Getting Started with Standard System (Installation Package Mode) - [Standard System Overview](quick-start/quickstart-standard-overview.md) - [Setting Up Environments for Standard System](quick-start/quickstart-standard-env-setup.md) @@ -95,7 +93,7 @@ - [Introduction to the Hi3516 Development Board](quick-start/quickstart-standard-board-introduction-hi3516.md) - [Introduction to the RK3568 Development Board](quick-start/quickstart-standard-board-introduction-rk3568.md) - [Reference](quick-start/quickstart-standard-reference.md) - - [Obtaining Source Code](get-code/sourcecode-acquire.md) + - [Obtaining Source Code](get-code/sourcecode-acquire.md) - Compatibility and Security - [Privacy Protection](security/security-privacy-protection.md) - [Security Guidelines](security/security-guidelines-overall.md) @@ -329,32 +327,40 @@ - [Driver Configuration Management](driver/driver-hdf-manage.md) - [HDF Development Example](driver/driver-hdf-sample.md) - Platform Driver Development - - [ADC](driver/driver-platform-adc-develop.md) - - [GPIO](driver/driver-platform-gpio-develop.md) - - [HDMI](driver/driver-platform-hdmi-develop.md) - - [I2C](driver/driver-platform-i2c-develop.md) - - [I3C](driver/driver-platform-i3c-develop.md) - - [MIPI DSI](driver/driver-platform-mipidsi-develop.md) - - [MMC](driver/driver-platform-mmc-develop.md) - - [PWM](driver/driver-platform-pwm-develop.md) - - [RTC](driver/driver-platform-rtc-develop.md) - - [SDIO](driver/driver-platform-sdio-develop.md) - - [SPI](driver/driver-platform-spi-develop.md) - - [UART](driver/driver-platform-uart-develop.md) - - [Watchdog](driver/driver-platform-watchdog-develop.md) + - [ADC](driver-platform-adc-develop.md) + - [DAC](driver-platform-dac-develop.md) + - [GPIO](driver-platform-gpio-develop.md) + - [HDMI](driver-platform-hdmi-develop.md) + - [I2C](driver-platform-i2c-develop.md) + - [I3C](driver-platform-i3c-develop.md) + - [MIPI CSI](driver-platform-mipicsi-develop.md) + - [MIPI DSI](driver-platform-mipidsi-develop.md) + - [MMC](driver-platform-mmc-develop.md) + - [PIN](driver-platform-pin-develop.md) + - [PWM](driver-platform-pwm-develop.md) + - [Regulator](driver-platform-regulator-develop.md) + - [RTC](driver-platform-rtc-develop.md) + - [SDIO](driver-platform-sdio-develop.md) + - [SPI](driver-platform-spi-develop.md) + - [UART](driver-platform-uart-develop.md) + - [WatchDog](driver-platform-watchdog-develop.md) - Platform Driver Usage - - [ADC](driver/driver-platform-adc-des.md) - - [GPIO](driver/driver-platform-gpio-des.md) - - [HDMI](driver/driver-platform-hdmi-des.md) - - [I2C](driver/driver-platform-i2c-des.md) - - [I3C](driver/driver-platform-i3c-des.md) - - [MIPI DSI](driver/driver-platform-mipidsi-des.md) - - [PWM](driver/driver-platform-pwm-des.md) - - [RTC](driver/driver-platform-rtc-des.md) - - [SDIO](driver/driver-platform-sdio-des.md) - - [SPI](driver/driver-platform-spi-des.md) - - [UART](driver/driver-platform-uart-des.md) - - [Watchdog](driver/driver-platform-watchdog-des.md) + - [ADC](driver-platform-adc-des.md) + - [DAC](driver-platform-dac-des.md) + - [GPIO](driver-platform-gpio-des.md) + - [HDMI](driver-platform-hdmi-des.md) + - [I2C](driver-platform-i2c-des.md) + - [I3C](driver-platform-i3c-des.md) + - [MIPI CSI](driver-platform-mipicsi-des.md) + - [MIPI DSI](driver-platform-mipidsi-des.md) + - [PIN](driver-platform-pin-des.md) + - [PWM](driver-platform-pwm-des.md) + - [Regulator](driver-platform-regulator-des.md) + - [RTC](driver-platform-rtc-des.md) + - [SDIO](driver-platform-sdio-des.md) + - [SPI](driver-platform-spi-des.md) + - [UART](driver-platform-uart-des.md) + - [WatchDog](driver-platform-watchdog-des.md) - Peripheral Driver Usage - [LCD](driver/driver-peripherals-lcd-des.md) - [Touchscreen](driver/driver-peripherals-touch-des.md) @@ -363,6 +369,8 @@ - [Audio](driver/driver-peripherals-audio-des.md) - [USB](driver/driver-peripherals-usb-des.md) - [Camera](driver/driver-peripherals-camera-des.md) + - [Vibrator](driver-peripherals-vibrator-des.md) + - [Light](driver-peripherals-light-des.md) - Compilation and Building - [Building Guidelines for Mini and Small Systems](subsystems/subsys-build-mini-lite.md) - [Building Guidelines for Standard Systems](subsystems/subsys-build-standard-large.md) @@ -416,7 +424,7 @@ - [Sensor Usage Guidelines](subsystems/subsys-sensor-guide.md) - [Sensor Usage Example](subsystems/subsys-sensor-demo.md) - USB - - [[USB Overview](subsystems/subsys-usbservice-overview.md) + - [USB Overview](subsystems/subsys-usbservice-overview.md) - [USB Usage Guidelines](subsystems/subsys-usbservice-guide.md) - [USB Usage Example](subsystems/subsys-usbservice-demo.md) - Application Framework @@ -442,7 +450,7 @@ - [syspara Module](subsystems/subsys-boot-syspara.md) - [FAQs](subsystems/subsys-boot-faqs.md) - [Reference](subsystems/subsys-boot-ref.md) - - [Testing](subsystems/subsys-testguide-test.md) + - [Test](subsystems/subsys-testguide-test.md) - DFX - [DFX](subsystems/subsys-dfx-overview.md) - [HiLog Development](subsystems/subsys-dfx-hilog-rich.md) diff --git a/en/readme/ARK-Runtime-Subsystem.md b/en/readme/ARK-Runtime-Subsystem.md index 442914d30a797fa96c93b2f156662f00eac9298a..b6b996810926a8694574e94a2c24cfc537bbe6ba 100644 --- a/en/readme/ARK-Runtime-Subsystem.md +++ b/en/readme/ARK-Runtime-Subsystem.md @@ -1,6 +1,6 @@ # ArkCompiler JS Runtime -Introduction +## Introduction ArkCompiler is a built-in componentized and configurable multi-language compilation and runtime platform of OpenHarmony. It contains core components such as the compiler, toolchain, and runtime. It supports compilation and running of high-level programming languages on the multi-chip platform. It accelerates the running of the OpenHarmony standard operating system and its applications and services on mobile phones, PCs, tablets, TVs, automobiles, and smart wearables. ArkCompiler JS Runtime provides the capability of compiling and running the JavaScript (JS) language on the OpenHarmony operating system. @@ -33,7 +33,7 @@ ArkCompiler JS Runtime consists of four subsystems: JS Compiler Subsystem consists of the Stub compiler, optimized compilation framework based on the Circuit IR, and code generator. - JS Runtime subsystem - + JS Runtime Subsystem contains various modules related to JS runtime: - Memory management: object allocator and garbage collector (CMS-GC and Partial-Compressing-GC for concurrent marking and partial memory compression) - Analysis tools: DFX tool and CPU and heap profiling tool @@ -49,16 +49,16 @@ ArkCompiler JS Runtime consists of four subsystems: - Native support for TS. The common way to process TS in the industry is to convert TS into JS and execute JS code with JS runtime. ts2abc is planned to analyze and obtain the TS type information when compiling the TS source code and send the information to ArkCompiler JS Runtime. ArkCompiler JS Runtime directly uses the type information to statically generate inline caching to accelerate bytecode execution. The TS Ahead of Time (AOT) compiler directly converts the source code into high-quality machine code based on the TS type information sent from ts2abc, which greatly improves the running performance. -- Lightweight Actor concurrency model: ECMAScript does not provide concurrency specifications. The Actor concurrency model is commonly used in JS engines in the industry to implement concurrent processing. In this model, executors do not share data and communicate with each other using the messaging mechanism. The JS Actor model (web-worker) in the industry has defects such as slow startup and high memory usage. ArkCompiler JS Runtime is required to provide the Actor implementation that features fast startup and low memory usage to better leverage the device's multi-core feature to improve performance. Now ARK-JS is able to share immutable objects, methods, and bytecodes (built-in code blocks and constant strings in the future) in Actor instances based on the Actor memory isolation model to accelerate the startup of JS Actor, reduce memory overhead, and implement the lightweight Actor concurrency model. +- Lightweight Actor concurrency model: ECMAScript does not provide concurrency specifications. The Actor concurrency model is commonly used in JS engines in the industry to implement concurrent processing. In this model, executors do not share data and communicate with each other using the messaging mechanism. The JS Actor model (web-worker) in the industry has defects such as slow startup and high memory usage. ArkCompiler JS Runtime is required to provide the Actor implementation that features fast startup and low memory usage to better leverage the device's multi-core feature to improve performance. Now ArkCompiler JS Runtime is able to share immutable objects, methods, and bytecodes (built-in code blocks and constant strings in the future) in Actor instances based on the Actor memory isolation model to accelerate the startup of JS Actor, reduce memory overhead, and implement the lightweight Actor concurrency model. -- Cross-language interaction of TS/C++: In the API implementation, it is common for C/C++ code to access and operate TS objects in OpenHarmony. ArkCompiler JS Runtime is planned to statically generate a C/C++ header file that contains the TS object layout description and the C/C++ implementation library for operating the TS object based on the class declaration and runtime conventions in the TS program. The C/C++ code usually includes the TS object layout description header file and the corresponding implementation library to implement the direct operation on the TS object. The TS type or its internal layout is not always fixed. Therefore, in the code implementation for TS object operations, type check is used. If the object type or layout changes during runtime, the common slow path is rolled back. +- Cross-language interaction of TS and C++: In the API implementation, it is common for C/C++ code to access and operate TS objects in OpenHarmony. ArkCompiler JS Runtime is planned to statically generate a C/C++ header file that contains the TS object layout description and the C/C++ implementation library for operating the TS object based on the class declaration and runtime conventions in the TS program. The C/C++ code usually includes the TS object layout description header file and the corresponding implementation library to implement the direct operation on the TS object. The TS type or its internal layout is not always fixed. Therefore, in the code implementation for TS object operations, type check is used. If the object type or layout changes during runtime, the common slow path is rolled back. ## Directory Structure ``` /ark ├── js_runtime # JS runtime module -├── runtime_core # Runtime common module +├── runtime_core # Runtime core subsystem └── ts2abc # JS frontend tool ``` diff --git a/en/readme/compilation-and-building.md b/en/readme/compilation-and-building.md new file mode 100644 index 0000000000000000000000000000000000000000..e4493c817ba1fd1092cc21f8ac7f875d99379607 --- /dev/null +++ b/en/readme/compilation-and-building.md @@ -0,0 +1,57 @@ +# Compilation and Building + + +The compilation and building subsystem provides a framework based on Generate Ninja (GN) and Ninja. This subsystem allows you to: + +- Build products based on different chipset platforms, for example, Hi3516D V300. + +- Package capabilities required by a product by assembling modules based on the product configuration. + +## Basic Concepts + +It is considered best practice to learn the following basic concepts before you start building: + +- Platform + + A combination of development boards and kernels. Supported subsystems and components vary with the platform. + +- Subsystem + + OpenHarmony is designed with a layered architecture, which consists of the kernel layer, system service layer, framework layer, and application layer from the bottom up. System functions are developed by the level of system, subsystem, and component. In a multi-device deployment scenario, you can customize subsystems and components as required. A subsystem is a logical concept and is a flexible combination of components. + +- Component + + A component is a reusable software unit that contains source code, configuration files, resource files, and build scripts. A component can be built independently, integrated in binary mode, and then tested independently. + +- GN + + GN is a system used to generate build files for Ninja. + +- Ninja + + Ninja is a small high-speed build system. + + +## Working Principles + +The compilation and build process of OpenHarmony is as follows: + +- Parsing commands: Parse the name of the product to build and load related configurations. +- Running GN: Configure the toolchain and global options based on the parsed product name and compilation type. +- Running Ninja: Start building and generate a product distribution. + +## Building a Mini or Small System + +See [build\_lite](https://gitee.com/openharmony/build_lite/blob/master/README.md). + +## Building a Standard System + +See the readme of the **build** repository. + +## Repositories Involved + +**Compilation and building** + +[build\_lite](https://gitee.com/openharmony/build_lite) + +[build](https://gitee.com/openharmony/build) diff --git a/en/website.md b/en/website.md index a8f292a9e62802211c0be117912b786205ede054..7a5374affa4e0848b8a963ec98521e72e7be5bf6 100644 --- a/en/website.md +++ b/en/website.md @@ -1,501 +1,31 @@ -# OpenHarmony Device Development Documentation -- [Device Development Overview](device-dev-guide.md) - -- Getting Started - - - Getting Started with Mini and Small Systems (IDE Mode) - - [Mini and Small System Overview](quick-start/quickstart-ide-lite-overview.md) - - Environment Preparation - - [Setting Up the Windows+Ubuntu Hybrid Development Environment](quick-start/quickstart-ide-lite-env-setup-win-ubuntu.md) - - [Obtaining Source Code](quick-start/quickstart-ide-lite-sourcecode-acquire.md) - - [Creating a Source Code Project](quick-start/quickstart-ide-lite-create-project.md) - - Running a Hello World Program - - Hi3861 Development Board - - [Writing a Hello World Program](quick-start/quickstart-ide-lite-steps-hi3861-application-framework.md) - - [Building](quick-start/quickstart-ide-lite-steps-hi3861-building.md) - - [Burning](quick-start/quickstart-ide-lite-steps-hi3861-burn.md) - - [Networking](quick-start/quickstart-ide-lite-steps-hi3861-netconfig.md) - - [Debugging and Verification](quick-start/quickstart-ide-lite-steps-hi3861-debug.md) - - [Running](quick-start/quickstart-ide-lite-steps-hi3861-running.md) - - Hi3516 Development Board - - [Writing a Hello World Program](quick-start/quickstart-ide-lite-steps-hi3516-application-framework.md) - - [Building](quick-start/quickstart-ide-lite-steps-hi3516-building.md) - - [Burning](quick-start/quickstart-ide-lite-steps-hi3516-burn.md) - - [Running](quick-start/quickstart-ide-lite-steps-hi3516-running.md) - - Appendix - - Introduction to Development Boards - - [Introduction to the Hi3861 Development Board](quick-start/quickstart-ide-lite-introduction-hi3861.md) - - [Introduction to the Hi3516 Development Board](quick-start/quickstart-ide-lite-introduction-hi3516.md) - - [Getting Started with Mini and Small Systems (Installation Package Mode)](quick-start/quickstart-lite-package-directory.md) +# Learn About OpenHarmony + +- [OpenHarmony Project](OpenHarmony-Overview.md) +- [Glossary](glossary.md) +- OpenHarmony Release Notes + - OpenHarmony 3.x Releases + - [OpenHarmony v3.1 Release (2022-03-30)](release-notes/OpenHarmony-v3.1-release.md) + - [OpenHarmony v3.1 Beta (2021-12-31)](release-notes/OpenHarmony-v3.1-beta.md) + - [OpenHarmony v3.0.1 LTS (2022-01-12)](release-notes/OpenHarmony-v3.0.1-LTS.md) +- [OpenHarmony v3.0 LTS (2021-09-30)](release-notes/OpenHarmony-v3.0-LTS.md) - - Getting Started with Standard System (IDE Mode) - - [Standard System Overview](quick-start/quickstart-ide-standard-overview.md) - - Environment Preparation - - [Setting Up the Windows+Ubuntu Hybrid Development Environment](quick-start/quickstart-ide-standard-env-setup-win-ubuntu.md) - - [Obtaining Source Code](quick-start/quickstart-ide-standard-sourcecode-acquire.md) - - [Creating a Source Code Project](quick-start/quickstart-ide-standard-create-project.md) - - Running a Hello World Program - - Hi3516 Development Board - - [Writing a Hello World Program](quick-start/quickstart-ide-standard-running-hi3516-create.md) - - [Building](quick-start/quickstart-ide-standard-running-hi3516-build.md) - - [Burning](quick-start/quickstart-ide-standard-running-hi3516-burning.md) - - [Running](quick-start/quickstart-ide-standard-running-hi3516-running.md) - - RK3568 Development Board - - [Writing a Hello World Program](quick-start/quickstart-ide-standard-running-rk3568-create.md) - - [Building](quick-start/quickstart-ide-standard-running-rk3568-build.md) - - [Burning](quick-start/quickstart-ide-standard-running-rk3568-burning.md) - - [Running](quick-start/quickstart-ide-standard-running-rk3568-running.md) - - Appendix - - Introduction to Development Boards - - [Introduction to the Hi3516 Development Board](quick-start/quickstart-ide-standard-board-introduction-hi3516.md) - - [Introduction to the RK3568 Development Board](quick-start/quickstart-ide-standard-board-introduction-rk3568.md) - - [Getting Started with Standard System (Installation Package Mode)](quick-start/quickstart-standard-package-directory.md) - - - [Obtaining Source Code](get-code/sourcecode-acquire.md) - -- Compatibility and Security - - - [Privacy Protection](security/security-privacy-protection.md) - - [Security Guidelines](security/security-guidelines-overall.md) - -- Porting - - - Mini System SoC Porting Guide - - - Porting Preparations - - [Before You Start](porting/porting-chip-prepare-knows.md) - - [Building Adaptation Process](porting/porting-chip-prepare-process.md) - - Kernel Porting - - [Porting Overview](porting/porting-chip-kernel-overview.md) - - [Basic Kernel Adaptation](porting/porting-chip-kernel-adjustment.md) - - [Kernel Porting Verification](porting/porting-chip-kernel-verify.md) - - Board-Level OS Porting - - [Porting Overview](porting/porting-chip-board-overview.md) - - [Board-Level Driver Adaptation](porting/porting-chip-board-driver.md) - - [Implementation of APIs at the HAL](porting/porting-chip-board-hal.md) - - [System Modules](porting/porting-chip-board-component.md) - - [lwIP Module Adaptation](porting/porting-chip-board-lwip.md) - - [Third-party Module Adaptation](porting/porting-chip-board-bundle.md) - - [XTS](porting/porting-chip-board-xts.md) - - [FAQs](porting/porting-chip-faqs.md) - - - Small System SoC Porting Guide - - - Porting Preparations - - [Before You Start](porting/porting-smallchip-prepare-needs.md) - - [Compilation and Building](porting/porting-smallchip-prepare-building.md) - - Kernel Porting - - [LiteOS Cortex-A](porting/porting-smallchip-kernel-a.md) - - [Linux Kernel](porting/porting-smallchip-kernel-linux.md) - - Driver Porting - - [Porting Overview](porting/porting-smallchip-driver-overview.md) - - [Platform Driver Porting](porting/porting-smallchip-driver-plat.md) - - [Device Driver Porting](porting/porting-smallchip-driver-oom.md) - - - Standard System SoC Porting Guide - - - [Standard System Porting Guide](porting/standard-system-porting-guide.md) - - [A Method for Rapidly Porting the OpenHarmony Linux Kernel](porting/porting-linux-kernel.md) - - - [Third-Party Library Porting Guide for Mini and Small Systems](porting/porting-thirdparty.md) - - [Overview](porting/porting-thirdparty-overview.md) - - [Porting a Library Built Using CMake](porting/porting-thirdparty-cmake.md) - - [Porting a Library Built Using Makefile](porting-thirdparty-makefile.md) - - - [Mini System SoC Porting Cases](porting/porting-bes2600w-on-minisystem-display-demo.md) - -- Subsystem Development - - - Kernel - - Kernel for Mini System - - [Kernel Overview](kernel/kernel-mini-overview.md) - - Basic Kernel - - [Interrupt Management](kernel/kernel-mini-basic-interrupt.md) - - [Task Management](kernel/kernel-mini-basic-task.md) - - Memory Management - - [Basic Concepts](kernel/kernel-mini-basic-memory-basic.md) - - [Static Memory](kernel/kernel-mini-basic-memory-static.md) - - [Dynamic Memory](kernel/kernel-mini-basic-memory-dynamic.md) - - Kernel Communication Mechanisms - - [Event](kernel/kernel-mini-basic-ipc-event.md) - - [Mutex](kernel/kernel-mini-basic-ipc-mutex.md) - - [Queue](kernel/kernel-mini-basic-ipc-queue.md) - - [Semaphore](kernel/kernel-mini-basic-ipc-sem.md) - - [Time Management](kernel/kernel-basic-mini-time.md) - - [Software Timer](kernel/kernel-mini-basic-soft.md) - - Extended Components - - [C++ Support](kernel/kernel-mini-extend-support.md) - - [CPUP](kernel/kernel-mini-extend-cpup.md) - - [Dynamic Loading](kernel/kernel-mini-extend-dynamic-loading.md) - - File System - - [FAT](kernel/kernel-mini-extend-file-fat.md) - - [LittleFS](kernel/kernel-mini-extend-file-lit.md) - - Kernel Debugging - - Memory Debugging - - [Memory Information Statistics](kernel/kernel-mini-memory-debug-mes.md) - - [Memory Leak Check](kernel/kernel-mini-imemory-debug-det.md) - - [Memory Corruption Check](kernel/kernel-mini-memory-debug-cet.md) - - [Exception Debugging](kernel/kernel-mini-memory-exception.md) - - [Trace](kernel/kernel-mini-memory-trace.md) - - [LMS](kernel/kernel-mini-memory-lms.md) - - Appendix - - [Kernel Coding Specification](kernel/kernel-mini-appx-code.md) - - Basic Data Structure - - [Doubly Linked List](kernel/kernel-mini-appx-data-list.md) - - Standard Libraries - - [CMSIS Support](kernel/kernel-mini-appx-lib-cmsis.md) - - [POSIX Support](kernel/kernel-mini-appx-lib-posix.md) - - Kernel for the Small System - - [Kernel Overview](kernel/kernel-small-overview.md) - - Kernel Startup - - [Startup in Kernel Mode](kernel/kernel-small-start-kernel.md) - - [Startup in User Mode](kernel/kernel-small-start-user.md) - - Basic Kernel - - [Interrupt and Exception Handling](kernel/kernel-small-basic-interrupt.md) - - Process Management - - [Process Management](kernel/kernel-small-basic-process-process.md) - - [Task](kernel/kernel-small-basic-process-thread.md) - - [Scheduler](kernel/kernel-small-basic-process-scheduler.md) - - Memory Management - - [Heap Memory Management](kernel/kernel-small-basic-memory-heap.md) - - [Physical Memory Management](kernel/kernel-small-basic-memory-physical.md) - - [Virtual Memory Management](kernel/kernel-small-basic-memory-virtual.md) - - [Virtual-to-Physical Mapping](kernel/kernel-small-basic-inner-reflect.md) - - Kernel Communication Mechanisms - - [Event](kernel/kernel-small-basic-trans-event.md) - - [Semaphore](kernel/kernel-small-basic-trans-semaphore.md) - - [Mutex](kernel/kernel-small-basic-trans-mutex.md) - - [Queue](kernel/kernel-small-basic-trans-queue.md) - - [RW Lock](kernel/kernel-small-basic-trans-rwlock.md) - - [Futex](kernel/kernel-small-basic-trans-user-mutex.md) - - [Signal](kernel/kernel-small-basic-trans-user-signal.md) - - [Time Management](kernel/kernel-small-basic-time.md) - - [Software Timer](kernel/kernel-small-basic-softtimer.md) - - [Atomic Operation](kernel/kernel-small-basic-atomic.md) - - Extended Components - - [System Call](kernel/kernel-small-bundles-system.md) - - [Dynamic Loading and Linking](kernel/kernel-small-bundles-linking.md) - - [Virtual Dynamic Shared Object](kernel/kernel-small-bundles-share.md) - - [LiteIPC](kernel/kernel-small-bundles-ipc.md) - - File Systems - - [Virtual File System](kernel/kernel-small-bundles-fs-virtual.md) - - Supported File Systems - - [FAT](kernel/kernel-small-bundles-fs-support-fat.md) - - [JFFS2](kernel/kernel-small-bundles-fs-support-jffs2.md) - - [NFS](kernel/kernel-small-bundles-fs-support-nfs.md) - - [Ramfs](kernel/kernel-small-bundles-fs-support-ramfs.md) - - [procfs](kernel/kernel-small-bundles-fs-support-procfs.md) - - [File System Adaptation](kernel/kernel-small-bundles-fs-new.md) - - Debugging and Tools - - Shell - - [Introduction to the Shell](kernel/kernel-small-debug-shell-overview.md) - - [Shell Command Development Guidelines](kernel/kernel-small-debug-shell-guide.md) - - [Shell Command Programming Example](kernel/kernel-small-debug-shell-build.md) - - Shell Command Reference - - System Commands - - [cpup](kernel/kernel-small-debug-shell-cmd-cpup.md) - - [date](kernel/kernel-small-debug-shell-cmd-date.md) - - [dmesg](kernel/kernel-small-debug-shell-cmd-dmesg.md) - - [exec](kernel/kernel-small-debug-shell-cmd-exec.md) - - [free](kernel/kernel-small-debug-shell-cmd-free.md) - - [help](kernel/kernel-small-debug-shell-cmd-help.md) - - [hwi](kernel/kernel-small-debug-shell-cmd-hwi.md) - - [kill](kernel/kernel-small-debug-shell-cmd-kill.md) - - [log](kernel/kernel-small-debug-shell-cmd-log.md) - - [memcheck](kernel/kernel-small-debug-shell-cmd-memcheck.md) - - [oom](kernel/kernel-small-debug-shell-cmd-oom.md) - - [pmm](kernel/kernel-small-debug-shell-cmd-pmm.md) - - [reset](kernel/kernel-small-debug-shell-cmd-reset.md) - - [sem](kernel/kernel-small-debug-shell-cmd-sem.md) - - [stack](kernel/kernel-small-debug-shell-cmd-stack.md) - - [su](kernel/kernel-small-debug-shell-cmd-su.md) - - [swtmr](kernel/kernel-small-debug-shell-cmd-swtmr.md) - - [systeminfo](kernel/kernel-small-debug-shell-cmd-sysinfo.md) - - [task](kernel/kernel-small-debug-shell-cmd-task.md) - - [uname](kernel/kernel-small-debug-shell-cmd-uname.md) - - [vmm](kernel/kernel-small-debug-shell-cmd-vmm.md) - - [watch](kernel/kernel-small-debug-shell-cmd-watch.md) - - [reboot](kernel/kernel-small-debug-shell-cmd-reboot.md) - - [top](kernel/kernel-small-debug-shell-cmd-top.md) - - File Commands - - [cat](kernel/kernel-small-debug-shell-file-cat.md) - - [cd](kernel/kernel-small-debug-shell-file-cd.md) - - [chgrp](kernel/kernel-small-debug-shell-file-chgrp.md) - - [chmod](kernel/kernel-small-debug-shell-file-chmod.md) - - [chown](kernel/kernel-small-debug-shell-file-chown.md) - - [cp](kernel/kernel-small-debug-shell-file-cp.md) - - [format](kernel/kernel-small-debug-shell-file-format.md) - - [ls](kernel/kernel-small-debug-shell-file-ls.md) - - [lsfd](kernel/kernel-small-debug-shell-file-lsfd.md) - - [mkdir](kernel/kernel-small-debug-shell-file-mkdir.md) - - [mount](kernel/kernel-small-debug-shell-file-mount.md) - - [partinfo](kernel/kernel-small-debug-shell-file-partinfo.md) - - [partition](kernel/kernel-small-debug-shell-file-partition.md) - - [pwd](kernel/kernel-small-debug-shell-file-pwd.md) - - [rm](kernel/kernel-small-debug-shell-file-rm.md) - - [rmdir](kernel/kernel-small-debug-shell-file-rmdir.md) - - [statfs](kernel/kernel-small-debug-shell-file-statfs.md) - - [sync](kernel/kernel-small-debug-shell-file-sync.md) - - [touch](kernel/kernel-small-debug-shell-file-touch.md) - - [writeproc](kernel/kernel-small-debug-shell-file-write.md) - - [umount](kernel/kernel-small-debug-shell-file-umount.md) - - [du](kernel/kernel-small-debug-shell-file-du.md) - - [mv](kernel/kernel-small-debug-shell-file-mv.md) - - Network Commands - - [arp](kernel/kernel-small-debug-shell-net-arp.md) - - [dhclient](kernel/kernel-small-debug-shell-net-dhclient.md) - - [ifconfig](kernel/kernel-small-debug-shell-net-ifconfig.md) - - [ipdebug](kernel/kernel-small-debug-shell-net-ipdebug.md) - - [netstat](kernel/kernel-small-debug-shell-net-netstat.md) - - [ntpdate](kernel/kernel-small-debug-shell-net-ntpdate.md) - - [ping](kernel/kernel-small-debug-shell-net-ping.md) - - [ping6](kernel/kernel-small-debug-shell-net-ping6.md) - - [telnet](kernel/kernel-small-debug-shell-net-telnet.md) - - [tftp](kernel/kernel-small-debug-shell-net-tftp.md) - - [Magic Key](kernel/kernel-small-debug-shell-magickey.md) - - [User-Mode Exception Information](kernel/kernel-small-debug-shell-error.md) - - [Trace](kernel/kernel-small-debug-trace.md) - - [perf](kernel/kernel-mini-memory-perf.md) - - [LMS](kernel/kernel-small-memory-lms.md) - - Process Commissioning - - [CPUP](kernel/kernel-small-debug-process-cpu.md) - - Kernel-Mode Memory Debugging - - [Memory Information Statistics](kernel/kernel-small-debug-memory-info.md) - - [Memory Leak Check](kernel/kernel-small-debug-memory-leak.md) - - [Memory Corruption Check](kernel/kernel-small-debug-memory-corrupt.md) - - User-Mode Memory Debugging - - [Basic Concepts](kernel/kernel-small-debug-user-concept.md) - - [Working Principles](kernel/kernel-small-debug-user-function.md) - - Usage - - [API Description](kernel/kernel-small-debug-user-guide-api.md) - - How to Use - - [Calling APIs](kernel/kernel-small-debug-user-guide-use-api.md) - - [Using the CLI](kernel/kernel-small-debug-user-guide-use-cli.md) - - [Typical Memory Problems](kernel/kernel-small-debug-user-faqs.md) - - Other Kernel Debugging Methods - - [Dying Gasp](kernel/kernel-small-debug-trace-other-lastwords.md) - - [Common Fault Locating Methods](kernel/kernel-small-debug-trace-other-faqs.md) - - Appendix - - Basic Data Structure - - [Doubly Linked List](kernel/kernel-small-apx-dll.md) - - [Bitwise Operation](kernel/kernel-small-apx-bitwise.md) - - [Standard Library](kernel/kernel-small-apx-library.md) - - Kernel for the Standard System - - [Linux Kernel Overview](kernel/kernel-standard-overview.md) - - [Applying Patches on Development Boards](kernel/kernel-standard-patch.md) - - [Compiling and Building the Linux Kernel](kernel/kernel-standard-build.md) - - Enhanced Kernel Features - - [Enhanced SWAP](kernel/kernel-standard-mm-eswap.md) - - Task Scheduling - - [Related Thread Group](kernel/kernel-standard-sched-rtg.md) - - [Lightweight CPU Isolation](kernel/kernel-standard-sched-cpuisolation.md) - - Drivers - - HDF - - [HDF Overview](driver/driver-hdf-overview.md) - - [Driver Development](driver/driver-hdf-development.md) - - [Driver Service Management](driver/driver-hdf-servicemanage.md) - - [Driver Message Mechanism Management](driver/driver-hdf-message-management.md) - - [Driver Configuration Management](driver/driver-hdf-manage.md) - - [HDF Development Example](driver/driver-hdf-sample.md) - - Platform Driver Development - - [ADC](driver/driver-platform-adc-develop.md) - - [GPIO](driver/driver-platform-gpio-develop.md) - - [HDMI](driver/driver-platform-hdmi-develop.md) - - [I2C](driver/driver-platform-i2c-develop.md) - - [I3C](driver/driver-platform-i3c-develop.md) - - [MIPI CSI](driver/driver-platform-mipicsi-develop.md) - - [MIPI DSI](driver/driver-platform-mipidsi-develop.md) - - [MMC](driver/driver-platform-mmc-develop.md) - - [PIN](driver/driver-platform-pin-develop.md) - - [PWM](driver/driver-platform-pwm-develop.md) - - [Regulator](driver/driver-platform-regulator-develop.md) - - [RTC](driver/driver-platform-rtc-develop.md) - - [SDIO](driver/driver-platform-sdio-develop.md) - - [SPI](driver/driver-platform-spi-develop.md) - - [UART](driver/driver-platform-uart-develop.md) - - [Watchdog](driver/driver-platform-watchdog-develop.md) - - Platform Driver Usage - - [ADC](driver/driver-platform-adc-des.md) - - [GPIO](driver/driver-platform-gpio-des.md) - - [HDMI](driver/driver-platform-hdmi-des.md) - - [I2C](driver/driver-platform-i2c-des.md) - - [I3C](driver/driver-platform-i3c-des.md) - - [MIPI CSI](driver/driver-platform-mipicsi-des.md) - - [MIPI DSI](driver/driver-platform-mipidsi-des.md) - - [PWM](driver/driver-platform-pwm-des.md) - - [Regulator](driver/driver-platform-regulator-des.md) - - [RTC](driver/driver-platform-rtc-des.md) - - [SDIO](driver/driver-platform-sdio-des.md) - - [SPI](driver/driver-platform-spi-des.md) - - [UART](driver/driver-platform-uart-des.md) - - [Watchdog](driver/driver-platform-watchdog-des.md) - - Peripheral Driver Usage - - [LCD](driver/driver-peripherals-lcd-des.md) - - [Touchscreen](driver/driver-peripherals-touch-des.md) - - [Sensor](driver/driver-peripherals-sensor-des.md) - - [WLAN](driver/driver-peripherals-external-des.md) - - [Audio](driver/driver-peripherals-audio-des.md) - - [USB](driver/driver-peripherals-usb-des.md) - - [Camera](driver/driver-peripherals-camera-des.md) - - Compilation and Building - - [Building Guidelines for Mini and Small Systems](subsystems/subsys-build-mini-lite.md) - - [Building Guidelines for the Standard System](subsystems/subsys-build-standard-large.md) - - [Build System Coding Specifications and Best Practices](subsystems/subsys-build-gn-coding-style-and-best-practice.md) - - [Building the Kconfig Visual Configuration](subsystems/subsys-build-gn-kconfig-visual-config-guid.md) - - [Distributed Remote Startup](subsystems/subsys-remote-start.md) - - Graphics - - [Graphics](subsystems/subsys-graphics-overview.md) - - [Development Guidelines on Container Components](subsystems/subsys-graphics-container-guide.md) - - [Development Guidelines on Layout Container Components](subsystems/subsys-graphics-layout-guide.md) - - [Development Guidelines on Common Components](subsystems/subsys-graphics-common-guide.md) - - [Development Guidelines on Animators](subsystems/subsys-graphics-animation-guide.md) - - Multimedia - - [Camera](subsystems/subsys-multimedia-camera.md) - - [Overview](subsystems/subsys-multimedia-camera-overview.md) - - [Development Guidelines on Photographing](subsystems/subsys-multimedia-camera-photo-guide.md) - - [Development Guidelines on Video Recording](subsystems/subsys-multimedia-camera-record-guide.md) - - [Development Guidelines on Previewing](subsystems/subsys-multimedia-camera-preview-guide.md) - - [Audio/Video](subsystems/subsys-multimedia-video.md) - - [Overview](subsystems/subsys-multimedia-video-overview.md) - - [Development Guidelines on Media Playback](subsystems/subsys-multimedia-video-play-guide.md) - - [Development Guidelines on Media Recording](subsystems/subsys-multimedia-video-record-guide.md) - - Utils - - [Utils Overview](subsystems/subsys-utils-overview.md) - - [Utils Development Guidelines](subsystems/subsys-utils-guide.md) - - [Utils FAQ](subsystems/subsys-utils-faqs.md) - - AI Framework - - [AI Engine Framework](subsystems/subsys-aiframework-guide.md) - - [Development Environment](subsystems/subsys-aiframework-envbuild.md) - - [Technical Specifications](subsystems/subsys-aiframework-tech.md) - - [Code Management](subsystems/subsys-aiframework-tech-codemanage.md) - - [Naming](subsystems/subsys-aiframework-tech-name.md) - - [API Development](subsystems/subsys-aiframework-tech-interface.md) - - [Development Guidelines](subsystems/subsys-aiframework-devguide.md) - - [SDK](subsystems/subsys-aiframework-devguide-sdk.md) - - [Plug-in](subsystems/subsys-aiframework-devguide-plugin.md) - - [Configuration File](subsystems/subsys-aiframework-devguide-conf.md) - - [Development Examples](subsystems/subsys-aiframework-demo.md) - - [KWS SDK](subsystems/subsys-aiframework-demo-sdk.md) - - [KWS Plug-in](subsystems/subsys-aiframework-demo-plugin.md) - - [KWS Configuration File](subsystems/subsys-aiframework-demo-conf.md) - - Data Management - - [RDB](subsystems/subsys-data-relational-database.md) - - [RDB Overview](subsystems/subsys-data-relational-database-overview.md) - - [RDB Development](subsystems/subsys-data-relational-database-guide.md) - - [Lightweight Data Store](subsystems/subsys-data-storage.md) - - [Lightweight Data Store Overview](subsystems/subsys-data-storage-overview.md) - - [Lightweight Data Store Development](subsystems/subsys-data-storage-guide.md) - - Sensor - - [Sensor Overview](subsystems/subsys-sensor-overview.md) - - [Sensor Usage Guidelines](subsystems/subsys-sensor-guide.md) - - [Sensor Usage Example](subsystems/subsys-sensor-demo.md) - - USB - - [USB Overview](subsystems/subsys-usbservice-overview.md) - - [USB Usage Guidelines](subsystems/subsys-usbservice-guide.md) - - [USB Usage Example](subsystems/subsys-usbservice-demo.md) - - Application Framework - - [Overview](subsystems/subsys-application-framework-overview.md) - - [Setting Up a Development Environment](subsystems/subsys-application-framework-envbuild.md) - - [Development Guidelines](subsystems/subsys-application-framework-guide.md) - - [Development Example](subsystems/subsys-application-framework-demo.md) - - [OTA Update](subsystems/subsys-ota-guide.md) - - Telephony - - [Telephone Overview](subsystems/subsys-tel-overview.md) - - [Telephony Development](subsystems/subsys-tel-guide.md) - - Security - - [Overview](subsystems/subsys-security-overview.md) - - [Development on Application Signature Verification](subsystems/subsys-security-sigverify.md) - - [Development on Application Permission Management](subsystems/subsys-security-rightmanagement.md) - - [Development on IPC Authentication](subsystems/subsys-security-communicationverify.md) - - [Development on Device Security Level Management](subsystems/subsys-security-devicesecuritylevel.md) - - Startup - - [Startup](subsystems/subsys-boot-overview.md) - - [init Module](subsystems/subsys-boot-init.md) - - [appspawn Module](subsystems/subsys-boot-appspawn.md) - - [appspawn Module for the Standard System](subsystems/subsys-boot-appspawn-standard.md) - - [bootstrap Module](subsystems/subsys-boot-bootstrap.md) - - [syspara Module](subsystems/subsys-boot-syspara.md) - - [FAQs](subsystems/subsys-boot-faqs.md) - - [Reference](subsystems/subsys-boot-ref.md) - - DFX - - [DFX Overview](subsystems/subsys-dfx-overview.md) - - [HiLog Development](subsystems/subsys-dfx-hilog-rich.md) - - [HiLog\_Lite Development](subsystems/subsys-dfx-hilog-lite.md) - - [HiTrace Development](subsystems/subsys-dfx-hitrace.md) - - [HiCollie Development](subsystems/subsys-dfx-hicollie.md) - - [HiSysEvent Development](subsystems/subsys-dfx-hisysevent.md) - - [HiSysEvent Logging Configuration](subsystems/subsys-dfx-hisysevent-logging-config.md) - - [HiSysEvent Logging](subsystems/subsys-dfx-hisysevent-logging.md) - - [HiSysEvent Listening](subsystems/subsys-dfx-hisysevent-listening.md) - - [HiSysEvent Query](subsystems/subsys-dfx-hisysevent-query.md) - - [HiSysEvent Tool Usage](subsystems/subsys-dfx-hisysevent-tool.md) - -- Featured Topics - - HPM Part - - [HPM Part Overview](hpm-part/hpm-part-about.md) - - [HPM Part Development](hpm-part/hpm-part-development.md) - - [HPM Part Reference](hpm-part/hpm-part-reference.md) - -- Device Development Examples - - - Mini- and Small-System Devices - - WLAN-connected Products - - [LED Peripheral Control](guide/device-wlan-led-control.md) - - [Third-Party SDK Integration](guide/device-wlan-sdk.md) - - Cameras without a Screen - - Camera Control - - [Overview](guide/device-iotcamera-control-overview.md) - - Development Examples - - [Development Guidelines](guide/device-iotcamera-control-demo-photodevguide.md) - - [Video Recording](guide/device-iotcamera-control-demo-videodevguide.md) - - [Use Case](guide/device-iotcamera-control-example.md) - - Cameras with a Screen - - Screen and Camera Control - - [Overview](guide/device-camera-control-overview.md) - - Development Examples - - [Photographing](guide/device-camera-control-demo-photoguide.md) - - [Video Recording](guide/device-camera-control-demo-videoguide.md) - - [Previewing](guide/device-camera-control-demo-previewguide.md) - - [Use Case](guide/device-camera-control-example.md) - - Visual Application Development - - [Overview](guide/device-camera-visual-overview.md) - - [Preparations](guide/device-camera-visual-prepare.md) - - [Adding Pages](guide/device-camera-visual-addpage.md) - - [Building the Home Page](guide/device-camera-visual-firstpage.md) - - [Building the Details Page](guide/device-camera-visual-details.md) - - [Debugging and Packaging](guide/device-camera-visual-debug.md) - - [Running on the Device](guide/device-camera-visual-run.md) - - [FAQs](guide/device-camera-visual-faqs.md) - - Standard-System Devices - - [Development Guidelines on Clock Apps](guide/device-clock-guide.md) - - [Development Example for Platform Drivers](guide/device-driver-demo.md) - - [Development Example for Peripheral Drivers](guide/device-outerdriver-demo.md) - -- Debugging - - - [Test Subsystem](subsystems/subsys-testguide-test.md) - - R&D Tools - - [bytrace](subsystems/subsys-toolchain-bytrace-guide.md) - - [hdc\_std](subsystems/subsys-toolchain-hdc-guide.md) - - [hiperf](subsystems/subsys-toolchain-hiperf.md) - -- XTS - - - [XTS](subsystems/subsys-xts-guide.md) - -- Tools - - - [Docker Environment](get-code/gettools-acquire.md) - - [IDE](get-code/gettools-ide.md) - -- Reference - - - FAQs - - [FAQs Overview](faqs/faqs-overview.md) - - [Environment Setup](faqs/faqs-environment-setup.md) - - [Compilation and Building Subsystem](faqs-building.md) - - [Burning](faqs/faqs-burning.md) - - [Kernel](faqs/faqs-kernel.md) - - [Porting](faqs/faqs-porting.md) - - [Startup](faqs/faqs-startup.md) - - [System Applications](faqs/faqs-system-applications.md) + - OpenHarmony 2.x Releases + - [OpenHarmony v2.2 beta2 (2021-08-04)](release-notes/OpenHarmony-v2.2-beta2.md) + - [OpenHarmony 2.0 Canary (2021-06-01)](release-notes/OpenHarmony-2-0-Canary.md) + - OpenHarmony 1.x Releases + - [OpenHarmony v1.1.4 LTS (2022-02-11)](release-notes/OpenHarmony-v1-1-4-LTS.md) + - [OpenHarmony v1.1.3 LTS (2021-09-30)](release-notes/OpenHarmony-v1-1-3-LTS.md) + - [OpenHarmony v1.1.2 LTS (2021-08-04)](release-notes/OpenHarmony-v1.1.2-LTS.md) + - [OpenHarmony 1.1.1 LTS (2021-06-22)](release-notes/OpenHarmony-1-1-1-LTS.md) + - [OpenHarmony 1.1.0 LTS (2021-04-01)](release-notes/OpenHarmony-1-1-0-LTS.md) + - [OpenHarmony 1.0 (2020-09-10)](release-notes/OpenHarmony-1-0.md) +- Contribution + - [How to Contribute](contribute/how-to-contribute.md) + - [Code of Conduct](contribute/code-of-conduct.md) + - [Code Contribution](contribute/code-contribution.md) + - [Contribution Process](contribute/contribution-process.md) + - [Auto-Test](readme/test.md) + - [Documentation Contribution](contribute/documentation-contribution.md) + - [Writing Instructions](contribute/writing-instructions.md) + - [Communication in Community](contribute/communication-in-community.md) + - [FAQs](contribute/FAQ.md) \ No newline at end of file diff --git a/zh-cn/OpenHarmony-Overview_zh.md b/zh-cn/OpenHarmony-Overview_zh.md index 923b05822f34e747e3e28e77ee3b0b768b1cd932..e5b9c5e2bcd896e5ca464fc00139cc94f9474228 100644 --- a/zh-cn/OpenHarmony-Overview_zh.md +++ b/zh-cn/OpenHarmony-Overview_zh.md @@ -389,6 +389,12 @@ OpenHarmony归档组织地址:[https://gitee.com/openharmony-retired](https:// 获取OpenHarmony源码:[下载说明](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md) +## 示例教程 + +Samples:[示例代码](https://gitee.com/openharmony/app_samples) + +Codelabs:[教程指导](https://gitee.com/openharmony/codelabs) + ## 如何参与 参与社区:[社区介绍](https://gitee.com/openharmony/community/blob/master/README.md) diff --git "a/zh-cn/application-dev/IDL/OpenHarmony IDL\345\267\245\345\205\267\350\247\204\346\240\274\345\217\212\344\275\277\347\224\250\350\257\264\346\230\216\344\271\246.md" b/zh-cn/application-dev/IDL/idl-guidelines.md similarity index 100% rename from "zh-cn/application-dev/IDL/OpenHarmony IDL\345\267\245\345\205\267\350\247\204\346\240\274\345\217\212\344\275\277\347\224\250\350\257\264\346\230\216\344\271\246.md" rename to zh-cn/application-dev/IDL/idl-guidelines.md diff --git a/zh-cn/application-dev/Readme-CN.md b/zh-cn/application-dev/Readme-CN.md index 06df80ba508a9c6f23a293cccfb24a7e7d45edef..c4372e052e4f387d2b3dd29e2679b0c019062b07 100644 --- a/zh-cn/application-dev/Readme-CN.md +++ b/zh-cn/application-dev/Readme-CN.md @@ -20,18 +20,23 @@ - [Ability开发](ability/Readme-CN.md) - [UI开发](ui/Readme-CN.md) - 基础功能开发 + - [公共事件与通知](notification/Readme-CN.md) - [窗口管理](windowmanager/Readme-CN.md) - [WebGL](webgl/Readme-CN.md) - [媒体](media/Readme-CN.md) - [安全](security/Readme-CN.md) - [网络与连接](connectivity/Readme-CN.md) - [数据管理](database/Readme-CN.md) + - [电话服务](telephony/Readme-CN.md) - [后台代理提醒](background-agent-scheduled-reminder/Readme-CN.md) - [后台任务管理](background-task-management/Readme-CN.md) + - [延迟任务调度](work-scheduler/Readme-CN.md) - [设备管理](device/Readme-CN.md) - [设备使用信息统计](device-usage-statistics/Readme-CN.md) - [DFX](dfx/Readme-CN.md) - [国际化](internationalization/Readme-CN.md) + - [IDL工具规格及使用说明书](IDL/idl-guidelines.md) + - [Native API在应用工程中的使用指导](napi/napi-guidelines.md) - 工具 - [DevEco Studio(OpenHarmony)使用指南](quick-start/deveco-studio-user-guide-for-openharmony.md) - 示例教程 diff --git a/zh-cn/application-dev/ability/Readme-CN.md b/zh-cn/application-dev/ability/Readme-CN.md index d0966110582317de9ab71a100ed9c9a824a3f841..ab8272f5b4d3dcb98627b8f259aa53abdba38d68 100644 --- a/zh-cn/application-dev/ability/Readme-CN.md +++ b/zh-cn/application-dev/ability/Readme-CN.md @@ -1,20 +1,20 @@ # Ability开发 - - [Ability框架概述](ability-brief.md) - - [应用上下文Context概述](context-userguide.md) - - FA模型 - - [FA模型综述](fa-brief.md) - - [PageAbility开发指导](fa-pageability.md) - - [ServiceAbility开发指导](fa-serviceability.md) - - [DataAbility开发指导](fa-dataability.md) - - [FA卡片开发指导](fa-formability.md) - - Stage模型 - - [Stage模型综述](stage-brief.md) - - [Ability开发指导](stage-ability.md) - - [ServiceExtensionAbility开发指导](stage-serviceextension.md) - - [跨端迁移开发指导](stage-ability-continuation.md) - - [Call调用开发指导](stage-call.md) - - [Stage卡片开发指导](stage-formextension.md) - - 其他 - - [WantAgent开发指导](wantagent.md) - - [Ability助手使用指导](ability-assistant-guidelines.md) - - [测试框架使用指导](ability-delegator.md) +- [Ability框架概述](ability-brief.md) +- [应用上下文Context概述](context-userguide.md) +- FA模型 + - [FA模型综述](fa-brief.md) + - [PageAbility开发指导](fa-pageability.md) + - [ServiceAbility开发指导](fa-serviceability.md) + - [DataAbility开发指导](fa-dataability.md) + - [FA卡片开发指导](fa-formability.md) +- Stage模型 + - [Stage模型综述](stage-brief.md) + - [Ability开发指导](stage-ability.md) + - [ServiceExtensionAbility开发指导](stage-serviceextension.md) + - [跨端迁移开发指导](stage-ability-continuation.md) + - [Call调用开发指导](stage-call.md) + - [Stage卡片开发指导](stage-formextension.md) +- 其他 + - [WantAgent开发指导](wantagent.md) + - [Ability助手使用指导](ability-assistant-guidelines.md) + - [测试框架使用指导](ability-delegator.md) diff --git a/zh-cn/application-dev/ability/stage-call.md b/zh-cn/application-dev/ability/stage-call.md index 28aee6477f7272f44b2a229c66ff46488a125e35..9b6018d42e17c9eb056b6d75d7d1e2aedc4d6bc3 100644 --- a/zh-cn/application-dev/ability/stage-call.md +++ b/zh-cn/application-dev/ability/stage-call.md @@ -8,6 +8,10 @@ Ability Call调用是Ability能力的扩展,它为Ability提供一种能够被 ![stage-call](figures/stage-call.png) +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> Callee被调用端所在的Ability,启动模式需要为单实例。 +> 当前仅支持系统应用及ServiceExtensionAbility使用Call访问Callee。 + ## 接口说明 Caller及Callee功能如下:具体的API详见[接口文档](../reference/apis/js-apis-application-ability.md#caller)。 diff --git a/zh-cn/application-dev/application-dev-website.md b/zh-cn/application-dev/application-dev-website.md deleted file mode 100644 index 830578b0af0fbdf1dbcfcc226d3a65ebd1962d4b..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/application-dev-website.md +++ /dev/null @@ -1,773 +0,0 @@ -# OpenHarmony应用开发文档 -- [应用开发导读](application-dev-guide.md) -- 快速开始 - - - 快速入门 - - [开发准备](quick-start/start-overview.md) - - [使用eTS语言开发](quick-start/start-with-ets.md) - - [使用JS语言开发(传统代码方式)](quick-start/start-with-js.md) - - [使用JS语言开发(低代码方式)](quick-start/start-with-js-low-code.md) - - - 开发基础知识 - - [应用包结构说明(FA模型)](quick-start/package-structure.md) - - [应用包结构说明(Stage模型)](quick-start/module-structure.md) - - [资源文件的分类](quick-start/basic-resource-file-categories.md) - - [SysCap说明](quick-start/syscap.md) -- 开发 - - Ability开发 - - [Ability框架概述](ability/ability-brief.md) - - FA模型 - - [FA模型综述](ability/fa-brief.md) - - [PageAbility开发指导](ability/fa-pageability.md) - - [ServiceAbility开发指导](ability/fa-serviceability.md) - - [DataAbility开发指导](ability/fa-dataability.md) - - [FormAbility开发指导](ability/fa-formability.md) - - Stage模型 - - [Stage模型综述](ability/stage-brief.md) - - [Ability开发指导](ability/stage-ability.md) - - [ServiceExtensionAbility开发指导](ability/stage-serviceextension.md) - - [FormExtensionAbility开发指导](ability/stage-formextension.md) - - [应用迁移开发指导](ability/stage-ability-continuation.md) - - 其他 - - [WantAgent使用指导](ability/wantagent.md) - - [Ability助手使用指导](ability/ability-assistant-guidelines.md) - - UI开发 - - [方舟开发框架(ArkUI)概述](ui/arkui-overview.md) - - 基于JS扩展的类Web开发范式 - - [概述](ui/ui-js-overview.md) - - 框架说明 - - [文件组织](ui/js-framework-file.md) - - [js标签配置](ui/js-framework-js-tag.md) - - [app.js](ui/js-framework-js-file.md) - - 语法 - - [HML语法参考](ui/js-framework-syntax-hml.md) - - [CSS语法参考](ui/js-framework-syntax-css.md) - - [JS语法参考](ui/js-framework-syntax-js.md) - - [生命周期](ui/js-framework-lifecycle.md) - - [资源限定与访问](ui/js-framework-resource-restriction.md) - - [多语言支持](ui/js-framework-multiple-languages.md) - - 构建用户界面 - - [组件介绍](ui/ui-js-building-ui-component.md) - - 构建布局 - - [布局说明](ui/ui-js-building-ui-layout-intro.md) - - [添加标题行和文本区域](ui/ui-js-building-ui-layout-text.md) - - [添加图片区域](ui/ui-js-building-ui-layout-image.md) - - [添加留言区域](ui/ui-js-building-ui-layout-comment.md) - - [添加容器](ui/ui-js-building-ui-layout-external-container.md) - - [添加交互](ui/ui-js-building-ui-interactions.md) - - [动画](ui/ui-js-building-ui-animation.md) - - [事件](ui/ui-js-building-ui-event.md) - - [页面路由](ui/ui-js-building-ui-routes.md) - - 常见组件开发指导 - - 容器组件 - - [List开发指导](ui/ui-js-components-list.md) - - [Dialog开发指导](ui/ui-js-components-dialog.md) - - [Form开发指导](ui/ui-js-components-form.md) - - [Stepper开发指导](ui/ui-js-components-stepper.md) - - [Tabs开发指导](ui/ui-js-component-tabs.md) - - [Swiper开发指导](ui/ui-js-components-swiper.md) - - 基础组件 - - [Text开发指导](ui/ui-js-components-text.md) - - [Input开发指导](ui/ui-js-components-input.md) - - [Button开发指导](ui/ui-js-components-button.md) - - [Picker开发指导](ui/ui-js-components-picker.md) - - [Image开发指导](ui/ui-js-components-images.md) - - [Image-animator开发指导](ui/ui-js-components-image-animator.md) - - [Rating开发指导](ui/ui-js-components-rating.md) - - [Slider开发指导](ui/ui-js-components-slider.md) - - [Chart开发指导](ui/ui-js-components-chart.md) - - [Switch开发指导](ui/ui-js-components-switch.md) - - [Toolbar开发指导](ui/ui-js-components-toolbar.md) - - [Menu开发指导](ui/ui-js-components-menu.md) - - [Marquee开发指导](ui/ui-js-components-marquee.md) - - [Qrcode开发指导](ui/ui-js-components-qrcode.md) - - [Search开发指导](ui/ui-js-components-search.md) - - Canvas开发指导 - - [Canvas对象](ui/ui-js-components-canvas.md) - - [CanvasRenderingContext2D对象](ui/ui-js-components-canvasrenderingcontext2d.md) - - [Path2D对象](ui/ui-js-components-path2d.md) - - [OffscreenCanvas对象](ui/ui-js-components-offscreencanvas.md) - - [栅格布局](ui/ui-js-components-grid.md) - - Svg开发指导 - - [基础知识](ui/ui-js-components-svg-overview.md) - - [绘制图形](ui/ui-js-components-svg-graphics.md) - - [绘制路径](ui/ui-js-components-svg-path.md) - - [绘制文本](ui/ui-js-components-svg-text.md) - - 动效开发指导 - - CSS动画 - - [属性样式动画](ui/ui-js-animate-attribute-style.md) - - [transform样式动画](ui/ui-js-animate-transform.md) - - [background-position样式动画](ui/ui-js-animate-background-position-style.md) - - [svg动画](ui/ui-js-animate-svg.md) - - JS动画 - - [组件动画](ui/ui-js-animate-component.md) - - 插值器动画 - - [动画动效](ui/ui-js-animate-dynamic-effects.md) - - [动画帧](ui/ui-js-animate-frame.md) - - [自定义组件](ui/ui-js-custom-components.md) - - 基于TS扩展的声明式开发范式 - - [概述](ui/ui-ts-overview.md) - - 框架说明 - - 文件组织 - - [目录结构](ui/ts-framework-directory.md) - - [应用代码文件访问规则](ui/ts-framework-file-access-rules.md) - - [js标签配置](ui/ts-framework-js-tag.md) - - 资源访问 - - [访问应用资源](ui/ts-application-resource-access.md) - - [访问系统资源](ui/ts-system-resource-access.md) - - [媒体资源类型说明](ui/ts-media-resource-type.md) - - [像素单位](ui/ts-pixel-units.md) - - [类型定义](ui/ts-types.md) - - 声明式语法 - - [描述规范使用说明](ui/ts-syntax-intro.md) - - 通用UI描述规范 - - [基本概念](ui/ts-general-ui-concepts.md) - - 声明式UI描述规范 - - [无构造参数配置](ui/ts-parameterless-configuration.md) - - [必选参数构造配置](ui/ts-configuration-with-mandatory-parameters.md) - - [属性配置](ui/ts-attribution-configuration.md) - - [事件配置](ui/ts-event-configuration.md) - - [子组件配置](ui/ts-child-component-configuration.md) - - 组件化 - - [@Component](ui/ts-component-based-component.md) - - [@Entry](ui/ts-component-based-entry.md) - - [@Preview](ui/ts-component-based-preview.md) - - [@Builder](ui/ts-component-based-builder.md) - - [@Extend](ui/ts-component-based-extend.md) - - [@CustomDialog](ui/ts-component-based-customdialog.md) - - [@Styles](ui/ts-component-based-styles.md) - - UI状态管理 - - [基本概念](ui/ts-ui-state-mgmt-concepts.md) - - 管理组件拥有的状态 - - [@State](ui/ts-component-states-state.md) - - [@Prop](ui/ts-component-states-prop.md) - - [@Link](ui/ts-component-states-link.md) - - 管理应用程序的状态 - - [应用程序的数据存储](ui/ts-application-states-appstorage.md) - - [持久化数据管理](ui/ts-application-states-apis-persistentstorage.md) - - [环境变量](ui/ts-application-states-apis-environment.md) - - 其他类目的状态管理 - - [Observed和ObjectLink数据管理](ui/ts-other-states-observed-objectlink.md) - - [@Consume和@Provide数据管理](ui/ts-other-states-consume-provide.md) - - [@Watch](ui/ts-other-states-watch.md) - - 渲染控制语法 - - [条件渲染](ui/ts-rending-control-syntax-if-else.md) - - [循环渲染](ui/ts-rending-control-syntax-foreach.md) - - [数据懒加载](ui/ts-rending-control-syntax-lazyforeach.md) - - 深入理解组件化 - - [build函数](ui/ts-function-build.md) - - [自定义组件初始化](ui/ts-custom-component-initialization.md) - - [自定义组件生命周期回调函数](ui/ts-custom-component-lifecycle-callbacks.md) - - [组件创建和重新初始化示例](ui/ts-component-creation-re-initialization.md) - - [语法糖](ui/ts-syntactic-sugar.md) - - 常见组件开发指导 - - [Button开发指导](ui/ui-ts-basic-components-button.md) - - [Web开发指导](ui/ui-ts-components-web.md) - - 常见布局开发指导 - - [弹性布局](ui/ui-ts-layout-flex.md) - - [栅格布局](ui/ui-ts-layout-grid-container.md) - - [媒体查询](ui/ui-ts-layout-mediaquery.md) - - 体验声明式UI - - [创建声明式UI工程](ui/ui-ts-creating-project.md) - - [初识Component](ui/ui-ts-components.md) - - [创建简单视图](ui/ui-ts-creating-simple-page.md) - - 页面布局与连接 - - [构建食物数据模型](ui/ui-ts-building-data-model.md) - - [构建食物列表List布局](ui/ui-ts-building-category-list-layout.md) - - [构建食物分类Grid布局](ui/ui-ts-building-category-grid-layout.md) - - [页面跳转与数据传递](ui/ui-ts-page-redirection-data-transmission.md) - - 基础功能开发 - - 窗口管理 - - 窗口 - - [窗口开发概述](windowmanager/window-overview.md) - - [窗口开发指导](windowmanager/window-guidelines.md) - - 屏幕属性 - - [屏幕属性开发概述](windowmanager/display-overview.md) - - [屏幕属性开发指导](windowmanager/display-guidelines.md) - - 屏幕截图 - - [屏幕截图开发概述](windowmanager/screenshot-overview.md) - - [屏幕截图开发指导](windowmanager/screenshot-guidelines.md) - - WebGL - - [概述](webgl/webgl-overview.md) - - [WebGL开发指导](webgl/webgl-guidelines.md) - - 媒体 - - 音频 - - [音频开发概述](media/audio-overview.md) - - [音频播放开发指导](media/audio-playback.md) - - [音频录制开发指导](media/audio-recorder.md) - - [音频渲染开发指导](media/audio-renderer.md) - - [音频采集开发指导](media/audio-capturer.md) - - 视频 - - [视频播放开发指导](media/video-playback.md) - - [视频录制开发指导](media/video-recorder.md) - - 图片 - - [图片开发指导](media/image.md) - - 安全 - - 用户认证 - - [用户认证开发概述](security/userauth-overview.md) - - [用户认证开发指导](security/userauth-guidelines.md) - - 密钥管理 - - [HUKS开发概述](security/huks-overview.md) - - [HUKS开发指导](security/huks-guidelines.md) - - Hap包签名工具 - - [Hap包签名工具开发指导](security/hapsigntool-guidelines.md) - - 访问控制 - - [访问控制开发概述](security/accesstoken-overview.md) - - [访问控制开发指导](security/accesstoken-guidelines.md) - - 网络与连接 - - IPC与RPC通信 - - [IPC与RPC通信概述](connectivity/ipc-rpc-overview.md) - - [IPC与RPC通信开发指导](connectivity/ipc-rpc-development-guideline.md) - - [远端状态订阅开发实例](connectivity/subscribe-remote-state.md) - - 数据管理 - - 分布式数据服务 - - [分布式数据服务概述](database/database-mdds-overview.md) - - [分布式数据服务开发指导](database/database-mdds-guidelines.md) - - 关系型数据库 - - [关系型数据库概述](database/database-relational-overview.md) - - [关系型数据库开发指导](database/database-relational-guidelines.md) - - 轻量级数据存储 - - [轻量级数据存储概述](database/database-preference-overview.md) - - [轻量级数据存储开发指导](database/database-preference-guidelines.md) - - 分布式数据对象 - - [分布式数据对象概述](database/database-distributedobject-overview.md) - - [分布式数据对象开发指导](database/database-distributedobject-guidelines.md) - - 后台代理提醒 - - [概述](background-agent-scheduled-reminder/background-agent-scheduled-reminder-overview.md) - - [开发指导](background-agent-scheduled-reminder/background-agent-scheduled-reminder-guide.md) - - 后台任务管理 - - 后台任务 - - [后台任务概述](background-task-management/background-task-overview.md) - - [后台任务开发指导](background-task-management/background-task-dev-guide.md) - - 设备管理 - - USB服务 - - [USB服务开发概述](device/usb-overview.md) - - [USB服务开发指导](device/usb-guidelines.md) - - 位置 - - [位置开发概述](device/device-location-overview.md) - - [获取设备的位置信息](device/device-location-info.md) - - [(逆)地理编码转化](device/device-location-geocoding.md) - - 传感器 - - [传感器开发概述](device/sensor-overview.md) - - [传感器开发指导](device/sensor-guidelines.md) - - 振动 - - [振动开发概述](device/vibrator-overview.md) - - [振动开发指导](device/vibrator-guidelines.md) - - 设备使用信息统计 - - [设备使用信息统计概述](device-usage-statistics/device-usage-statistics-overview.md) - - [设备使用信息统计开发指导](device-usage-statistics/device-usage-statistics-dev-guide.md) - - DFX - - 应用事件打点 - - [应用事件打点概述](dfx/hiappevent-overview.md) - - [应用事件打点开发指导](dfx/hiappevent-guidelines.md) - - 性能打点跟踪 - - [性能打点跟踪概述](dfx/hitracemeter-overview.md) - - [性能打点跟踪开发指导](dfx/hitracemeter-guidelines.md) - - 分布式跟踪 - - [分布式跟踪概述](dfx/hitracechain-overview.md) - - [分布式跟踪开发指导](dfx/hitracechain-guidelines.md) - - 国际化 - - [国际化开发概述](internationalization/international-overview.md) - - [Intl开发指导](internationalization/intl-guidelines.md) - - [I18n开发指导](internationalization/i18n-guidelines.md) -- 工具 - - [DevEco Studio(OpenHarmony)使用指南](quick-start/deveco-studio-user-guide-for-openharmony.md) -- 示例教程 - - [示例代码](https://gitee.com/openharmony/app_samples/blob/master/README_zh.md) - - [Codelabs](https://gitee.com/openharmony/codelabs/blob/master/README.md) -- API参考 - - 组件参考(基于JS扩展的类Web开发范式) - - 组件 - - 通用 - - [通用属性](reference/arkui-js/js-components-common-attributes.md) - - [通用样式](reference/arkui-js/js-components-common-styles.md) - - [通用事件](reference/arkui-js/js-components-common-events.md) - - [通用方法](reference/arkui-js/js-components-common-methods.md) - - [动画样式](reference/arkui-js/js-components-common-animation.md) - - [渐变样式](reference/arkui-js/js-components-common-gradient.md) - - [转场样式](reference/arkui-js/js-components-common-transition.md) - - [自定义字体样式](reference/arkui-js/js-components-common-customizing-font.md) - - [原子布局](reference/arkui-js/js-components-common-atomic-layout.md) - - 容器组件 - - [badge](reference/arkui-js/js-components-container-badge.md) - - [dialog](reference/arkui-js/js-components-container-dialog.md) - - [div](reference/arkui-js/js-components-container-div.md) - - [form](reference/arkui-js/js-components-container-form.md) - - [list](reference/arkui-js/js-components-container-list.md) - - [list-item](reference/arkui-js/js-components-container-list-item.md) - - [list-item-group](reference/arkui-js/js-components-container-list-item-group.md) - - [panel](reference/arkui-js/js-components-container-panel.md) - - [popup](reference/arkui-js/js-components-container-popup.md) - - [refresh](reference/arkui-js/js-components-container-refresh.md) - - [stack](reference/arkui-js/js-components-container-stack.md) - - [stepper](reference/arkui-js/js-components-container-stepper.md) - - [stepper-item](reference/arkui-js/js-components-container-stepper-item.md) - - [swiper](reference/arkui-js/js-components-container-swiper.md) - - [tabs](reference/arkui-js/js-components-container-tabs.md) - - [tab-bar](reference/arkui-js/js-components-container-tab-bar.md) - - [tab-content](reference/arkui-js/js-components-container-tab-content.md) - - 基础组件 - - [button](reference/arkui-js/js-components-basic-button.md) - - [chart](reference/arkui-js/js-components-basic-chart.md) - - [divider](reference/arkui-js/js-components-basic-divider.md) - - [image](reference/arkui-js/js-components-basic-image.md) - - [image-animator](reference/arkui-js/js-components-basic-image-animator.md) - - [input](reference/arkui-js/js-components-basic-input.md) - - [label](reference/arkui-js/js-components-basic-label.md) - - [marquee](reference/arkui-js/js-components-basic-marquee.md) - - [menu](reference/arkui-js/js-components-basic-menu.md) - - [option](reference/arkui-js/js-components-basic-option.md) - - [picker](reference/arkui-js/js-components-basic-picker.md) - - [picker-view](reference/arkui-js/js-components-basic-picker-view.md) - - [piece](reference/arkui-js/js-components-basic-piece.md) - - [progress](reference/arkui-js/js-components-basic-progress.md) - - [qrcode](reference/arkui-js/js-components-basic-qrcode.md) - - [rating](reference/arkui-js/js-components-basic-rating.md) - - [richtext](reference/arkui-js/js-components-basic-richtext.md) - - [search](reference/arkui-js/js-components-basic-search.md) - - [select](reference/arkui-js/js-components-basic-select.md) - - [slider](reference/arkui-js/js-components-basic-slider.md) - - [span](reference/arkui-js/js-components-basic-span.md) - - [switch](reference/arkui-js/js-components-basic-switch.md) - - [text](reference/arkui-js/js-components-basic-text.md) - - [textarea](reference/arkui-js/js-components-basic-textarea.md) - - [toolbar](reference/arkui-js/js-components-basic-toolbar.md) - - [toolbar-item](reference/arkui-js/js-components-basic-toolbar-item.md) - - [toggle](reference/arkui-js/js-components-basic-toggle.md) - - [web](reference/arkui-js/js-components-basic-web.md) - - 媒体组件 - - [video](reference/arkui-js/js-components-media-video.md) - - 画布组件 - - [canvas组件](reference/arkui-js/js-components-canvas-canvas.md) - - [CanvasRenderingContext2D对象](reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md) - - [Image对象](reference/arkui-js/js-components-canvas-image.md) - - [CanvasGradient对象](reference/arkui-js/js-components-canvas-canvasgradient.md) - - [ImageData对象](reference/arkui-js/js-components-canvas-imagedata.md) - - [Path2D对象](reference/arkui-js/js-components-canvas-path2d.md) - - [ImageBitmap对象](reference/arkui-js/js-components-canvas-imagebitmap.md) - - [OffscreenCanvas对象](reference/arkui-js/js-components-canvas-offscreencanvas.md) - - [OffscreenCanvasRenderingContext2D对象](reference/arkui-js/js-offscreencanvasrenderingcontext2d.md) - - 栅格组件 - - [基本概念](reference/arkui-js/js-components-grid-basic-concepts.md) - - [grid-container](reference/arkui-js/js-components-grid-container.md) - - [grid-row](reference/arkui-js/js-components-grid-row.md) - - [grid-col](reference/arkui-js/js-components-grid-col.md) - - svg组件 - - [通用属性](reference/arkui-js/js-components-svg-common-attributes.md) - - [svg](reference/arkui-js/js-components-svg.md) - - [rect](reference/arkui-js/js-components-svg-rect.md) - - [circle](reference/arkui-js/js-components-svg-circle.md) - - [ellipse](reference/arkui-js/js-components-svg-ellipse.md) - - [path](reference/arkui-js/js-components-svg-path.md) - - [line](reference/arkui-js/js-components-svg-line.md) - - [polyline](reference/arkui-js/js-components-svg-polyline.md) - - [polygon](reference/arkui-js/js-components-svg-polygon.md) - - [text](reference/arkui-js/js-components-svg-text.md) - - [tspan](reference/arkui-js/js-components-svg-tspan.md) - - [textPath](reference/arkui-js/js-components-svg-textpath.md) - - [animate](reference/arkui-js/js-components-svg-animate.md) - - [animateMotion](reference/arkui-js/js-components-svg-animatemotion.md) - - [animateTransform](reference/arkui-js/js-components-svg-animatetransform.md) - - 自定义组件 - - [基本用法](reference/arkui-js/js-components-custom-basic-usage.md) - - [自定义事件](reference/arkui-js/js-components-custom-events.md) - - [Props](reference/arkui-js/js-components-custom-props.md) - - [事件参数](reference/arkui-js/js-components-custom-event-parameter.md) - - [slot插槽](reference/arkui-js/js-components-custom-slot.md) - - [生命周期定义](reference/arkui-js/js-components-custom-lifecycle.md) - - [类型说明](reference/arkui-js/js-appendix-types.md) - - 组件参考(基于TS扩展的声明式开发范式) - - 组件 - - 通用 - - 通用事件 - - [点击事件](reference/arkui-ts/ts-universal-events-click.md) - - [触摸事件](reference/arkui-ts/ts-universal-events-touch.md) - - [挂载卸载事件](reference/arkui-ts/ts-universal-events-show-hide.md) - - [拖拽事件](reference/arkui-ts/ts-universal-events-drag-drop.md) - - [按键事件](reference/arkui-ts/ts-universal-events-key.md) - - [焦点事件](reference/arkui-ts/ts-universal-focus-event.md) - - [鼠标事件](reference/arkui-ts/ts-universal-mouse-key.md) - - [组件区域变化事件](reference/arkui-ts/ts-universal-component-area-change-event.md) - - 通用属性 - - [尺寸设置](reference/arkui-ts/ts-universal-attributes-size.md) - - [位置设置](reference/arkui-ts/ts-universal-attributes-location.md) - - [布局约束](reference/arkui-ts/ts-universal-attributes-layout-constraints.md) - - [Flex布局](reference/arkui-ts/ts-universal-attributes-flex-layout.md) - - [边框设置](reference/arkui-ts/ts-universal-attributes-border.md) - - [背景设置](reference/arkui-ts/ts-universal-attributes-background.md) - - [透明度设置](reference/arkui-ts/ts-universal-attributes-opacity.md) - - [显隐控制](reference/arkui-ts/ts-universal-attributes-visibility.md) - - [禁用控制](reference/arkui-ts/ts-universal-attributes-enable.md) - - [浮层](reference/arkui-ts/ts-universal-attributes-overlay.md) - - [Z序控制](reference/arkui-ts/ts-universal-attributes-z-order.md) - - [图形变换](reference/arkui-ts/ts-universal-attributes-transformation.md) - - [图像效果](reference/arkui-ts/ts-universal-attributes-image-effect.md) - - [形状裁剪](reference/arkui-ts/ts-universal-attributes-sharp-clipping.md) - - [文本样式设置](reference/arkui-ts/ts-universal-attributes-text-style.md) - - [栅格设置](reference/arkui-ts/ts-universal-attributes-grid.md) - - [颜色渐变](reference/arkui-ts/ts-universal-attributes-gradient-color.md) - - [Popup控制](reference/arkui-ts/ts-universal-attributes-popup.md) - - [Menu控制](reference/arkui-ts/ts-universal-attributes-menu.md) - - [点击控制](reference/arkui-ts/ts-universal-attributes-click.md) - - [焦点控制](reference/arkui-ts/ts-universal-attributes-focus.md) - - [悬浮态效果](reference/arkui-ts/ts-universal-attributes-hover-effect.md) - - [组件标识](reference/arkui-ts/ts-universal-attributes-component-id.md) - - [触摸热区设置](reference/arkui-ts/ts-universal-attributes-touch-target.md) - - [多态样式](reference/arkui-ts/ts-universal-attributes-polymorphic-style.md) - - 手势处理 - - [绑定手势方法](reference/arkui-ts/ts-gesture-settings.md) - - 基础手势 - - [TapGesture](reference/arkui-ts/ts-basic-gestures-tapgesture.md) - - [LongPressGesture](reference/arkui-ts/ts-basic-gestures-longpressgesture.md) - - [PanGesture](reference/arkui-ts/ts-basic-gestures-pangesture.md) - - [PinchGesture](reference/arkui-ts/ts-basic-gestures-pinchgesture.md) - - [RotationGesture](reference/arkui-ts/ts-basic-gestures-rotationgesture.md) - - [SwipeGesture](reference/arkui-ts/ts-basic-gestures-swipegesture.md) - - [组合手势](reference/arkui-ts/ts-combined-gestures.md) - - 基础组件 - - [Blank](reference/arkui-ts/ts-basic-components-blank.md) - - [Button](reference/arkui-ts/ts-basic-components-button.md) - - [Checkbox](reference/arkui-ts/ts-basic-components-checkbox.md) - - [CheckboxGroup](reference/arkui-ts/ts-basic-components-checkboxgroup.md) - - [DataPanel](reference/arkui-ts/ts-basic-components-datapanel.md) - - [DatePicker](reference/arkui-ts/ts-basic-components-datepicker.md) - - [Divider](reference/arkui-ts/ts-basic-components-divider.md) - - [Gauge](reference/arkui-ts/ts-basic-components-gauge.md) - - [Image](reference/arkui-ts/ts-basic-components-image.md) - - [ImageAnimator](reference/arkui-ts/ts-basic-components-imageanimator.md) - - [LoadingProgress](reference/arkui-ts/ts-basic-components-loadingprogress.md) - - [Marquee](reference/arkui-ts/ts-basic-components-marquee.md) - - [Navigation](reference/arkui-ts/ts-basic-components-navigation.md) - - [PatternLock](reference/arkui-ts/ts-basic-components-patternlock.md) - - [PluginComponent](reference/arkui-ts/ts-basic-components-plugincomponent.md) - - [Progress](reference/arkui-ts/ts-basic-components-progress.md) - - [QRCode](reference/arkui-ts/ts-basic-components-qrcode.md) - - [Radio](reference/arkui-ts/ts-basic-components-radio.md) - - [Rating](reference/arkui-ts/ts-basic-components-rating.md) - - [RichText](reference/arkui-ts/ts-basic-components-richtext.md) - - [ScrollBar](reference/arkui-ts/ts-basic-components-scrollbar.md) - - [Search](reference/arkui-ts/ts-basic-components-search.md) - - [Select](reference/arkui-ts/ts-basic-components-select.md) - - [Slider](reference/arkui-ts/ts-basic-components-slider.md) - - [Span](reference/arkui-ts/ts-basic-components-span.md) - - [Stepper](reference/arkui-ts/ts-basic-components-stepper.md) - - [StepperItem](reference/arkui-ts/ts-basic-components-stepperitem.md) - - [Text](reference/arkui-ts/ts-basic-components-text.md) - - [TextArea](reference/arkui-ts/ts-basic-components-textarea.md) - - [TextClock](reference/arkui-ts/ts-basic-components-textclock.md) - - [TextInput](reference/arkui-ts/ts-basic-components-textinput.md) - - [TextPicker](reference/arkui-ts/ts-basic-components-textpicker.md) - - [TextTimer](reference/arkui-ts/ts-basic-components-texttimer.md) - - [TimePicker](reference/arkui-ts/ts-basic-components-timepicker.md) - - [Toggle](reference/arkui-ts/ts-basic-components-toggle.md) - - [Web](reference/arkui-ts/ts-basic-components-web.md) - - [Xcomponent](reference/arkui-ts/ts-basic-components-xcomponent.md) - - 容器组件 - - [AlphabetIndexer](reference/arkui-ts/ts-container-alphabet-indexer.md) - - [Badge](reference/arkui-ts/ts-container-badge.md) - - [Column](reference/arkui-ts/ts-container-column.md) - - [ColumnSplit](reference/arkui-ts/ts-container-columnsplit.md) - - [Counter](reference/arkui-ts/ts-container-counter.md) - - [Flex](reference/arkui-ts/ts-container-flex.md) - - [GridContainer](reference/arkui-ts/ts-container-gridcontainer.md) - - [Grid](reference/arkui-ts/ts-container-grid.md) - - [GridItem](reference/arkui-ts/ts-container-griditem.md) - - [List](reference/arkui-ts/ts-container-list.md) - - [ListItem](reference/arkui-ts/ts-container-listitem.md) - - [Navigator](reference/arkui-ts/ts-container-navigator.md) - - [Panel](reference/arkui-ts/ts-container-panel.md) - - [Refresh](reference/arkui-ts/ts-container-refresh.md) - - [Row](reference/arkui-ts/ts-container-row.md) - - [RowSplit](reference/arkui-ts/ts-container-rowsplit.md) - - [Scroll](reference/arkui-ts/ts-container-scroll.md) - - [SideBarContainer](reference/arkui-ts/ts-container-sidebarcontainer.md) - - [Stack](reference/arkui-ts/ts-container-stack.md) - - [Swiper](reference/arkui-ts/ts-container-swiper.md) - - [Tabs](reference/arkui-ts/ts-container-tabs.md) - - [TabContent](reference/arkui-ts/ts-container-tabcontent.md) - - 媒体组件 - - [Video](reference/arkui-ts/ts-media-components-video.md) - - 绘制组件 - - [Circle](reference/arkui-ts/ts-drawing-components-circle.md) - - [Ellipse](reference/arkui-ts/ts-drawing-components-ellipse.md) - - [Line](reference/arkui-ts/ts-drawing-components-line.md) - - [Polyline](reference/arkui-ts/ts-drawing-components-polyline.md) - - [Polygon](reference/arkui-ts/ts-drawing-components-polygon.md) - - [Path](reference/arkui-ts/ts-drawing-components-path.md) - - [Rect](reference/arkui-ts/ts-drawing-components-rect.md) - - [Shape](reference/arkui-ts/ts-drawing-components-shape.md) - - 画布组件 - - [Canvas](reference/arkui-ts/ts-components-canvas-canvas.md) - - [CanvasRenderingContext2D对象](reference/arkui-ts/ts-canvasrenderingcontext2d.md) - - [OffscreenCanvasRenderingConxt2D对象](reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md) - - [Lottie](reference/arkui-ts/ts-components-canvas-lottie.md) - - [Path2D对象](reference/arkui-ts/ts-components-canvas-path2d.md) - - [CanvasGradient对象](reference/arkui-ts/ts-components-canvas-canvasgradient.md) - - [ImageBitmap对象](reference/arkui-ts/ts-components-canvas-imagebitmap.md) - - [ImageData对象](reference/arkui-ts/ts-components-canvas-imagedata.md) - - 动画 - - [属性动画](reference/arkui-ts/ts-animatorproperty.md) - - [显式动画](reference/arkui-ts/ts-explicit-animation.md) - - 转场动画 - - [页面间转场](reference/arkui-ts/ts-page-transition-animation.md) - - [组件内转场](reference/arkui-ts/ts-transition-animation-component.md) - - [共享元素转场](reference/arkui-ts/ts-transition-animation-shared-elements.md) - - [路径动画](reference/arkui-ts/ts-motion-path-animation.md) - - [矩阵变换](reference/arkui-ts/ts-matrix-transformation.md) - - [插值计算](reference/arkui-ts/ts-interpolation-calculation.md) - - 全局UI方法 - - 弹窗 - - [警告弹窗](reference/arkui-ts/ts-methods-alert-dialog-box.md) - - [列表选择弹窗](reference/arkui-ts/ts-methods-action-sheet.md) - - [自定义弹窗](reference/arkui-ts/ts-methods-custom-dialog-box.md) - - [日期时间选择弹窗](reference/arkui-ts/ts-methods-datepicker-dialog.md) - - [文本选择弹窗](reference/arkui-ts/ts-methods-textpicker-dialog.md) - - [菜单](reference/arkui-ts/ts-methods-menu.md) - - [文档中涉及到的内置枚举值](reference/arkui-ts/ts-appendix-enums.md) - - 接口参考 - - Ability框架 - - - [@ohos.ability.dataUriUtils (DataUriUtils模块)](reference/apis/js-apis-DataUriUtils.md) - - [@ohos.ability.errorCode (ErrorCode)](reference/apis/js-apis-ability-errorCode.md) - - [@ohos.ability.wantConstant (wantConstant)](reference/apis/js-apis-ability-wantConstant.md) - - [@ohos.application.Ability (Ability)](reference/apis/js-apis-application-ability.md) - - [@ohos.application.AbilityConstant (AbilityConstant)](reference/apis/js-apis-application-abilityConstant.md) - - [@ohos.application.abilityDelegatorRegistry (AbilityDelegatorRegistry)](reference/apis/js-apis-abilityDelegatorRegistry.md) - - [@ohos.application.AbilityStage (AbilityStage)](reference/apis/js-apis-application-abilitystage.md) - - [@ohos.application.appManager (appManager)](reference/apis/js-apis-appmanager.md) - - [@ohos.application.Configuration (Configuration)](reference/apis/js-apis-configuration.md) - - [@ohos.application.ConfigurationConstant (ConfigurationConstant)](reference/apis/js-apis-configurationconstant.md) - - [@ohos.application.DataShareExtensionAbility (DataShareExtensionAbility)](reference/apis/js-apis-application-DataShareExtensionAbility.md) - - [@ohos.ability.featureAbility (FeatureAbility模块)](reference/apis/js-apis-featureAbility.md) - - [@ohos.application.formBindingData (卡片数据绑定类)](reference/apis/js-apis-formbindingdata.md) - - [@ohos.application.FormExtension (FormExtension)](reference/apis/js-apis-formextension.md) - - [@ohos.application.formError (FormError)](reference/apis/js-apis-formerror.md) - - [@ohos.application.formHost (FormHost)](reference/apis/js-apis-formhost.md) - - [@ohos.application.formInfo (FormInfo)](reference/apis/js-apis-formInfo.md) - - [@ohos.application.missionManager (missionManager)](reference/apis/js-apis-missionManager.md) - - [@ohos.application.formProvider (FormProvider)](reference/apis/js-apis-formprovider.md) - - [@ohos.ability.particleAbility (particleAbility模块)](reference/apis/js-apis-particleAbility.md) - - [@ohos.application.ServiceExtensionAbility (ServiceExtensionAbility)](reference/apis/js-apis-service-extension-ability.md) - - [@ohos.application.StartOptions (StartOptions)](reference/apis/js-apis-application-StartOptions.md) - - [@ohos.application.StaticSubscriberExtensionAbility (StaticSubscriberExtensionAbility)](reference/apis/js-apis-application-staticSubscriberExtensionAbility.md) - - [@ohos.application.uriPermissionManager (uriPermissionManager)](reference/apis/js-apis-uripermissionmanager.md) - - [@ohos.application.Want (Want)](reference/apis/js-apis-application-Want.md) - - [@ohos.wantAgent (WantAgent模块)](reference/apis/js-apis-wantAgent.md) - - [dataAbilityHelper (DataAbilityHelper模块)](reference/apis/js-apis-dataAbilityHelper.md) - - [context (Context模块)](reference/apis/js-apis-Context.md) - - [AbilityContext (AbilityContext)](reference/apis/js-apis-ability-context.md) - - [abilityDelegator (AbilityDelegator)](reference/apis/js-apis-application-abilityDelegator.md) - - [abilityDelegatorArgs (AbilityDelegatorArgs)](reference/apis/js-apis-application-abilityDelegatorArgs.md) - - [abilityMonitor (AbilityMonitor)](reference/apis/js-apis-application-abilityMonitor.md) - - [AbilityRunningInfo (AbilityRunningInfo)](reference/apis/js-apis-abilityrunninginfo.md) - - [AbilityStageContext (AbilityStageContext)](reference/apis/js-apis-abilitystagecontext.md) - - [Context (Context)](reference/apis/js-apis-application-context.md) - - [ExtensionContext (ExtensionContext)](reference/apis/js-apis-extension-context.md) - - [ExtensionRunningInfo (ExtensionRunningInfo)](reference/apis/js-apis-extensionrunninginfo.md) - - [FormExtensionContext (FormExtensionContext)](reference/apis/js-apis-formextensioncontext.md) - - [MissionSnapshot (MissionSnapshot)](reference/apis/js-apis-application-MissionSnapshot.md) - - [PermissionRequestResult (PermissionRequestResult)](reference/apis/js-apis-permissionrequestresult.md) - - [ProcessRunningInfo (ProcessRunningInfo)](reference/apis/js-apis-processrunninginfo.md) - - [ServiceExtensionContext (ServiceExtensionContext)](reference/apis/js-apis-service-extension-context.md) - - [shellCmdResult (ShellCmdResult)](reference/apis/js-apis-application-shellCmdResult.md) - - - 公共事件与通知 - - - [@ohos.commonEvent (公共事件模块)](reference/apis/js-apis-commonEvent.md) - - [@ohos.events.emitter (Emitter)](reference/apis/js-apis-emitter.md) - - [@ohos.notification (Notification模块)](reference/apis/js-apis-notification.md) - - [@ohos.reminderAgent (后台代理提醒)](reference/apis/js-apis-reminderAgent.md) - - [EventHub (EventHub)](reference/apis/js-apis-eventhub.md) - - - 应用程序包管理 - - - [@ohos.bundle (Bundle模块)](reference/apis/js-apis-Bundle.md) - - [@ohos.bundleState (设备使用信息统计)](reference/apis/js-apis-deviceUsageStatistics.md) - - [@ohos.zlib (Zip模块)](reference/apis/js-apis-zlib.md) - - - UI界面 - - - [@ohos.animator (动画)](reference/apis/js-apis-animator.md) - - [@ohos.mediaquery (媒体查询)](reference/apis/js-apis-mediaquery.md) - - [@ohos.prompt (弹窗)](reference/apis/js-apis-prompt.md) - - [@ohos.router (页面路由)](reference/apis/js-apis-router.md) - - - 图形图像 - - - [@ohos.display (屏幕属性)](reference/apis/js-apis-display.md) - - [@ohos.screenshot (屏幕截图)](reference/apis/js-apis-screenshot.md) - - [@ohos.window (窗口)](reference/apis/js-apis-window.md) - - [webgl (WebGL)](reference/apis/js-apis-webgl.md) - - [webgl2 (WebGL2)](reference/apis/js-apis-webgl2.md) - - - 媒体 - - - [@ohos.multimedia.audio (音频管理)](reference/apis/js-apis-audio.md) - - [@ohos.multimedia.camera (相机管理)](reference/apis/js-apis-camera.md) - - [@ohos.multimedia.image (图片处理)](reference/apis/js-apis-image.md) - - [@ohos.multimedia.media (媒体服务)](reference/apis/js-apis-media.md) - - [@ohos.multimedia.medialibrary (媒体库管理)](reference/apis/js-apis-medialibrary.md) - - - 资源管理 - - [@ohos.i18n (国际化-I18n)](reference/apis/js-apis-i18n.md) - - [@ohos.intl (国际化-Intl)](reference/apis/js-apis-intl.md) - - [@ohos.resourceManager (资源管理)](reference/apis/js-apis-resource-manager.md) - - - 资源调度 - - - [@ohos.backgroundTaskManager (后台任务管理)](reference/apis/js-apis-backgroundTaskManager.md) - - [@ohos.workScheduler (延迟任务调度)](reference/apis/js-apis-workScheduler.md) - - [@ohos.WorkSchedulerExtensionAbility (延迟任务调度回调)](reference/apis/js-apis-WorkSchedulerExtensionAbility.md) - - - 定制管理 - - - [@ohos.configPolicy (配置策略)](reference/apis/js-apis-config-policy.md) - - [@ohos.enterpriseDeviceManager (企业设备管理)](reference/apis/js-apis-enterprise-device-manager.md) - - - 安全 - - - [@ohos.abilityAccessCtrl (访问控制管理)](reference/apis/js-apis-abilityAccessCtrl.md) - - [@ohos.security.huks (通用密钥库系统)](reference/apis/js-apis-huks.md) - - [@ohos.userIAM.userAuth (用户认证)](reference/apis/js-apis-useriam-userauth.md) - - [@system.cipher (加密算法)](reference/apis/js-apis-system-cipher.md) - - - 数据管理 - - - [@ohos.data.dataAbility (DataAbility谓词)](reference/apis/js-apis-data-ability.md) - - [@ohos.data.distributedData (分布式数据管理)](reference/apis/js-apis-distributed-data.md) - - [@ohos.data.distributedDataObject (分布式数据对象)](reference/apis/js-apis-data-distributedobject.md) - - [@ohos.data.preferences (首选项)](reference/apis/js-apis-data-preferences.md) - - [@ohos.data.rdb (关系型数据库)](reference/apis/js-apis-data-rdb.md) - - [@ohos.settings (设置数据项名称)](reference/apis/js-apis-settings.md) - - [resultSet (结果集)](reference/apis/js-apis-data-resultset.md) - - - 文件管理 - - - [@ohos.environment (目录环境能力)](reference/apis/js-apis-environment.md) - - [@ohos.fileio (文件管理)](reference/apis/js-apis-fileio.md) - - [@ohos.fileManager (公共文件访问与管理)](reference/apis/js-apis-filemanager.md) - - [@ohos.statfs (statfs)](reference/apis/js-apis-statfs.md) - - [@ohos.storageStatistics (应用空间统计)](reference/apis/js-apis-storage-statistics.md) - - [@ohos.volumeManager (卷管理)](reference/apis/js-apis-volumemanager.md) - - - 电话服务 - - - [@ohos.contact (联系人)](reference/apis/js-apis-contact.md) - - [@ohos.telephony.call (拨打电话)](reference/apis/js-apis-call.md) - - [@ohos.telephony.observer (observer)](reference/apis/js-apis-observer.md) - - [@ohos.telephony.radio (网络搜索)](reference/apis/js-apis-radio.md) - - [@ohos.telephony.sim (SIM卡管理)](reference/apis/js-apis-sim.md) - - [@ohos.telephony.sms (短信服务)](reference/apis/js-apis-sms.md) - - [@ohos.telephony.data (蜂窝数据)](reference/apis/js-apis-telephony-data.md) - - - 网络管理 - - [@ohos.net.connection (网络连接管理)](reference/apis/js-apis-net-connection.md) - - [@ohos.net.http (数据请求)](reference/apis/js-apis-http.md) - - [@ohos.request (上传下载)](reference/apis/js-apis-request.md) - - [@ohos.net.socket (Socket连接)](reference/apis/js-apis-socket.md) - - [@ohos.net.webSocket (WebSocket连接)](reference/apis/js-apis-webSocket.md) - - - 通信与连接 - - - [@ohos.bluetooth (蓝牙)](reference/apis/js-apis-bluetooth.md) - - [@ohos.connectedTag (有源标签)](reference/apis/js-apis-connectedTag.md) - - [@ohos.rpc (RPC通信)](reference/apis/js-apis-rpc.md) - - [@ohos.wifi (WLAN)](reference/apis/js-apis-wifi.md) - - [@ohos.wifiext (WLAN)](reference/apis/js-apis-wifiext.md) - - - 系统基础能力 - - - [@ohos.accessibility (辅助功能)](reference/apis/js-apis-accessibility.md) - - [@ohos.faultLogger (故障日志获取)](reference/apis/js-apis-faultLogger.md) - - [@ohos.hiAppEvent (应用打点)](reference/apis/js-apis-hiappevent.md) - - [@ohos.hichecker (检测模式)](reference/apis/js-apis-hichecker.md) - - [@ohos.hidebug (Debug调试)](reference/apis/js-apis-hidebug.md) - - [@ohos.hilog (日志打印)](reference/apis/js-apis-hilog.md) - - [@ohos.hiTraceChain (分布式跟踪)](reference/apis/js-apis-hitracechain.md) - - [@ohos.hiTraceMeter (性能打点)](reference/apis/js-apis-hitracemeter.md) - - [@ohos.inputMethod (输入法框架)](reference/apis/js-apis-inputmethod.md) - - [@ohos.inputMethodEngine (输入法服务)](reference/apis/js-apis-inputmethodengine.md) - - [@ohos.pasteboard (剪贴板)](reference/apis/js-apis-pasteboard.md) - - [@ohos.screenLock (锁屏管理)](reference/apis/js-apis-screen-lock.md) - - [@ohos.systemTime (设置系统时间)](reference/apis/js-apis-system-time.md) - - [@ohos.wallpaper (壁纸)](reference/apis/js-apis-wallpaper.md) - - [Timer (定时器)](reference/apis/js-apis-timer.md) - - - 设备管理 - - - [@ohos.batteryInfo (电量信息)](reference/apis/js-apis-battery-info.md) - - [@ohos.brightness (屏幕亮度)](reference/apis/js-apis-brightness.md) - - [@ohos.deviceInfo (设备信息)](reference/apis/js-apis-device-info.md) - - [@ohos.distributedHardware.deviceManager (设备管理)](reference/apis/js-apis-device-manager.md) - - [@ohos.geolocation (位置服务)](reference/apis/js-apis-geolocation.md) - - [@ohos.multimodalInput.inputConsumer (组合按键)](reference/apis/js-apis-inputconsumer.md) - - [@ohos.multimodalInput.inputDevice (输入设备)](reference/apis/js-apis-inputdevice.md) - - [@ohos.multimodalInput.inputEventClient (注入按键)](reference/apis/js-apis-inputeventclient.md) - - [@ohos.multimodalInput.inputMonitor (输入监听)](reference/apis/js-apis-inputmonitor.md) - - [@ohos.power (系统电源管理)](reference/apis/js-apis-power.md) - - [@ohos.runningLock (Runninglock锁)](reference/apis/js-apis-runninglock.md) - - [@ohos.sensor (传感器)](reference/apis/js-apis-sensor.md) - - [@ohos.systemParameter (系统属性)](reference/apis/js-apis-system-parameter.md) - - [@ohos.thermal (热管理)](reference/apis/js-apis-thermal.md) - - [@ohos.update (升级)](reference/apis/js-apis-update.md) - - [@ohos.usb (USB管理)](reference/apis/js-apis-usb.md) - - [@ohos.vibrator (振动)](reference/apis/js-apis-vibrator.md) - - - 帐号管理 - - - [@ohos.account.appAccount (应用帐号管理)](reference/apis/js-apis-appAccount.md) - - [@ohos.account.distributedAccount (分布式帐号管理)](reference/apis/js-apis-distributed-account.md) - - [@ohos.account.osAccount (系统帐号管理)](reference/apis/js-apis-osAccount.md) - - - 语言基础类库 - - - [@ohos.convertxml (xml转换JavaScript)](reference/apis/js-apis-convertxml.md) - - [@ohos.process (获取进程相关的信息)](reference/apis/js-apis-process.md) - - [@ohos.uri (URI字符串解析)](reference/apis/js-apis-uri.md) - - [@ohos.url (URL字符串解析)](reference/apis/js-apis-url.md) - - [@ohos.util (util工具函数)](reference/apis/js-apis-util.md) - - [@ohos.util.ArrayList (线性容器ArrayList)](reference/apis/js-apis-arraylist.md) - - [@ohos.util.Deque (线性容器Deque)](reference/apis/js-apis-deque.md) - - [@ohos.util.HashMap (非线性容器HashMap)](reference/apis/js-apis-hashmap.md) - - [@ohos.util.HashSet (非线性容器HashSet)](reference/apis/js-apis-hashset.md) - - [@ohos.util.LightWeightMap (非线性容器LightWeightMap)](reference/apis/js-apis-lightweightmap.md) - - [@ohos.util.LightWeightSet (非线性容器LightWeightSet)](reference/apis/js-apis-lightweightset.md) - - [@ohos.util.LinkedList (线性容器LinkedList)](reference/apis/js-apis-linkedlist.md) - - [@ohos.util.List (线性容器List)](reference/apis/js-apis-list.md) - - [@ohos.util.PlainArray (非线性容器PlainArray)](reference/apis/js-apis-plainarray.md) - - [@ohos.util.Queue (线性容器Queue)](reference/apis/js-apis-queue.md) - - [@ohos.util.Stack (线性容器Stack)](reference/apis/js-apis-stack.md) - - [@ohos.util.TreeMap (非线性容器TreeMap)](reference/apis/js-apis-treemap.md) - - [@ohos.util.TreeSet (非线性容器TreeSet)](reference/apis/js-apis-treeset.md) - - [@ohos.util.Vector (线性容器Vector)](reference/apis/js-apis-vector.md) - - [@ohos.worker (启动一个Worker)](reference/apis/js-apis-worker.md) - - [@ohos.xml (xml解析与生成)](reference/apis/js-apis-xml.md) - - - 测试 - - [@ohos.application.testRunner (TestRunner)](reference/apis/js-apis-testRunner.md) - - [@ohos.uitest (UiTest)](reference/apis/js-apis-uitest.md) - - - 已停止维护的接口 - - - [@ohos.bytrace (性能打点)](reference/apis/js-apis-bytrace.md) - - [@ohos.data.storage (轻量级存储)](reference/apis/js-apis-data-storage.md) - - [@system.app (应用上下文)](reference/apis/js-apis-system-app.md) - - [@system.battery (电量信息)](reference/apis/js-apis-system-battery.md) - - [@system.bluetooth (蓝牙)](reference/apis/js-apis-system-bluetooth.md) - - [@system.brightness (屏幕亮度)](reference/apis/js-apis-system-brightness.md) - - [@system.configuration (应用配置)](reference/apis/js-apis-system-configuration.md) - - [@system.device (设备信息)](reference/apis/js-apis-system-device.md) - - [@system.fetch (数据请求)](reference/apis/js-apis-system-fetch.md) - - [@system.file (文件存储)](reference/apis/js-apis-system-file.md) - - [@system.geolocation (地理位置)](reference/apis/js-apis-system-location.md) - - [@system.mediaquery (媒体查询)](reference/apis/js-apis-system-mediaquery.md) - - [@system.network (网络状态)](reference/apis/js-apis-system-network.md) - - [@system.notification (通知消息)](reference/apis/js-apis-system-notification.md) - - [@system.package (应用管理)](reference/apis/js-apis-system-package.md) - - [@system.prompt (弹窗)](reference/apis/js-apis-system-prompt.md) - - [@system.request (上传下载)](reference/apis/js-apis-system-request.md) - - [@system.router (页面路由)](reference/apis/js-apis-system-router.md) - - [@system.sensor (传感器)](reference/apis/js-apis-system-sensor.md) - - [@system.storage (数据存储)](reference/apis/js-apis-system-storage.md) - - [@system.vibrator (振动)](reference/apis/js-apis-system-vibrate.md) - - [console (日志打印)](reference/apis/js-apis-logs.md) \ No newline at end of file diff --git a/zh-cn/application-dev/background-agent-scheduled-reminder/Readme-CN.md b/zh-cn/application-dev/background-agent-scheduled-reminder/Readme-CN.md index 36e13289889925f9294edc84b449172d8ec373ac..f27749679e91e3a571764de33fff99d670499a6e 100644 --- a/zh-cn/application-dev/background-agent-scheduled-reminder/Readme-CN.md +++ b/zh-cn/application-dev/background-agent-scheduled-reminder/Readme-CN.md @@ -1,4 +1,4 @@ # 后台代理提醒 -- [概述](background-agent-scheduled-reminder-overview.md) -- [开发指导](background-agent-scheduled-reminder-guide.md) +- [后台代理提醒概述](background-agent-scheduled-reminder-overview.md) +- [后台代理提醒开发指导](background-agent-scheduled-reminder-guide.md) diff --git a/zh-cn/application-dev/connectivity/ipc-rpc-development-guideline.md b/zh-cn/application-dev/connectivity/ipc-rpc-development-guideline.md index f1f2cdbc55c6af48efb1b6540ecb4c93751240a3..360595acc2cf789aec3eb0b107c50b684bbda523 100755 --- a/zh-cn/application-dev/connectivity/ipc-rpc-development-guideline.md +++ b/zh-cn/application-dev/connectivity/ipc-rpc-development-guideline.md @@ -26,7 +26,7 @@ IPC/RPC的主要工作是让运行在不同进程的Proxy和Stub互相通信, ``` class ITestAbility : public IRemoteBroker { public: - // DECLARE_INTERFACE_DESCRIPTOR是必须的,入参需使用std::u16string; + // DECLARE_INTERFACE_DESCRIPTOR是必需的,入参需使用std::u16string; DECLARE_INTERFACE_DESCRIPTOR(u"test.ITestAbility"); int TRANS_ID_PING_ABILITY = 1; // 定义消息码 virtual int TestPingAbility(const std::u16string &dummy) = 0; // 定义业务函数 diff --git a/zh-cn/application-dev/database/Readme-CN.md b/zh-cn/application-dev/database/Readme-CN.md index ab2703c93e686776ff8c3a85f06ce6859624f55b..f52d1f24dd42ae50568007e904d13f788574995e 100644 --- a/zh-cn/application-dev/database/Readme-CN.md +++ b/zh-cn/application-dev/database/Readme-CN.md @@ -6,9 +6,9 @@ - 关系型数据库 - [关系型数据库概述](database-relational-overview.md) - [关系型数据库开发指导](database-relational-guidelines.md) -- 轻量级数据存储 - - [轻量级数据存储概述](database-preference-overview.md) - - [轻量级数据存储开发指导](database-preference-guidelines.md) +- 首选项 + - [首选项概述](database-preference-overview.md) + - [首选项开发指导](database-preference-guidelines.md) - 分布式数据对象 - [分布式数据对象概述](database-distributedobject-overview.md) - [分布式数据对象开发指导](database-distributedobject-guidelines.md) diff --git a/zh-cn/application-dev/database/database-preference-guidelines.md b/zh-cn/application-dev/database/database-preference-guidelines.md index b7b7011cf3af45627f86f7085de48dded0ab1957..c0480e7c040af40c3a8d079c4fc263489e0ec21b 100644 --- a/zh-cn/application-dev/database/database-preference-guidelines.md +++ b/zh-cn/application-dev/database/database-preference-guidelines.md @@ -1,103 +1,97 @@ -# 轻量级数据存储开发指导 +# 首选项开发指导 ## 场景介绍 -轻量级数据存储功能通常用于保存应用的一些常用配置信息,并不适合需要存储大量数据和频繁改变数据的场景。应用的数据保存在文件中,这些文件可以持久化地存储在设备上。需要注意的是,应用访问的实例包含文件所有数据,这些数据会一直加载在设备的内存中,直到应用主动从内存中将其移除前,应用可以通过Storage的API进行数据操作。 +首选项功能通常用于保存应用的一些常用配置信息,并不适合需要存储大量数据和频繁改变数据的场景。应用的数据保存在文件中,这些文件可以持久化地存储在设备上。需要注意的是,应用访问的实例包含文件所有数据,这些数据会一直加载在设备的内存中,直到应用主动从内存中将其移除前,应用都可以通过Preferences API进行相关数据操作。 ## 接口说明 -轻量级存储为应用提供key-value键值型的文件数据处理能力,支持应用对数据进行轻量级存储及查询。数据存储形式为键值对,键的类型为字符串型,值的存储数据类型包括数字型、字符型、布尔型。 +首选项为应用提供key-value键值型的文件数据处理能力,支持应用持久化轻量级数据,并对其修改和查询。数据存储形式为键值对,键的类型为字符串型,值的存储数据类型包括数字型、字符型、布尔型。 -**创建存储实例** +### 创建存储实例 -读取指定文件,将数据加载到Storage实例,即可创建一个存储实例,用于数据操作。 +读取指定文件,将数据加载到Preferences实例,即可创建一个存储实例,用于数据操作。 -**表1** 轻量级数据存储实例创建接口 +**表1** 首选项实例创建接口 | 包名 | 接口名 | 描述 | | ----------------- | ------------------------------------------- | ------------------------------------------- | -| ohos.data.storage | getStorage(path: string): Promise\ | 获取文件对应的Storage单实例,用于数据操作。 | +| ohos.data.preferences | getPreferences(context: Context, name: string): Promise\ | 读取指定首选项持久化文件,将数据加载到Preferences实例,用于数据操作。 | -**存入数据** +### 存入数据 -通过put系列方法,可以增加或修改Storage实例中的数据。 +通过put系列方法,可以增加或修改Preferences实例中的数据。 -**表2** 轻量级数据存入接口 +**表2** 首选项存入接口 | 类名 | 接口名 | 描述 | | ------- | -------------------------------------------------- | ----------------------------------------------- | -| Storage | put(key: string, value: ValueType): Promise\ | 支持值为number、string、boolean类型的数据存入。 | +| Preferences | put(key: string, value: ValueType): Promise\ | 支持值为number、string、boolean类型的数据存入。 | -**读取数据** +### 读取数据 -通过调用get系列方法,可以读取Storage中的数据。 +通过调用get系列方法,可以读取Preferences中的数据。 -**表3** 轻量级数据读取接口 +**表3** 首选项读取接口 | 类名 | 接口名 | 描述 | | ------- | ---------------------------------------------------------- | ----------------------------------------------- | -| Storage | get(key: string, defValue: ValueType): Promise\ | 支持获取值为number、string、boolean类型的数据。 | +| Preferences | get(key: string, defValue: ValueType): Promise\ | 支持获取值为number、string、boolean类型的数据。 | -**数据持久化** +### 数据持久化 通过执行flush方法,应用可以将缓存的数据再次写回文本文件中进行持久化存储。 -**表4** 轻量级数据持久化接口 +**表4** 首选项持久化接口 | 类名 | 接口名 | 描述 | | ------- | ----------------------- | --------------------------------------- | -| Storage | flush(): Promise\ | 将Storage实例通过异步线程回写入文件中。 | +| Preferences | flush(): Promise\ | 将Preferences实例通过异步线程回写入文件中。 | -**订阅数据变化** +### 订阅数据变化 -订阅数据变化需要指定StorageObserver作为回调方法。订阅的key的值发生变更后,当执行flush方法时,StorageObserver被回调。 +订阅数据变更者类,订阅的key的值发生变更后,在执行flush方法后,会执行callback回调。 -**表5** 轻量级数据变化订阅接口 +**表5** 首选项变化订阅接口 | 类名 | 接口名 | 描述 | | ------- | ------------------------------------------------------------ | -------------- | -| Storage | on(type: 'change', callback: Callback\): void | 订阅数据变化。 | -| Storage | off(type: 'change', callback: Callback\): void | 注销订阅。 | +| Preferences | on(type: 'change', callback: Callback<{ key : string }>): void | 订阅数据变化。 | +| Preferences | off(type: 'change', callback: Callback<{ key : string }>): void | 注销订阅。 | -**删除数据文件** +### 删除数据文件 通过调用以下两种接口,可以删除数据实例或对应的文件。 -**表6** 轻量级数据存储删除接口 +**表6** 首选项删除接口 | 包名 | 接口名 | 描述 | | ----------------- | ---------------------------------------------------- | ------------------------------------------------------------ | -| ohos.data.storage | deleteStorage(path: string): Promise\ | 从缓存中移除已加载的Storage对象,同时从设备上删除对应的文件。 | -| ohos.data.storage | removeStorageFromCache(path: string): Promise\ | 仅从缓存中移除已加载的Storage对象,主要用于释放内存。 | +| ohos.data.preferences | deletePreferences(context: Context, name: string): Promise; | 从缓存中移除已加载的Preferences对象,同时从设备上删除对应的文件。 | +| ohos.data.preferences | removePreferencesFromCache(context: Context, name: string): Promise\; | 仅从缓存中移除已加载的Preferences对象,主要用于释放内存。 ## 开发步骤 -1. 准备工作,导入@ohos.data.storage以及相关的模块到开发环境。 +1. 准备工作,导入@ohos.data.preferences以及相关的模块到开发环境。 ```js - import dataStorage from '@ohos.data.storage' - import featureAbility from '@ohos.ability.featureAbility' // 用于获取文件存储路径 + import data_preferences from '@ohos.data.preferences' ``` -2. 获取Storage实例。 +2. 获取Preferences实例。 - 读取指定文件,将数据加载到Storage实例,用于数据操作。 + 读取指定文件,将数据加载到Preferences实例,用于数据操作。 ```js - var context = featureAbility.getContext() - context.getFilesDir().then(() => { - console.info("======================>getFilesDirPromsie====================>"); - }); - - let promise = dataStorage.getStorage(path + '/mystore') + let promise = data_preferences.getPreferences(this.context, 'mystore') ``` 3. 存入数据。 - 使用Storage put方法保存数据到缓存的实例中。 + 使用Preferences put方法保存数据到缓存的实例中。 ```js - promise.then((storage) => { - let getPromise = storage.put('startup', 'auto') // 保存数据到缓存的storage示例中。 + promise.then((preferences) => { + let getPromise = preferences.put('startup', 'auto') getPromise.then(() => { console.info("Put the value of startup successfully.") }).catch((err) => { @@ -110,11 +104,11 @@ 4. 读取数据。 - 使用Storage get方法读取数据。 + 使用Preferences get方法读取数据。 ```js - promise.then((storage) => { - let getPromise = storage.get('startup', 'default') + promise.then((preferences) => { + let getPromise = preferences.get('startup', 'default') getPromise.then((value) => { console.info("The value of startup is " + value) }).catch((err) => { @@ -126,44 +120,46 @@ 5. 数据持久化。 - 应用存入数据到Storage实例后,可以通过flush或者flushSync方法将Storage实例回写到文件中。 + 应用存入数据到Preferences实例后,可以通过flush方法将Preferences实例回写到文件中。 ```js - storage.flush(); + preferences.flush(); ``` 6. 订阅数据变化。 - 应用订阅数据变化需要指定StorageObserver作为回调方法。订阅的key的值发生变更后,当执行flush方法时,StorageObserver被触发回调。不再需要StorageObserver时请注销。 + 应用订阅数据变化需要指定observer作为回调方法。订阅的key的值发生变更后,当执行flush方法时,observer被触发回调。 ```js - promise.then((storage) => { - var observer = function (key) { - console.info("The key of " + key + " changed.") - } - storage.on('change', observer) - storage.putSync('startup', 'auto') // 修改storage存储数据 - storage.flushSync() // 触发订阅者回调方法 - - storage.off('change', observer) // 注销数据变化订阅 - }).catch((err) => { - console.info("Get the storage failed") - }) + var observer = function (key) { + console.info("The key of " + key + " changed.") + } + preferences.on('change', observer) + preferences.put('startup', 'auto', function (err) { + if (err) { + console.info("Put the value of startup failed with err: " + err) + return + } + console.info("Put the value of startup successfully.") + preferences.flush(function (err) { + if (err) { + console.info("Flush to file failed with err: " + err) + return + } + console.info("Flushed to file successfully.") // observer will be called. + }) + }) ``` 7. 删除指定文件。 - 使用deleteStorage方法从内存中移除指定文件对应的Storage单实例,并删除指定文件及其备份文件、损坏文件。删除指定文件时,应用不允许再使用该实例进行数据操作,否则会出现数据一致性问题。删除后,数据及文件将不可恢复。 + 使用deletePreferences方法从内存中移除指定文件对应的Preferences单实例,并删除指定文件及其备份文件、损坏文件。删除指定文件时,应用不允许再使用该实例进行数据操作,否则会出现数据一致性问题。删除后,数据及文件将不可恢复。 ```js - let promise = dataStorage.deleteStorage(path + '/mystore') - promise.then(() => { - console.info("Deleted successfully.") - }).catch((err) => { - console.info("Deleted failed with err: " + err)}) + let proDelete = data_preferences.deletePreferences(context, 'mystore') + proDelete.then(() => { + console.info("Deleted successfully.") + }).catch((err) => { + console.info("Deleted failed with err: " + err) + }) ``` -## 相关实例 -针对轻量级数据存储开发,有以下相关实例可供参考: -- [`LiteStorage`:轻量级存储(eTS)(API7)](https://gitee.com/openharmony/app_samples/tree/master/data/LiteStorage) -- [轻量级偏好数据库](https://gitee.com/openharmony/codelabs/tree/master/Data/Database) -- [备忘录(eTS)](https://gitee.com/openharmony/codelabs/tree/master/Data/NotePad_OH_ETS) \ No newline at end of file diff --git a/zh-cn/application-dev/database/database-preference-overview.md b/zh-cn/application-dev/database/database-preference-overview.md index 78a87adb1a3caa897cb5c4a1706105c120e8e53d..352a81347e31d67386d514c9d4d40f625a28a26a 100644 --- a/zh-cn/application-dev/database/database-preference-overview.md +++ b/zh-cn/application-dev/database/database-preference-overview.md @@ -1,6 +1,6 @@ -# 轻量级数据存储概述 +# 首选项概述 -轻量级数据存储适用于对Key-Value结构的数据进行存取和持久化操作。应用获取某个轻量级存储对象后,该存储对象中的数据将会被缓存在内存中,以便应用获得更快的数据存取速度。应用也可以将缓存的数据再次写回文本文件中进行持久化存储,由于文件读写将产生不可避免的系统资源开销,建议应用减少对持久化文件的读写频率。 +首选项适用于对Key-Value结构的数据进行存取和持久化操作。应用获取某个Preferences对象后,该存储对象中的数据将会被缓存在内存中,以便应用获得更快的数据存取速度。应用也可以将缓存的数据再次写回文本文件中进行持久化存储,由于文件读写将产生不可避免的系统资源开销,建议应用减少对持久化文件的读写频率。 ## 基本概念 @@ -14,15 +14,15 @@ ## 运作机制 -1. 应用通过指定Storage文件将其中的数据加载到Storage实例,系统会通过静态容器将该实例存储在内存中,同一应用或进程中每个文件仅存在一个Storage实例,直到应用主动从内存中移除该实例或者删除该Storage文件。 -2. 应用获取到Storage文件对应的实例后,可以从Storage实例中读取数据,或者将数据存入Storage实例中。通过调用flush或者flushSync方法可以将Storage实例中的数据回写到文件里。 +1. 应用通过指定首选项持久化文件将其中的数据加载到Preferences实例,系统会通过静态容器将该实例存储在内存中,同一应用或进程中每个文件仅存在一个Preferences实例,直到应用主动从内存中移除该实例或者删除该首选项持久化文件。 +2. 应用获取到首选项持久化文件对应的实例后,可以从Preferences实例中读取数据,或者将数据存入Preferences实例中。通过调用flush方法可以将Preferences实例中的数据回写到文件里。 -**图1** 轻量级数据存储运作机制 +**图1** 首选项运作机制 ![zh-cn_image_0000001199139454](figures/zh-cn_image_0000001199139454.png) ## 约束与限制 -- 因Storage实例会加载到内存中,建议存储的数据不超过一万条,并及时清理不再使用的实例,以便减少非内存开销。 -- 数据中的key为string类型,要求非空且字符长度不超过80。 -- 当数据中的value为string类型时,允许为空,字符长度不超过8192。 \ No newline at end of file +- 因Preferences实例会加载到内存中,建议存储的数据不超过一万条,并及时清理不再使用的实例,以便减少非内存开销。 +- 数据中的key为string类型,要求非空且字符长度不超过80字节。 +- 当数据中的value为string类型时,允许为空,字符长度不超过8192字节。 diff --git a/zh-cn/application-dev/database/figures/zh-cn_image_0000001199139454.png b/zh-cn/application-dev/database/figures/zh-cn_image_0000001199139454.png index 5a6f6879944d0fda3cc24d7e726c842c74476728..6c41abd0be236566acb9ce45ee20de57f0b1e6c8 100644 Binary files a/zh-cn/application-dev/database/figures/zh-cn_image_0000001199139454.png and b/zh-cn/application-dev/database/figures/zh-cn_image_0000001199139454.png differ diff --git a/zh-cn/application-dev/media/Readme-CN.md b/zh-cn/application-dev/media/Readme-CN.md index 0cd436d9614e6992161dd147d382fcbac638b28a..9c39d85302086efca820bb40678674cbfe77f8ae 100755 --- a/zh-cn/application-dev/media/Readme-CN.md +++ b/zh-cn/application-dev/media/Readme-CN.md @@ -6,9 +6,10 @@ - [音频录制开发指导](audio-recorder.md) - [音频渲染开发指导](audio-renderer.md) - [音频采集开发指导](audio-capturer.md) + - [OpenSL ES播放开发指导](opensles-playback.md) - [OpenSL ES录音开发指导](opensles-capture.md) -- 视频 +- 视频 - [视频播放开发指导](video-playback.md) - [视频录制开发指导](video-recorder.md) diff --git a/zh-cn/application-dev/media/opensles-playback.md b/zh-cn/application-dev/media/opensles-playback.md new file mode 100644 index 0000000000000000000000000000000000000000..798caabbe00ab1fa109f63edb9e43b6ec5ff8ee5 --- /dev/null +++ b/zh-cn/application-dev/media/opensles-playback.md @@ -0,0 +1,123 @@ +# OpenSL ES音频播放开发指导 + + + +## 场景介绍 + +开发者可以通过本文了解到在**OpenHarmony**如何使用**OpenSL ES**进行音频播放相关操作;当前仅实现了部分[**OpenSL ES**接口](https://gitee.com/openharmony/third_party_opensles/blob/master/api/1.0.1/OpenSLES.h),未实现接口调用后会返回**SL_RESULT_FEATURE_UNSUPPORTED** + + + +## 开发步骤 + +以下步骤描述了在**OpenHarmony**如何使用**OpenSL ES**开发音频播放功能: + +1. 添加头文件 + + ```c++ + #include + #include + #include + ``` + + + +2. 使用 **slCreateEngine** 接口和获取 **engine** 实例。 + + ```c++ + SLObjectItf engineObject = nullptr; + slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr); + (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); + ``` + + + +3. 获取接口 **SL_IID_ENGINE** 的 **engineEngine** 实例 + + ```c++ + SLEngineItf engineEngine = nullptr; + (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineEngine); + ``` + + + +4. 配置播放器信息,创建 **AudioPlayer** 。 + + ```c++ + SLDataLocator_BufferQueue slBufferQueue = { + SL_DATALOCATOR_BUFFERQUEUE, + 0 + }; + + //具体参数需要根据音频文件格式进行适配 + SLDataFormat_PCM pcmFormat = { + SL_DATAFORMAT_PCM, + 2, + 48000, + 16, + 0, + 0, + 0 + }; + SLDataSource slSource = {&slBufferQueue, &pcmFormat}; + + SLObjectItf pcmPlayerObject = nullptr; + (*engineEngine)->CreateAudioPlayer(engineEngine, &pcmPlayerObject, &slSource, null, 0, nullptr, nullptr); + (*pcmPlayerObject)->Realize(pcmPlayerObject, SL_BOOLEAN_FALSE); + ``` + + + +5. 获取接口 **SL_IID_OH_BUFFERQUEUE** 的 **bufferQueueItf** 实例 + + ``` + SLOHBufferQueueItf bufferQueueItf; + (*pcmPlayerObject)->GetInterface(pcmPlayerObject, SL_IID_OH_BUFFERQUEUE, &bufferQueueItf); + ``` + + + +6. 打开音频文件,注册 **BuqqerQueueCallback** 回调 + + ```c++ + FILE *wavFile_ = nullptr; + + static void BuqqerQueueCallback (SLOHBufferQueueItf bufferQueueItf, void *pContext, SLuint32 size) + { + FILE *wavFile = (FILE *)pContext; + if (!feof(wavFile)) { + SLuint8 *buffer = nullptr; + SLuint32 pSize = 0; + (*bufferQueueItf)->GetBuffer(bufferQueueItf, &buffer, pSize); + //从文件读取数据 + fread(buffer, 1, size, wavFile); + (*bufferQueueItf)->Enqueue(bufferQueueItf, buffer, size); + } + return; + } + + //wavFile_ 需要设置为用户想要播放的文件描述符 + wavFile_ = fopen(path, "rb"); + (*bufferQueueItf)->RegisterCallback(bufferQueueItf, BuqqerQueueCallback, wavFile_); + ``` + + + +7. 获取接口 **SL_PLAYSTATE_PLAYING** 的 **playItf** 实例,开始播放 + + ```c++ + SLPlayItf playItf = nullptr; + (*pcmPlayerObject)->GetInterface(pcmPlayerObject, SL_IID_PLAY, &playItf); + (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_PLAYING); + ``` + + + +8. 结束音频播放 + + ```c++ + (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_STOPPED); + (*pcmPlayerObject)->Destroy(pcmPlayerObject); + (*engineObject)->Destroy(engineObject); + ``` + diff --git a/zh-cn/application-dev/napi/napi_dev_guide.md b/zh-cn/application-dev/napi/napi-guidelines.md similarity index 100% rename from zh-cn/application-dev/napi/napi_dev_guide.md rename to zh-cn/application-dev/napi/napi-guidelines.md diff --git a/zh-cn/application-dev/notification/Readme-CN.md b/zh-cn/application-dev/notification/Readme-CN.md index 74aaca325ed0986e709ce51fcd1c4d73afe2edd4..dd66f44c248cdc98076b90632945f5f3aec60049 100644 --- a/zh-cn/application-dev/notification/Readme-CN.md +++ b/zh-cn/application-dev/notification/Readme-CN.md @@ -1,17 +1,9 @@ # 公共事件与通知 -[公共事件与通知概述](notification-brief.md) - -### 公共事件 - -* [公共事件开发指导](common-event.md) - -### 通知 - -* [通知开发指导](notification.md) - - - -### 调试工具 - -* [调试助手使用指导](assistant-guidelines.md) \ No newline at end of file +- [公共事件与通知概述](notification-brief.md) +- 公共事件 + - [公共事件开发指导](common-event.md) +- 通知 + - [通知开发指导](notification.md) +- 调试工具 + - [调试助手使用指导](assistant-guidelines.md) \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/Readme-CN.md b/zh-cn/application-dev/quick-start/Readme-CN.md index 6ae68a4de39752e6124f9e1529204ca92c03367c..0ef683ee76f7c5d9aec274134ce72c2902b1185c 100755 --- a/zh-cn/application-dev/quick-start/Readme-CN.md +++ b/zh-cn/application-dev/quick-start/Readme-CN.md @@ -1,14 +1,14 @@ # 入门 - 快速入门 - - [开发准备](start-overview.md) - - [使用eTS语言开发(传统代码方式)](start-with-ets.md) - - [使用eTS语言开发(低代码方式)](start-with-ets-low-code.md) - - [使用JS语言开发(传统代码方式)](start-with-js.md) - - [使用JS语言开发(低代码方式)](start-with-js-low-code.md) + - [开发准备](start-overview.md) + - [使用eTS语言开发(传统代码方式)](start-with-ets.md) + - [使用eTS语言开发(低代码方式)](start-with-ets-low-code.md) + - [使用JS语言开发(传统代码方式)](start-with-js.md) + - [使用JS语言开发(低代码方式)](start-with-js-low-code.md) - 开发基础知识 - - [应用包结构说明(FA模型)](package-structure.md) - - [应用包结构说明(Stage模型)](module-structure.md) - - [资源文件的分类](basic-resource-file-categories.md) - - [SysCap说明](syscap.md) + - [应用包结构说明(FA模型)](package-structure.md) + - [应用包结构说明(Stage模型)](module-structure.md) + - [资源文件的分类](basic-resource-file-categories.md) + - [SysCap说明](syscap.md) diff --git a/zh-cn/application-dev/quick-start/module-structure.md b/zh-cn/application-dev/quick-start/module-structure.md index 9c7bb07fea06713c8f1f82bcd066cab654beb94d..921227f53f218669c201dd8db325d3557aa09bf6 100644 --- a/zh-cn/application-dev/quick-start/module-structure.md +++ b/zh-cn/application-dev/quick-start/module-structure.md @@ -109,6 +109,8 @@ module.json示例: "voip", "taskKeeping" ], + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:red" } ], "abilities": [ @@ -141,6 +143,8 @@ module.json示例: "voip", "taskKeeping" ], + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:red" } ], "requestPermissions": [ @@ -313,6 +317,8 @@ abilities描述ability的配置信息,标签值为数组类型。 | continuable | 该标签标识ability是否可以迁移,为布尔类型,true表示可以被迁移, false表示不可以被迁移。 | 布尔值 | 该标签可缺省,缺省值为false。 | | skills | 该标签标识ability能够接收的意图的特征集,为数组格式。
配置规则 : entry包可以配置多个具有入口能力的skills标签(配置了action.system.home和entity.system.home)的ability,其中第一个配置了skills标签的ability中的label和icon作为OpenHarmony服务或应用的label和icon。
OpenHarmony服务的Feature包不能配置具有入口能力的skills标签。
OpenHarmony应用的Feature包可以配置具有入口能力的skills标签。
skills内部结构参考[skills对象内部结构](#skills对象内部结构)。 | 数组 | 该标签可缺省,缺省值为空。 | | backgroundModes | 该标签标识ability长时任务集合。指定用于满足特定类型的长时任务。
长时任务类型有如下 :
dataTransfer :通过网络/对端设备进行数据下载、备份、分享、传输等业务。
audioPlayback :音频输出业务。
audioRecording :音频输入业务。
location :定位、导航业务。
bluetoothInteraction :蓝牙扫描、连接、传输业务(穿戴)。
multiDeviceConnection :多设备互联业务。
wifiInteraction :Wifi扫描、连接、传输业务(克隆 多屏)。
voip :音视频电话,VOIP业务。
taskKeeping :计算业务。
| 字符串 | 可缺省,缺省为空。 | +| startWindowIcon | 表示该Ability启动页面图标资源文件的索引。取值示例:$media:icon。 | 字符串 | 不可缺省。 | +| startWindowBackground | 表示该Ability启动页面背景颜色资源文件的索引。取值示例:$color:red。 | 字符串 | 不可缺省。 | abilities示例 @@ -345,6 +351,8 @@ abilities示例 "voip", "taskKeeping" ], + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:red" }], } ``` @@ -439,7 +447,7 @@ skills示例 | description | 该标签标识extensionAbility的描述,标签值是是字符串类型或对描述内容的资源索引,以支持多语言。 | 字符串 | 该标签可缺省,缺省值为空。 | | icon | 该标签标识extensionAbility图标,标签值为资源文件的索引。如果extensionAbility被配置为MainElement,该标签必须配置。 | 字符串 | 该标签可缺省,缺省值为空。 | | label | 该标签标识extensionAbility对用户显示的名称,标签值配置为该名称的资源索引以支持多语言。
如果extensionAbility被配置为MainElement,该标签必须配置,且应用内唯一。 | 字符串 | 该标签不可缺省。 | -| type | 该标签标识extensionAbility的类型,取值为form、workScheduler、inputMethod、service、accessibility、dataShare、fileShare、staticSubscriber、wallpaper其中之一。 | 字符串 | 该标签不可缺省。 | +| type | 该标签标识extensionAbility的类型,取值为form、workScheduler、inputMethod、service、accessibility、dataShare、fileShare、staticSubscriber、wallpaper、backup其中之一。 | 字符串 | 该标签不可缺省。 | | permissions | 该标签标识被其它应用的ability调用时需要申请的权限的集合,字符串数组类型,每个数组元素为一个权限名称,通常采用反向域名方式表示(最大255字节),可以是系统预定义的权限,也可以是该应用自定义的权限。如果是后者,需与defPermissions标签中定义的某个权限的name标签值一致。 | 字符串数组 | 该标签可缺省,缺省值为空。 | | uri | 该标签标识ability提供的数据uri,为字符数组类型(最大长度255),用反向域名的格式表示。该标签在type为dataShare类型的extensionAbility时,不可缺省。 | 字符串 | 该标签可缺省,缺省值为空。 | | skills | 该标签标识ability能够接收的意图的特征集,为数组格式。
配置规则 : entry包可以配置多个具有入口能力的skills标签(配置了action.system.home和entity.system.home)的ability,其中第一个配置了skills标签的ability中的label和icon作为OpenHarmony服务或应用的label和icon。
OpenHarmony服务的Feature包不能配置具有入口能力的skills标签。
OpenHarmony应用的Feature包可以配置具有入口能力的skills标签。
skills内部结构参考[skills对象内部结构](#skills对象内部结构)。 | 数组 | 该标签可缺省,缺省值为空。 | diff --git a/zh-cn/application-dev/quick-start/package-structure.md b/zh-cn/application-dev/quick-start/package-structure.md index 738f0a1c76f91ae32634a1adf8f42737985dc915..6aad24ced20ebad13d35fd06e611ea5c710a7150 100644 --- a/zh-cn/application-dev/quick-start/package-structure.md +++ b/zh-cn/application-dev/quick-start/package-structure.md @@ -373,6 +373,8 @@ metaData示例: | srcLanguage | Ability开发语言的类型。 | 字符串 | 取值为java、js或ets | | srcPath | 该标签表示Ability对应的JS组件代码路径 | 字符串 | 可缺省,缺省值为空。 | | uriPermission | 表示该Ability有权访问的应用程序数据。此属性由模式和路径子属性组成。此属性仅对类型提供者的能力有效。运行OHOS的设备不支持此属性。参考表18。 | 对象 | 可缺省,缺省值为空。 | +| startWindowIcon | 表示该Ability启动页面图标资源文件的索引。取值示例:$media:icon。 | 字符串 | 可缺省,缺省值为空。 | +| startWindowBackground | 表示该Ability启动页面背景颜色资源文件的索引。取值示例:$color:red。 | 字符串 | 可缺省,缺省值为空。 | 表18 uriPermission对象的内部结构说明 @@ -411,7 +413,9 @@ abilities示例: "fontSize", "orientation" ], - "type": "page" + "type": "page", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:red" }, { "name": ".PlayService", diff --git a/zh-cn/application-dev/quick-start/start-overview.md b/zh-cn/application-dev/quick-start/start-overview.md index 3c1202d792ab1ba30d4bf932c21b70a4508e5b8d..0b23348ed04aa7fa496e332aeabf70127e8e44f9 100644 --- a/zh-cn/application-dev/quick-start/start-overview.md +++ b/zh-cn/application-dev/quick-start/start-overview.md @@ -14,7 +14,7 @@ ### UI框架 -OpenHarmony提供了一套UI开发框架,即方舟开发框架(ArkUI框架)。方舟开发框架可为开发者提供应用UI开发所必须的能力,比如多种组件、布局计算、动画能力、UI交互、绘制等等。 +OpenHarmony提供了一套UI开发框架,即方舟开发框架(ArkUI框架)。方舟开发框架可为开发者提供应用UI开发所必需的能力,比如多种组件、布局计算、动画能力、UI交互、绘制等等。 方舟开发框架针对不同目的和技术背景的开发者提供了两种开发范式,分别是基于JS扩展的类Web开发范式(简称“类Web开发范式”)和基于TS扩展的声明式开发范式(简称“声明式开发范式”)。以下是两种开发范式的简单对比。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md index 49bbbc8d22da80f1b715d58cf6cd81cb9faedaa6..8506ae6618a34e6d556dc8a1def7c178f41bcbd0 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md @@ -568,6 +568,85 @@ bundle.getAbilityInfo(bundleName, abilityName, (err, data) => { console.info('Operation successful. Data:' + JSON.stringify(data)); }) ``` +## bundle.getAbilityInfo9+ + +getAbilityInfo(bundleName: string, moduleName: string, abilityName: string): Promise\ + +通过包名称、moduleName和abilityName获取Ability信息,使用Promise形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED,ohos.permission.GET_BUNDLE_INFO + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ----------- | ------ | ---- | ---------------- | +| bundleName | string | 是 | 应用程序包名。 | +| moduleName | string | 是 | Module名称。 | +| abilityName | string | 是 | Ability名称。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------- | --------------------- | +| Promise\ | Promise形式返回Ability信息。 | + +**示例:** + +```js +let bundleName = "com.example.myapplication"; +let moduleName = "entry"; +let abilityName = "com.example.myapplication.MainAbility"; +bundle.getAbilityInfo(bundleName, moduleName, abilityName) +.then((data) => { + console.info('Operation successful. Data: ' + JSON.stringify(data)); +}).catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); +}) +``` + +## bundle.getAbilityInfo9+ + +getAbilityInfo(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback\): void; + +通过包名称、moduleName和abilityName获取Ability信息,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED,ohos.permission.GET_BUNDLE_INFO + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ----------- | ------------ | ---- | ---------------- | +| bundleName | string | 是 | 应用程序包名。 | +| moduleName | string | 是 | Module名称。 | +| abilityName | string | 是 | Ability名称。 | +| callback | AsyncCallback\ | 是 | 程序启动作为入参的回调函数,返回Ability信息。 | + +**示例:** + +```js +let bundleName = "com.example.myapplication"; +let moduleName = "entry"; +let abilityName = "com.example.myapplication.MainAbility"; +bundle.getAbilityInfo(bundleName, moduleName, abilityName, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful. Data:' + JSON.stringify(data)); +}) +``` ## bundle.getAbilityLabel8+ @@ -644,6 +723,85 @@ bundle.getAbilityLabel(bundleName, abilityName, (err, data) => { console.info('Operation successful. Data:' + JSON.stringify(data)); }) ``` +## bundle.getAbilityLabel9+ + +getAbilityLabel(bundleName: string, moduleName: string, abilityName: string): Promise\ + +通过包名称、moduleName和abilityName获取应用名称,使用Promise形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED,ohos.permission.GET_BUNDLE_INFO + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ----------- | ------ | ---- | ---------------- | +| bundleName | string | 是 | 应用程序包名。 | +| moduleName | string | 是 | Module名称。 | +| abilityName | string | 是 | Ability名称。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------ | +| Promise\ | Promise形式返回应用名称信息。 | + +**示例:** + +```js +let bundleName = "com.example.myapplication"; +let moduleName = "entry"; +let abilityName = "com.example.myapplication.MainAbility"; +bundle.getAbilityLabel(bundleName, moduleName, abilityName) +.then((data) => { + console.info('Operation successful. Data: ' + JSON.stringify(data)); +}).catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); +}) +``` + +## bundle.getAbilityLabel9+ + +getAbilityLabel(bundleName: string, moduleName: string, abilityName: string, callback : AsyncCallback\): void + +通过包名称、moduleName和abilityName获取应用名称,使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED,ohos.permission.GET_BUNDLE_INFO + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ----------- | ---------------------- | ---- | ---------------- | +| bundleName | string | 是 | 应用程序包名。 | +| moduleName | string | 是 | Module名称。 | +| abilityName | string | 是 | Ability名称。 | +| callback | AsyncCallback\ | 是 | 程序启动作为入参的回调函数,返回应用名称信息。 | + +**示例:** + +```js +let bundleName = "com.example.myapplication"; +let moduleName = "entry"; +let abilityName = "com.example.myapplication.MainAbility"; +bundle.getAbilityLabel(bundleName, moduleName, abilityName, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful. Data:' + JSON.stringify(data)); +}) +``` ## bundle.isAbilityEnabled8+ @@ -1081,8 +1239,8 @@ SystemCapability.BundleManager.BundleFramework **示例:** ```js -let bundleName = com.example.myapplication; -let abilityName = com.example.myapplication.MainAbility; +let bundleName = "com.example.myapplication"; +let abilityName = "com.example.myapplication.MainAbility"; bundle.getAbilityIcon(bundleName, abilityName) .then((data) => { console.info('Operation successful. Data: ' + JSON.stringify(data)); @@ -1116,8 +1274,8 @@ SystemCapability.BundleManager.BundleFramework **示例:** ```js -let bundleName = com.example.myapplication; -let abilityName = com.example.myapplication.MainAbility; +let bundleName = "com.example.myapplication"; +let abilityName = "com.example.myapplication.MainAbility"; bundle.getAbilityIcon(bundleName, abilityName, (err, data) => { if (err) { console.error('Operation failed. Cause: ' + JSON.stringify(err)); @@ -1127,6 +1285,84 @@ bundle.getAbilityIcon(bundleName, abilityName, (err, data) => { }) ``` +## bundle.getAbilityIcon9+ + +getAbilityIcon(bundleName: string, moduleName: string, abilityName: string): Promise\; + +以异步方法通过bundleName、moduleName和abilityName获取对应Icon的[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md),使用Promise形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ----------- | ---------------------------------------- | ---- | ---------------------------------------- | +| bundleName | string | 是 | 要查询的bundleName。 | +| moduleName | string | 是 | moduleName。 | +| abilityName | string | 是 | 要查询的abilityName。 | + +**返回值:** +| 类型 | 说明 | +| --------------------- | ------------------------------------------------------------ | +| Promise\ | 返回值为[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md)。 | + +**示例:** + +```js +let bundleName = "com.example.myapplication"; +let moduleName = "entry"; +let abilityName = "com.example.myapplication.MainAbility"; +bundle.getAbilityIcon(bundleName, moduleName, abilityName) +.then((data) => { + console.info('Operation successful. Data: ' + JSON.stringify(data)); +}).catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); +}) +``` + +## bundle.getAbilityIcon9+ + +getAbilityIcon(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback\): void; + +以异步方法通过bundleName、moduleName和abilityName获取对应Icon的[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md),使用callback形式返回结果。 + +**需要权限:** + +ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ----------- | ---------------------------------------- | ---- | ---------------------------------------- | +| bundleName | string | 是 | 要查询的bundleName。 | +| moduleName | string | 是 | moduleName。 | +| abilityName | string | 是 | 要查询的abilityName。 | +| callback | AsyncCallback\ | 是 | 程序启动作为入参的回调函数,返回指定[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md)。 | + +**示例:** + +```js +let bundleName = "com.example.myapplication"; +let moduleName = "entry"; +let abilityName = "com.example.myapplication.MainAbility"; +bundle.getAbilityIcon(bundleName, moduleName, abilityName, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful. Data:' + JSON.stringify(data)); +}) +``` ## bundle.queryExtensionAbilityInfosByWant9+ @@ -1451,6 +1687,7 @@ Hap模块信息 | --------- | --------- | ---- | ---- | ---------- | | name | string | 是 | 是 | 需要使用的权限名称 | | reason | string | 是 | 是 | 描述申请权限的原因 | +| reasonId9+ | number | 是 | 是 | 描述申请权限的原因ID | | usedScene | UsedScene | 是 | 是 | 权限使用的场景和时机 | ## UsedScene @@ -1568,7 +1805,8 @@ ExtensionAbility的类型 | FILE_SHARE9+ | 6 | ExtensionAbility的类型包括文件共享 | | STATIC_SUBSCRIBER9+ | 7 | ExtensionAbility的类型包括订阅者 | | WALLPAPER9+ | 8 | ExtensionAbility的类型包括墙纸 | -| UNSPECIFIED9+ | 9 | ExtensionAbility未指定类型 | +| BACKUP9+ | 9 | ExtensionAbility的类型包括数据备份恢复 | +| UNSPECIFIED9+ | 20 | ExtensionAbility未指定类型 | ## ExtensionFlag9+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-StartOptions.md b/zh-cn/application-dev/reference/apis/js-apis-application-StartOptions.md index 8fb0784a21090472913730f5f8f9d55eed813e2b..c54bed39b93093661cd1fed9b5feadab4af34121 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-StartOptions.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-StartOptions.md @@ -25,7 +25,7 @@ import StartOptions from '@ohos.application.StartOptions'; | 名称 | 可读 | 可写 | 参数类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -------- | -------- | -| windowMode | 是 | 否 | number | 否 | 窗口模式。 | +| [windowMode](js-apis-window.md#windowmode) | 是 | 否 | number | 否 | 窗口模式。 | | displayId | 是 | 否 | number | 否 | 显示ID。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegator.md b/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegator.md index 7c9a9435d78b5576636143c57cb836c90a10472a..1900632c2e0738d4b7e9fde059aea897c5d5f80d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegator.md @@ -423,7 +423,7 @@ startAbility(want: Want, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------- | ---- | ------------------ | -| want | [Want](js-apis-featureAbility.md#Want) | 是 | 启动Ability参数 | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability参数 | | callback | AsyncCallback\ | 是 | 表示指定的回调方法 | **示例:** @@ -455,7 +455,7 @@ startAbility(want: Want): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | -------------------------------------- | ---- | --------------- | -| want | [Want](js-apis-featureAbility.md#Want) | 是 | 启动Ability参数 | +| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability参数 | **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md b/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md old mode 100755 new mode 100644 index 0dee02f1250d67ccc0be39e220008359b7157e1c..94fa29479a6f8d4ab97edf9b93df19387eb438eb --- a/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md @@ -13,17 +13,6 @@ import bluetooth from '@ohos.bluetooth'; ``` -## 权限 - -ohos.permission.USE_BLUETOOTH - -ohos.permission.MANAGE_BLUETOOTH - -ohos.permission.DISCOVER_BLUETOOTH - -ohos.permission.LOCATION - - ## bluetooth.enableBluetooth8+ enableBluetooth(): boolean @@ -237,6 +226,8 @@ cancelPairedDevice(deviceId: string): boolean **系统能力**:SystemCapability.Communication.Bluetooth.Core。 +**系统API**:该接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -979,13 +970,13 @@ getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfi | 参数名 | 类型 | 必填 | 说明 | | --------- | --------- | ---- | ------------------------------------- | -| ProfileId | profileId | 是 | 表示profile的枚举值,例如:PROFILE_A2DP_SOURCE。 | +| profileId | [ProfileId](#ProfileId) | 是 | 表示profile的枚举值,例如:PROFILE_A2DP_SOURCE。 | **返回值:** -| 类型 | 说明 | -| ---------------------------------------- | ---------------------------------------- | -| A2dpSourceProfile 或者 HandsFreeAudioGatewayProfile | 对应的profile的对象实例,当前支持A2dpSourceProfile, HandsFreeAudioGatewayProfile。 | +| 类型 | 说明 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| [A2dpSourceProfile](#A2dpSourceProfile)或[HandsFreeAudioGatewayProfile](#HandsFreeAudioGatewayProfile) | 对应的profile的对象实例,当前支持A2dpSourceProfile, HandsFreeAudioGatewayProfile。 | **示例:** @@ -993,6 +984,32 @@ getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfi let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE); ``` +## bluetooth.getProfile9+ + +getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile + +通过ProfileId,获取profile的对象实例,API9新增了HidHostProfile。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | --------- | ---- | ------------------------------------- | +| profileId | [ProfileId](#ProfileId) | 是 | 表示profile的枚举值,例如:PROFILE_A2DP_SOURCE。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| [A2dpSourceProfile](#A2dpSourceProfile)或 [HandsFreeAudioGatewayProfile](#HandsFreeAudioGatewayProfile)或[HidHostProfile](#HidHostProfile) | 对应的profile的对象实例,当前支持A2dpSourceProfile/HandsFreeAudioGatewayProfile/HidHostProfile。 | + +**示例:** + +```js +let hidHost = bluetooth.getProfile(PROFILE_HID_HOST); +``` + ## bluetooth.BLE @@ -1215,11 +1232,16 @@ getConnectionDevices(): Array<string> **返回值:** -| | | -| ------------------- | ------------- | | 类型 | 说明 | +| ------------------- | ------------- | | Array<string> | 返回已连接设备的地址列表。 | +**示例:** + +```js +let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE) +let retArray = a2dpSrc.getConnectionDevices(); +``` ### getDeviceState8+ @@ -1236,15 +1258,19 @@ getDeviceState(device: string): ProfileConnectionState | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------- | | device | string | 是 | 远端设备地址。 | -| **返回值:** -| | | -| ------------------------------------------------- | ----------------------- | | 类型 | 说明 | +| ------------------------------------------------- | ----------------------- | | [ProfileConnectionState](#profileconnectionstate) | 返回profile的连接状态。 | +**示例:** + +```js +let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE) +let ret = a2dpSrc.getDeviceState('XX:XX:XX:XX:XX:XX'); +``` ## A2dpSourceProfile @@ -1266,13 +1292,11 @@ connect(device: string): boolean | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------- | | device | string | 是 | 远端设备地址。 | -| **返回值:** -| | | -| ------- | ------------------- | | 类型 | 说明 | +| ------- | ------------------- | | boolean | 成功返回true,失败返回false。 | **示例:** @@ -1298,13 +1322,11 @@ disconnect(device: string): boolean | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------- | | device | string | 是 | 远端设备地址。 | -| **返回值:** -| | | -| ------- | ------------------- | | 类型 | 说明 | +| ------- | ------------------- | | boolean | 成功返回true,失败返回false。 | **示例:** @@ -1315,7 +1337,7 @@ let ret = a2dpSrc.disconnect('XX:XX:XX:XX:XX:XX'); ``` -### A2dpSourceProfile.on('connectionStateChange')8+ +### on('connectionStateChange')8+ on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void @@ -1340,11 +1362,12 @@ on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#Stat function onReceiveEvent(data) { console.info('a2dp state = '+ JSON.stringify(data)); } -A2dpSourceProfile.on('connectionStateChange', onReceiveEvent); +let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE); +a2dpSrc.on('connectionStateChange', onReceiveEvent); ``` -### A2dpSourceProfile.off('connectionStateChange')8+ +### off('connectionStateChange')8+ off(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void @@ -1357,7 +1380,7 @@ off(type: "connectionStateChange", callback: Callback<[StateChangeParam](#Sta | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ---------------------------------------- | | type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | -| callback | Callback<[StateChangeParam](#StateChangeParam)> | 是 | 表示回调函数的入参。 | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | 否 | 表示回调函数的入参。 | **返回值:** @@ -1369,7 +1392,9 @@ off(type: "connectionStateChange", callback: Callback<[StateChangeParam](#Sta function onReceiveEvent(data) { console.info('a2dp state = '+ JSON.stringify(data)); } -A2dpSourceProfile.off('connectionStateChange', onReceiveEvent); +let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE); +a2dpSrc.on('connectionStateChange', onReceiveEvent); +a2dpSrc.off('connectionStateChange', onReceiveEvent); ``` @@ -1389,9 +1414,8 @@ getPlayingState(device: string): PlayingState **返回值:** -| | | -| ----------------------------- | ---------- | | 类型 | 说明 | +| ----------------------------- | ---------- | | [PlayingState](#PlayingState) | 远端设备的播放状态。 | **示例:** @@ -1422,13 +1446,11 @@ connect(device: string): boolean | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------- | | device | string | 是 | 远端设备地址。 | -| **返回值:** -| | | -| ------- | ------------------- | | 类型 | 说明 | +| ------- | ------------------- | | boolean | 成功返回true,失败返回false。 | **示例:** @@ -1454,7 +1476,6 @@ disconnect(device: string): boolean | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------- | | device | string | 是 | 远端设备地址。 | -| **返回值:** @@ -1470,7 +1491,7 @@ let ret = hfpAg.disconnect('XX:XX:XX:XX:XX:XX'); ``` -### HandsFreeAudioGatewayProfile.on('connectionStateChange')8+ +### on('connectionStateChange')8+ on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void @@ -1495,11 +1516,12 @@ on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#Stat function onReceiveEvent(data) { console.info('hfp state = '+ JSON.stringify(data)); } -HandsFreeAudioGatewayProfile.on('connectionStateChange', onReceiveEvent); +let hfpAg = bluetooth.getProfile(PROFILE_HANDS_FREE_AUDIO_GATEWAY); +hfpAg.on('connectionStateChange', onReceiveEvent); ``` -### HandsFreeAudioGatewayProfile.off('connectionStateChange')8+ +### off('connectionStateChange')8+ off(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void @@ -1512,7 +1534,7 @@ off(type: "connectionStateChange", callback: Callback<[StateChangeParam](#Sta | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ---------------------------------------- | | type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | -| callback | Callback<[StateChangeParam](#StateChangeParam)> | 是 | 表示回调函数的入参。 | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | 否 | 表示回调函数的入参。 | **返回值:** @@ -1524,7 +1546,139 @@ off(type: "connectionStateChange", callback: Callback<[StateChangeParam](#Sta function onReceiveEvent(data) { console.info('hfp state = '+ JSON.stringify(data)); } -HandsFreeAudioGatewayProfile.off('connectionStateChange', onReceiveEvent); +let hfpAg = bluetooth.getProfile(PROFILE_HANDS_FREE_AUDIO_GATEWAY); +hfpAg.on('connectionStateChange', onReceiveEvent); +hfpAg.off('connectionStateChange', onReceiveEvent); +``` + + +## HidHostProfile + +使用HidHostProfile方法之前需要创建该类的实例进行操作,通过getProfile()方法构造此实例。 + + +### connect9+ + +connect(device: string): boolean + +连接设备的HidHost服务。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------- | +| device | string | 是 | 远端设备地址。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------- | --------------------------------- | +| boolean | 成功返回true,失败返回false。 | + +**示例:** + +```js +let hidHostProfile = bluetooth.getProfile(PROFILE_HID_HOST); +let ret = hidHostProfile.connect('XX:XX:XX:XX:XX:XX'); +``` + + +### disconnect9+ + +disconnect(device: string): boolean + +断开连接设备的HidHost服务。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**系统API**:该接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------- | +| device | string | 是 | 远端设备地址。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------- | --------------------------------- | +| boolean | 成功返回true,失败返回false。 | + +**示例:** + +```js +let hidHostProfile = bluetooth.getProfile(PROFILE_HID_HOST); +let ret = hidHostProfile.disconnect('XX:XX:XX:XX:XX:XX'); +``` + + +### on('connectionStateChange')9+ + +on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void + +订阅HidHost连接状态变化事件。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | 是 | 表示回调函数的入参。 | + +**返回值:** + +无 + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('hidHost state = '+ JSON.stringify(data)); +} +let hidHost = bluetooth.getProfile(PROFILE_HID_HOST); +hidHost.on('connectionStateChange', onReceiveEvent); +``` + + +### off('connectionStateChange')9+ + +off(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void + +取消订阅HidHost连接状态变化事件。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- | +| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | 否 | 表示回调函数的入参。 | + +**返回值:** + +无 + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('hidHost state = '+ JSON.stringify(data)); +} +let hidHost = bluetooth.getProfile(PROFILE_HID_HOST); +hidHost.on('connectionStateChange', onReceiveEvent); +hidHost.off('connectionStateChange', onReceiveEvent); ``` @@ -3436,11 +3590,12 @@ let rssi = gattClient.getRssiValue().then((data) => { ## ProfileId8+ -枚举,蓝牙profile id。 +蓝牙profile枚举,API9新增PROFILE_HID_HOST。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 默认值 | 说明 | | -------------------------------- | ------ | --------------- | | PROFILE_A2DP_SOURCE | 0x0001 | 表示A2DP profile。 | -| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 0x0004 | 表示HFP profile。 | \ No newline at end of file +| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 0x0004 | 表示HFP profile。 | +| PROFILE_HID_HOST9+ | 0x0006 | 表示HID profile。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-ability.md b/zh-cn/application-dev/reference/apis/js-apis-data-ability.md index c4b2c0992f59d61dcf5b0bdd03660834e79fd0e1..419030fc432b2c7cd35820bdf982a3f43e0de9a9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-ability.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-ability.md @@ -6,8 +6,8 @@ ## 导入模块 -``` -import dataAbility from '@ohos.data.dataAbility' +```js +import dataAbility from '@ohos.data.dataAbility'; ``` @@ -24,8 +24,8 @@ createRdbPredicates(name: string, dataAbilityPredicates: DataAbilityPredicates): - 参数: | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | name | string | 是 | 数据库表中表名。 | - | dataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 是 | dataAbility谓词。 | + | name | string | 是 | 数据库表中的表名。 | + | dataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 是 | DataAbility谓词。 | - 返回值: | 类型 | 说明 | @@ -33,7 +33,7 @@ createRdbPredicates(name: string, dataAbilityPredicates: DataAbilityPredicates): | rdb.[RdbPredicates](js-apis-data-rdb.md#rdbpredicates) | 返回RdbPredicates对象。 | - 示例: - ``` + ```js let dataAbilityPredicates = new dataAbility.DataAbilityPredicates() dataAbilityPredicates.equalTo("NAME", "Rose").between("AGE", 16, 30) let predicates = dataAbility.createRdbPredicates("EMPLOYEE", dataAbilityPredicates) @@ -59,7 +59,7 @@ equalTo(field: string, value: ValueType): DataAbilityPredicates | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | field | string | 是 | 数据库表中的列名。 | - | value | [ValueType](js-apis-data-rdb.md#valuetype) | 是 | 指示要与谓词匹配的值。 | + | value | [ValueType](#valuetype) | 是 | 指示要与谓词匹配的值。 | - 返回值: | 类型 | 说明 | @@ -67,7 +67,7 @@ equalTo(field: string, value: ValueType): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.equalTo("NAME", "lisi") ``` @@ -87,7 +87,7 @@ notEqualTo(field: string, value: ValueType): DataAbilityPredicates | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | field | string | 是 | 数据库表中的列名。 | - | value | [ValueType](js-apis-data-rdb.md#valuetype) | 是 | 指示要与谓词匹配的值。 | + | value | [ValueType](#valuetype) | 是 | 指示要与谓词匹配的值。 | - 返回值: | 类型 | 说明 | @@ -95,7 +95,7 @@ notEqualTo(field: string, value: ValueType): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.notEqualTo("NAME", "lisi") ``` @@ -117,7 +117,7 @@ beginWrap(): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回带有左括号的DataAbility谓词。 | - 示例: - ``` + ```js let predicates = new dataAbilitylity.DataAbilityPredicates("EMPLOYEE") predicates.equalTo("NAME", "lisi") .beginWrap() @@ -144,7 +144,7 @@ endWrap(): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回带有右括号的DataAbility谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.equalTo("NAME", "lisi") .beginWrap() @@ -171,7 +171,7 @@ or(): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回带有或条件的DataAbility谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.equalTo("NAME", "Lisa") .or() @@ -185,7 +185,7 @@ or(): DataAbilityPredicates and(): DataAbilityPredicates -向谓词添加和条件。 +将和条件添加到谓词中。 **系统能力**:SystemCapability.DistributedDataManager.DataShare.Core。 @@ -195,7 +195,7 @@ and(): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回带有和条件的DataAbility谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.equalTo("NAME", "Lisa") .and() @@ -209,7 +209,7 @@ and(): DataAbilityPredicates contains(field: string, value: string): DataAbilityPredicates -配置谓词以匹配数据类型为String且value包含指定值的字段。 +配置谓词以匹配数据类型为string且value包含指定值的字段。 **系统能力**:SystemCapability.DistributedDataManager.DataShare.Core。 @@ -225,7 +225,7 @@ contains(field: string, value: string): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.contains("NAME", "os") ``` @@ -237,7 +237,7 @@ contains(field: string, value: string): DataAbilityPredicates beginsWith(field: string, value: string): DataAbilityPredicates -配置谓词以匹配数据类型为String且值以指定字符串开头的字段。 +配置谓词以匹配数据类型为string且值以指定字符串开头的字段。 **系统能力**:SystemCapability.DistributedDataManager.DataShare.Core。 @@ -253,7 +253,7 @@ beginsWith(field: string, value: string): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.beginsWith("NAME", "os") ``` @@ -265,7 +265,7 @@ beginsWith(field: string, value: string): DataAbilityPredicates endsWith(field: string, value: string): DataAbilityPredicates -配置谓词以匹配数据类型为String且值以指定字符串结尾的字段。 +配置谓词以匹配数据类型为string且值以指定字符串结尾的字段。 **系统能力**:SystemCapability.DistributedDataManager.DataShare.Core。 @@ -308,7 +308,7 @@ isNull(field: string): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.isNull("NAME") ``` @@ -335,7 +335,7 @@ isNotNull(field: string): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.isNotNull("NAME") ``` @@ -363,7 +363,7 @@ like(field: string, value: string): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.like("NAME", "%os%") ``` @@ -375,7 +375,7 @@ like(field: string, value: string): DataAbilityPredicates glob(field: string, value: string): DataAbilityPredicates -配置谓词匹配数据类型为string的指定字段。 +配置谓词以匹配数据类型为string的指定字段。 **系统能力**:SystemCapability.DistributedDataManager.DataShare.Core。 @@ -391,7 +391,7 @@ glob(field: string, value: string): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.glob("NAME", "?h*g") ``` @@ -403,7 +403,7 @@ glob(field: string, value: string): DataAbilityPredicates between(field: string, low: ValueType, high: ValueType): DataAbilityPredicates -将谓词配置为匹配数据类型为ValueType且value在指定范围内的指定字段。 +配置谓词以匹配数据类型为ValueType且value在指定范围内的指定字段。 **系统能力**:SystemCapability.DistributedDataManager.DataShare.Core。 @@ -411,8 +411,8 @@ between(field: string, low: ValueType, high: ValueType): DataAbilityPredicates | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | field | string | 是 | 数据库表中的列名。 | - | low | [ValueType](js-apis-data-rdb.md#valuetype) | 是 | 指示与谓词匹配的最小值。 | - | high | [ValueType](js-apis-data-rdb.md#valuetype) | 是 | 指示与谓词匹配的最大值。 | + | low | [ValueType](#valuetype) | 是 | 指示与谓词匹配的最小值。 | + | high | [ValueType](#valuetype) | 是 | 指示与谓词匹配的最大值。 | - 返回值: | 类型 | 说明 | @@ -420,7 +420,7 @@ between(field: string, low: ValueType, high: ValueType): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.between("AGE", 10, 50) ``` @@ -440,8 +440,8 @@ notBetween(field: string, low: ValueType, high: ValueType): DataAbilityPredicate | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | field | string | 是 | 数据库表中的列名。 | - | low | [ValueType](js-apis-data-rdb.md#valuetype) | 是 | 指示与谓词匹配的最小值。 | - | high | [ValueType](js-apis-data-rdb.md#valuetype) | 是 | 指示与谓词匹配的最大值。 | + | low | [ValueType](#valuetype) | 是 | 指示与谓词匹配的最小值。 | + | high | [ValueType](#valuetype) | 是 | 指示与谓词匹配的最大值。 | - 返回值: | 类型 | 说明 | @@ -449,7 +449,7 @@ notBetween(field: string, low: ValueType, high: ValueType): DataAbilityPredicate | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.notBetween("AGE", 10, 50) ``` @@ -469,7 +469,7 @@ greaterThan(field: string, value: ValueType): DataAbilityPredicates | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | field | string | 是 | 数据库表中的列名。 | - | value | [ValueType](js-apis-data-rdb.md#valuetype) | 是 | 指示要与谓词匹配的值。 | + | value | [ValueType](#valuetype) | 是 | 指示要与谓词匹配的值。 | - 返回值: | 类型 | 说明 | @@ -477,7 +477,7 @@ greaterThan(field: string, value: ValueType): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.greaterThan("AGE", 18) ``` @@ -497,7 +497,7 @@ lessThan(field: string, value: ValueType): DataAbilityPredicates | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | field | string | 是 | 数据库表中的列名。 | - | value | [ValueType](js-apis-data-rdb.md#valuetype) | 是 | 指示要与谓词匹配的值。 | + | value | [ValueType](#valuetype) | 是 | 指示要与谓词匹配的值。 | - 返回值: | 类型 | 说明 | @@ -505,7 +505,7 @@ lessThan(field: string, value: ValueType): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.lessThan("AGE", 20) ``` @@ -525,7 +525,7 @@ greaterThanOrEqualTo(field: string, value: ValueType): DataAbilityPredicates | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | field | string | 是 | 数据库表中的列名。 | - | value | [ValueType](js-apis-data-rdb.md#valuetype) | 是 | 指示要与谓词匹配的值。 | + | value | [ValueType](#valuetype) | 是 | 指示要与谓词匹配的值。 | - 返回值: | 类型 | 说明 | @@ -533,7 +533,7 @@ greaterThanOrEqualTo(field: string, value: ValueType): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.greaterThanOrEqualTo("AGE", 18) ``` @@ -553,7 +553,7 @@ lessThanOrEqualTo(field: string, value: ValueType): DataAbilityPredicates | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | field | string | 是 | 数据库表中的列名。 | - | value | [ValueType](js-apis-data-rdb.md#valuetype) | 是 | 指示要与谓词匹配的值。 | + | value | [ValueType](#valuetype) | 是 | 指示要与谓词匹配的值。 | - 返回值: | 类型 | 说明 | @@ -561,7 +561,7 @@ lessThanOrEqualTo(field: string, value: ValueType): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.lessThanOrEqualTo("AGE", 20) ``` @@ -588,7 +588,7 @@ orderByAsc(field: string): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.orderByAsc("NAME") ``` @@ -615,7 +615,7 @@ orderByDesc(field: string): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.orderByDesc("AGE") ``` @@ -637,7 +637,7 @@ distinct(): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回可用于过滤重复记录的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.equalTo("NAME", "Rose").distinct("NAME") let promiseDistinct = rdbStore.query(predicates, ["NAME"]) @@ -670,7 +670,7 @@ limitAs(value: number): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回可用于设置最大数据记录数的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.equalTo("NAME", "Rose").limitAs(3) ``` @@ -697,7 +697,7 @@ offsetAs(rowOffset: number): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回具有指定返回结果起始位置的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.equalTo("NAME", "Rose").offsetAs(3) ``` @@ -724,7 +724,7 @@ groupBy(fields: Array<string>): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回分组查询列的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.groupBy(["AGE", "NAME"]) ``` @@ -749,7 +749,7 @@ indexedBy(field: string): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回具有指定索引列的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.indexedBy("SALARY_INDEX") ``` @@ -769,7 +769,7 @@ in(field: string, value: Array<ValueType>): DataAbilityPredicates | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | field | string | 是 | 数据库表中的列名。 | - | value | Array<[ValueType](js-apis-data-rdb.md#valuetype)> | 是 | 以ValueType型数组形式指定的要匹配的值。 | + | value | Array<[ValueType](#valuetype)> | 是 | 以ValueType类型数组形式指定的要匹配的值。 | - 返回值: @@ -778,7 +778,7 @@ in(field: string, value: Array<ValueType>): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.in("AGE", [18, 20]) ``` @@ -798,7 +798,7 @@ notIn(field: string, value: Array<ValueType>): DataAbilityPredicates | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | field | string | 是 | 数据库表中的列名。 | - | value | Array<[ValueType](js-apis-data-rdb.md#valuetype)> | 是 | 以ValueType型数组形式指定的要匹配的值。 | + | value | Array<[ValueType](#valuetype)> | 是 | 以ValueType类型数组形式指定的要匹配的值。 | - 返回值: @@ -807,8 +807,19 @@ notIn(field: string, value: Array<ValueType>): DataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | 返回与指定字段匹配的谓词。 | - 示例: - ``` + ```js let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") predicates.notIn("NAME", ["Lisa", "Rose"]) ``` +## ValueType + +用于表示允许的数据字段类型。 + +**系统能力**:SystemCapability.DistributedDataManager.DataShare.Core。 + +| 名称 | 说明 | +| ------- | -------------------- | +| number | 表示值类型为数字。 | +| string | 表示值类型为字符。 | +| boolean | 表示值类型为布尔值。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md b/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md index d58bd4d28df434a77775d14bf5acaccc82a442e8..2c3325a26d8bdd2b903086d616242e11467fd28d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-distributedobject.md @@ -7,7 +7,7 @@ ## 导入模块 ```js -import distributedObject from '@ohos.data.distributedDataObject' +import distributedObject from '@ohos.data.distributedDataObject'; ``` @@ -25,11 +25,11 @@ createDistributedObject(source: object): DistributedObject | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | source | object | 是 | 设置distributedObject的属性。 | - + **返回值:** - | 类型 | 说明 | - | -------- | -------- | - | [DistributedObject](#distributedobject) | 创建好的分布式对象。 | +| 类型 | 说明 | +| -------- | -------- | +| [DistributedObject](#distributedobject) | 创建完成的分布式对象。 | **示例:** ```js @@ -83,7 +83,7 @@ setSessionId(sessionId?: string): boolean | 类型 | 说明 | | -------- | -------- | | boolean | true:标识设置sessionId成功;
false:标识设置sessionId失败。 | - + **示例:** ```js @@ -171,8 +171,6 @@ on(type: 'status', callback: Callback<{ sessionId: string, networkId: string, st | type | string | 是 | 事件类型,固定为'status',表示对象上下线。 | | callback | Callback<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }> | 是 | 监听上下线回调实例。
sessionId:标识变更对象的sessionId;
networkId:标识对象设备的networkId;
status:标识对象为'online'(上线)或'offline'(下线)的状态。 | - - **示例:** ```js import distributedObject from '@ohos.data.distributedDataObject' 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 187d51942adaa53d3b82d7818281b5f493157f27..ca1de5dcf99358aba8b28f1a206a563e7bda823b 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 @@ -10,18 +10,17 @@ ## 导入模块 ```ts -import data_preferences from '@ohos.data.preferences' +import data_preferences from '@ohos.data.preferences'; ``` -## 属性 +## 常量 **系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.Preferences.Core | 名称 | 参数类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- | -------- | | MAX_KEY_LENGTH | string | 是 | 否 | key的最大长度限制,大小为80字节。 | -| MAX_VALUE_LENGTH | string | 是 | 否 | string类型value的最大长度限制,大小为8192字节。 | -| ValueType | number丨string丨boolean | 是 | 否 | 默认返回值,支持number、string、boolean。 | +| MAX_VALUE_LENGTH | string | 是 | 否 | value的最大长度限制,大小为8192字节。 | ## data_preferences.getPreferences @@ -45,7 +44,7 @@ getPreferences(context: Context, name: string, callback: AsyncCallback<Prefer import Ability from '@ohos.application.Ability' import data_preferences from '@ohos.data.preferences' export default class MainAbility extends Ability { - + data_preferences.getPreferences(this.context, 'mystore', function (err, preferences) { if (err) { console.info("Get the preferences failed") @@ -94,7 +93,7 @@ getPreferences(context: Context, name: string): Promise<Preferences> import Ability from '@ohos.application.Ability' import data_preferences from '@ohos.data.preferences' export default class MainAbility extends Ability { - + let promise = data_preferences.getPreferences(this.context, 'mystore') promise.then((preferences) => { preferences.put('startup', 'auto', function (err) { @@ -139,7 +138,7 @@ deletePreferences(context: Context, name: string, callback: AsyncCallback<voi import Ability from '@ohos.application.Ability' import data_preferences from '@ohos.data.preferences' export default class MainAbility extends Ability { - + data_preferences.deletePreferences(this.context, 'mystore', function (err) { if (err) { console.info("Deleted failed, err: " + err) @@ -176,7 +175,7 @@ deletePreferences(context: Context, name: string): Promise<void> import Ability from '@ohos.application.Ability' import data_preferences from '@ohos.data.preferences' export default class MainAbility extends Ability { - + let promise = data_preferences.deletePreferences(this.context, 'mystore') promise.then(() => { console.info("Deleted successfully.") @@ -191,7 +190,9 @@ deletePreferences(context: Context, name: string): Promise<void> removePreferencesFromCache(context: Context, name: string, callback: AsyncCallback<void>): void -从内存中移除指定首选项持久化文件对应的Preferences单实例。移除Preferences单实例时,应用不允许再使用该实例进行数据操作,否则会出现数据一致性问题,该方法使用callback方式作为异步方法。 +从内存中移除指定首选项持久化文件对应的Preferences单实例。 + +移除Preferences单实例时,应用不允许再使用该实例进行数据操作,否则会出现数据一致性问题,该方法使用callback方式作为异步方法。 **系统能力**:SystemCapability.DistributedDataManager.Preferences.Core @@ -207,7 +208,7 @@ removePreferencesFromCache(context: Context, name: string, callback: AsyncCallba import Ability from '@ohos.application.Ability' import data_preferences from '@ohos.data.preferences' export default class MainAbility extends Ability { - + data_preferences.removePreferencesFromCache(this.context, 'mystore', function (err) { if (err) { console.info("Removed preferences from cache failed, err: " + err) @@ -223,7 +224,9 @@ removePreferencesFromCache(context: Context, name: string, callback: AsyncCallba removePreferencesFromCache(context: Context, name: string): Promise<void> -从内存中移除指定首选项持久化文件对应的Preferences单实例。移除Preferences单实例时,应用不允许再使用该实例进行数据操作,否则会出现数据一致性问题,该方法使用Promise方式作为异步方法。 +从内存中移除指定首选项持久化文件对应的Preferences单实例。 + +移除Preferences单实例时,应用不允许再使用该实例进行数据操作,否则会出现数据一致性问题,该方法使用Promise方式作为异步方法。 **系统能力**:SystemCapability.DistributedDataManager.Preferences.Core @@ -243,7 +246,7 @@ removePreferencesFromCache(context: Context, name: string): Promise<void> import Ability from '@ohos.application.Ability' import data_preferences from '@ohos.data.preferences' export default class MainAbility extends Ability { - + let promise = data_preferences.removePreferencesFromCache(this.context, 'mystore') promise.then(() => { console.info("Removed preferences from cache successfully.") @@ -271,7 +274,7 @@ get(key: string, defValue: ValueType, callback: AsyncCallback<ValueType>): | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | key | string | 是 | 要获取的存储key名称,不能为空。 | - | defValue | [ValueType](#属性) | 是 | 默认返回值。支持number、string、boolean。 | + | defValue | [ValueType](#valuetype) | 是 | 默认返回值。支持number、string、boolean。 | | callback | AsyncCallback<ValueType> | 是 | 回调函数。 | - 示例: @@ -309,7 +312,7 @@ get(key: string, defValue: ValueType): Promise<ValueType> | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | key | string | 是 | 要获取的存储key名称,不能为空。 | - | defValue | [ValueType](#属性) | 是 | 默认返回值。支持number、string、boolean。 | + | defValue | [ValueType](#valuetype) | 是 | 默认返回值。支持number、string、boolean。 | - 返回值: | 类型 | 说明 | @@ -349,7 +352,7 @@ put(key: string, value: ValueType, callback: AsyncCallback<void>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | key | string | 是 | 要修改的存储的key,不能为空。 | - | value | [ValueType](#属性) | 是 | 存储的新值。支持number、string、boolean。 | + | value | [ValueType](#valuetype) | 是 | 存储的新值。支持number、string、boolean。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | - 示例: @@ -387,7 +390,7 @@ put(key: string, value: ValueType): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | key | string | 是 | 要修改的存储的key,不能为空。 | - | value | [ValueType](#属性) | 是 | 存储的新值。支持number、string、boolean。 | + | value | [ValueType](#valuetype) | 是 | 存储的新值。支持number、string、boolean。 | - 返回值: | 类型 | 说明 | @@ -484,7 +487,7 @@ has(key: string): Promise<boolean> import Ability from '@ohos.application.Ability' import data_preferences from '@ohos.data.preferences' export default class MainAbility extends Ability { - + let promise = data_preferences.getPreferences(this.context, 'mystore') promise.then((preferences) => { let promiseHas = preferences.has('startup') @@ -814,3 +817,15 @@ off(type: 'change', callback: Callback<{ key : string }>): void }) } ``` + +## ValueType + +用于表示允许的数据字段类型。 + +**系统能力**:SystemCapability.DistributedDataManager.Preferences.Core + +| 名称 | 说明 | +| ------- | -------------------- | +| number | 表示值类型为数字。 | +| string | 表示值类型为字符。 | +| boolean | 表示值类型为布尔值。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md b/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md index 7cc705e0c15b771d3ac84b1ada795c843335f704..a7a80185e977caa68ab1c7549e8e5ebe3237416e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md @@ -7,8 +7,8 @@ ## 导入模块 -``` -import data_rdb from '@ohos.data.rdb' +```js +import data_rdb from '@ohos.data.rdb'; ``` @@ -21,16 +21,17 @@ getRdbStore(context: Context, config: StoreConfig, version: number, callback: As **系统能力**:SystemCapability.DistributedDataManager.RelationalStore.Core。 **参数**: + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | context8+ | Context | 是 | 应用程序或功能的上下文 | | config | [StoreConfig](#storeconfig) | 是 | 与此RDB存储相关的数据库配置。 | | version | number | 是 | 数据库版本。 | -| callback | AsyncCallback<[RdbStore](#rdbstore)> | 是 | 指定callback回调函数。返回一个RdbStore。 | +| callback | AsyncCallback<[RdbStore](#rdbstore)> | 是 | 指定callback回调函数,返回一个RdbStore。 | **示例**: -``` +```js import data_rdb from '@ohos.data.rdb' const STORE_CONFIG = { name: "RdbTest.db"} const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)" @@ -40,9 +41,9 @@ data_rdb.getRdbStore(STORE_CONFIG, 1, function (err, rdbStore) { }) ``` -API9的示例请参考如下代码: +API 9的示例请参考如下代码: -``` +```ts import Ability from '@ohos.application.Ability' import data_rdb from '@ohos.data.rdb' export default class MainAbility extends Ability { @@ -79,7 +80,7 @@ getRdbStore(context: Context, config: StoreConfig, version: number): Promise< **示例**: -``` +```js import data_rdb from '@ohos.data.rdb' const STORE_CONFIG = { name: "RdbTest.db" } const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)" @@ -96,9 +97,9 @@ promisegetRdb.then(async (rdbStore) => { }) ``` -API9的示例请参考如下代码: +API 9的示例请参考如下代码: -``` +```ts import Ability from '@ohos.application.Ability' import data_rdb from '@ohos.data.rdb' export default class MainAbility extends Ability { @@ -134,16 +135,16 @@ deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void&g | callback | AsyncCallback<void> | 是 | 指定callback回调函数。 | **示例**: - ``` + ```js import data_rdb from '@ohos.data.rdb' data_rdb.deleteRdbStore("RdbTest.db", function (err, rdbStore) { console.info('delete store done.') }) ``` -API9的示例请参考如下代码: +API 9的示例请参考如下代码: -``` +```ts import Ability from '@ohos.application.Ability' import data_rdb from '@ohos.data.rdb' export default class MainAbility extends Ability { @@ -173,7 +174,7 @@ deleteRdbStore(context: Context, name: string): Promise<void> | Promise<void> | 指定Promise回调函数。 | **示例**: - ``` + ```js import data_rdb from '@ohos.data.rdb' let promisedeleteRdb = data_rdb.deleteRdbStore("RdbTest.db") promisedeleteRdb.then(()=>{ @@ -183,9 +184,9 @@ deleteRdbStore(context: Context, name: string): Promise<void> }) ``` -API9的示例请参考如下代码: +API 9的示例请参考如下代码: -``` +```ts import Ability from '@ohos.application.Ability' import data_rdb from '@ohos.data.rdb' export default class MainAbility extends Ability { @@ -218,7 +219,7 @@ constructor(name: string) | name | string | 是 | 数据库表名。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") ``` @@ -242,7 +243,7 @@ inDevices(devices: Array<string>): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicate.inDevices(['12345678abcde']) ``` @@ -262,7 +263,7 @@ inAllDevices(): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.inAllDevices() ``` @@ -288,7 +289,7 @@ equalTo(field: string, value: ValueType): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "lisi") ``` @@ -315,7 +316,7 @@ notEqualTo(field: string, value: ValueType): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.notEqualTo("NAME", "lisi") ``` @@ -336,7 +337,7 @@ beginWrap(): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回带有左括号的Rdb谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "lisi") .beginWrap() @@ -362,7 +363,7 @@ endWrap(): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回带有右括号的Rdb谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "lisi") .beginWrap() @@ -388,7 +389,7 @@ or(): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回带有或条件的Rdb谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "Lisa") .or() @@ -411,7 +412,7 @@ and(): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回带有和条件的Rdb谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "Lisa") .and() @@ -423,7 +424,7 @@ and(): RdbPredicates contains(field: string, value: string): RdbPredicates -配置谓词以匹配数据字段为String且value包含指定值的字段。 +配置谓词以匹配数据字段为string且value包含指定值的字段。 **系统能力**:SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -439,7 +440,7 @@ contains(field: string, value: string): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.contains("NAME", "os") ``` @@ -450,7 +451,7 @@ contains(field: string, value: string): RdbPredicates beginsWith(field: string, value: string): RdbPredicates -配置谓词以匹配数据字段为String且值以指定字符串开头的字段。 +配置谓词以匹配数据字段为string且值以指定字符串开头的字段。 **系统能力**:SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -466,7 +467,7 @@ beginsWith(field: string, value: string): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.beginsWith("NAME", "os") ``` @@ -477,7 +478,7 @@ beginsWith(field: string, value: string): RdbPredicates endsWith(field: string, value: string): RdbPredicates -配置谓词以匹配数据字段为String且值以指定字符串结尾的字段。 +配置谓词以匹配数据字段为string且值以指定字符串结尾的字段。 **系统能力**:SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -493,7 +494,7 @@ endsWith(field: string, value: string): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.endsWith("NAME", "se") ``` @@ -519,7 +520,7 @@ isNull(field: string): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | - 示例 - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.isNull("NAME") ``` @@ -545,7 +546,7 @@ isNotNull(field: string): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.isNotNull("NAME") ``` @@ -556,7 +557,7 @@ isNotNull(field: string): RdbPredicates like(field: string, value: string): RdbPredicates -配置谓词以匹配数据字段为String且值类似于指定字符串的字段。 +配置谓词以匹配数据字段为string且值类似于指定字符串的字段。 **系统能力**:SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -572,7 +573,7 @@ like(field: string, value: string): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.like("NAME", "%os%") ``` @@ -583,7 +584,7 @@ like(field: string, value: string): RdbPredicates glob(field: string, value: string): RdbPredicates -配置RdbPredicates匹配数据字段为String的指定字段。 +配置RdbPredicates匹配数据字段为string的指定字段。 **系统能力**:SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -599,7 +600,7 @@ glob(field: string, value: string): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.glob("NAME", "?h*g") ``` @@ -627,7 +628,7 @@ between(field: string, low: ValueType, high: ValueType): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.between("AGE", 10, 50) ``` @@ -655,7 +656,7 @@ notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.notBetween("AGE", 10, 50) ``` @@ -681,7 +682,7 @@ greaterThan(field: string, value: ValueType): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.greaterThan("AGE", 18) ``` @@ -708,7 +709,7 @@ lessThan(field: string, value: ValueType): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.lessThan("AGE", 20) ``` @@ -736,7 +737,7 @@ greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.greaterThanOrEqualTo("AGE", 18) ``` @@ -764,7 +765,7 @@ lessThanOrEqualTo(field: string, value: ValueType): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.lessThanOrEqualTo("AGE", 20) ``` @@ -791,7 +792,7 @@ orderByAsc(field: string): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.orderByAsc("NAME") ``` @@ -818,7 +819,7 @@ orderByDesc(field: string): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.orderByDesc("AGE") ``` @@ -839,7 +840,7 @@ distinct(): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回可用于过滤重复记录的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "Rose").distinct("NAME") let promisequery = rdbStore.query(predicates, ["NAME"]) @@ -872,7 +873,7 @@ limitAs(value: number): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回可用于设置最大数据记录数的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "Rose").limitAs(3) ``` @@ -898,7 +899,7 @@ offsetAs(rowOffset: number): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回具有指定返回结果起始位置的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "Rose").offsetAs(3) ``` @@ -924,7 +925,7 @@ groupBy(fields: Array<string>): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回分组查询列的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.groupBy(["AGE", "NAME"]) ``` @@ -950,7 +951,7 @@ indexedBy(field: string): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回具有指定索引列的RdbPredicates。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.indexedBy("SALARY_INDEX") ``` @@ -978,7 +979,7 @@ in(field: string, value: Array<ValueType>): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.in("AGE", [18, 20]) ``` @@ -1006,7 +1007,7 @@ notIn(field: string, value: Array<ValueType>): RdbPredicates | [RdbPredicates](#rdbpredicates) | 返回与指定字段匹配的谓词。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.notIn("NAME", ["Lisa", "Rose"]) ``` @@ -1033,7 +1034,7 @@ insert(name: string, values: ValuesBucket, callback: AsyncCallback<number> | callback | AsyncCallback<number> | 是 | 指定callback回调函数。如果操作成功,返回行ID;否则返回-1。 | **示例**: - ``` + ```js const valueBucket = { "NAME": "Lisa", "AGE": 18, @@ -1066,7 +1067,7 @@ insert(name: string, values: ValuesBucket):Promise<number> | Promise<number> | 指定Promise回调函数。如果操作成功,返回行ID;否则返回-1。 | **示例**: - ``` + ```js const valueBucket = { "NAME": "Lisa", "AGE": 18, @@ -1098,7 +1099,7 @@ update(values: ValuesBucket, rdbPredicates: RdbPredicates, callback: AsyncCallba | callback | AsyncCallback<number> | 是 | 指定的callback回调方法。返回受影响的行数。 | **示例**: - ``` + ```js const valueBucket = { "NAME": "Rose", "AGE": 22, @@ -1132,7 +1133,7 @@ update(values: ValuesBucket, rdbPredicates: RdbPredicates):Promise<number> | Promise<number> | 指定的Promise回调方法。返回受影响的行数。 | **示例**: - ``` + ```js const valueBucket = { "NAME": "Rose", "AGE": 22, @@ -1166,7 +1167,7 @@ delete(rdbPredicates: RdbPredicates, callback: AsyncCallback<number>):void | callback | AsyncCallback<number> | 是 | 指定callback回调函数。返回受影响的行数。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "Lisa") rdbStore.delete(predicates, function (err, rows) { @@ -1194,7 +1195,7 @@ delete(rdbPredicates: RdbPredicates):Promise<number> | Promise<number> | 指定Promise回调函数。返回受影响的行数。 | **示例**: - ``` + ```js let predicatesdelete = new data_rdb.RdbPredicates("EMPLOYEE") predicatesdelete.equalTo("NAME", "Lisa") let promisedelete = rdbStore.delete(predicates) @@ -1222,7 +1223,7 @@ query(rdbPredicates: RdbPredicates, columns: Array<string>, callback: Asyn | callback | AsyncCallback<[ResultSet](js-apis-data-resultset.md)> | 是 | 指定callback回调函数。如果操作成功,则返回ResultSet对象。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "Rose") rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function (err, resultSet) { @@ -1252,7 +1253,7 @@ query(rdbPredicates: RdbPredicates, columns?: Array<string>):Promise<Re | Promise<[ResultSet](../apis/js-apis-data-resultset.md)> | 指定Promise回调函数。如果操作成功,则返回ResultSet对象。 | **示例**: - ``` + ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "Rose") let promisequery = rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]) @@ -1281,7 +1282,7 @@ querySql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallback& | callback | AsyncCallback<[ResultSet](js-apis-data-resultset.md)> | 是 | 指定callback回调函数。如果操作成功,则返回ResultSet对象。 | **示例**: - ``` + ```js rdbStore.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['sanguo'], function (err, resultSet) { console.log("resultSet column names:" + resultSet.columnNames) console.log("resultSet column count:" + resultSet.columnCount) @@ -1309,7 +1310,7 @@ querySql(sql: string, bindArgs?: Array<ValueType>):Promise<ResultSet> | Promise<[ResultSet](../apis/js-apis-data-resultset.md)> | 指定Promise回调函数。如果操作成功,则返回ResultSet对象。 | **示例**: - ``` + ```js let promisequerySql = rdbStore.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['sanguo']) promisequerySql.then((resultSet) => { console.log("resultSet column names:" + resultSet.columnNames) @@ -1336,7 +1337,7 @@ executeSql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallbac | callback | AsyncCallback<void> | 是 | 指定callback回调函数。 | **示例**: - ``` + ```js rdbStore.executeSql("DELETE FROM EMPLOYEE", null, function () { console.info('delete done.') }) @@ -1363,7 +1364,7 @@ executeSql(sql: string, bindArgs?: Array<ValueType>):Promise<void> | Promise<void> | 指定Promise回调函数。 | **示例**: - ``` + ```js let promiseexecuteSql = rdbStore.executeSql("DELETE FROM EMPLOYEE") promiseexecuteSql.then(() => { console.info('delete done.') @@ -1381,7 +1382,7 @@ beginTransaction():void **系统能力**:SystemCapability.DistributedDataManager.RelationalStore.Core。 **示例**: -``` +```js rdbStore.beginTransaction() const valueBucket = { "name": "lisi", @@ -1405,7 +1406,7 @@ commit():void **系统能力**:SystemCapability.DistributedDataManager.RelationalStore.Core。 **示例**: -``` +```js rdbStore.beginTransaction() const valueBucket = { "name": "lisi", @@ -1430,7 +1431,7 @@ rollBack():void; **系统能力**:SystemCapability.DistributedDataManager.RelationalStore.Core。 **示例**: -``` +```js try { rdbStore.beginTransaction() const valueBucket = { @@ -1465,7 +1466,7 @@ setDistributedTables(tables: Array<string>, callback: AsyncCallback<voi | callback | AsyncCallback<void> | 是 | 指定callback回调函数。 | **示例**: - ``` + ```js rdbStore.setDistributedTables(["EMPLOYEE"], function (err) { if (err) { console.info('setDistributedTables failed.') @@ -1495,7 +1496,7 @@ setDistributedTables(tables: Array<string>, callback: AsyncCallback<voi | Promise<void> | 指定Promise回调函数。 | **示例**: - ``` + ```js let promiseset = rdbStore.setDistributedTables(["EMPLOYEE"]) promiseset.then(() => { console.info("setDistributedTables success.") @@ -1520,7 +1521,7 @@ obtainDistributedTableName(device: string, table: string, callback: AsyncCallbac | callback | AsyncCallback<string> | 是 | 指定的callback回调函数。如果操作成功,返回远程设备的分布式表名。 | **示例**: - ``` + ```js rdbStore.obtainDistributedTableName(deviceId, "EMPLOYEE", function (err, tableName) { if (err) { console.info('obtainDistributedTableName failed.') @@ -1551,7 +1552,7 @@ obtainDistributedTableName(device: string, table: string, callback: AsyncCallbac | Promise<string> | 指定Promise回调函数。如果操作成功,返回远程设备的分布式表名。 | **示例**: - ``` + ```js let promiseDistr = rdbStore.obtainDistributedTableName(deviceId, "EMPLOYEE") promiseDistr.then((tableName) => { console.info('obtainDistributedTableName success, tableName=' + tableName) @@ -1576,7 +1577,7 @@ sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback<Array | callback | AsyncCallback<Array<[string, number]>> | 是 | 指定的callback回调函数,用于向调用者发送同步结果。string:设备ID;number:每个设备同步状态,0表示成功,其他值表示失败。| **示例**: - ``` + ```js let predicate = new rdb.RdbPredicates('EMPLOYEE') predicate.inDevices(['12345678abcde']) rdbStore.sync(rdb.SyncMode.SYNC_MODE_PUSH, predicate, function (err, result) { @@ -1613,7 +1614,7 @@ sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback<Array | Promise<Array<[string, number]>> | 指定Promise回调函数,用于向调用者发送同步结果。string:设备ID;number:每个设备同步状态,0表示成功,其他值表示失败。 | **示例**: - ``` + ```js let predicatesync = new data_rdb.RdbPredicates('EMPLOYEE') predicatesync.inDevices(['12345678abcde']) let promisesync = rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicatesync) @@ -1644,7 +1645,7 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback<Array<stri | observer | Callback<Array<string>> | 是 | 指分布式数据库中数据更改事件的观察者。 | **示例**: - ``` + ```js function storeObserver(devices) { for (let i = 0; i < devices.length; i++) { console.log('device=' + device[i] + ' data changed') @@ -1675,7 +1676,7 @@ off(event:'dataChange', type: SubscribeType, observer: Callback<Array<stri **示例**: - ``` + ```js function storeObserver(devices) { for (let i = 0; i < devices.length; i++) { console.log('device=' + device[i] + ' data changed') @@ -1688,7 +1689,6 @@ off(event:'dataChange', type: SubscribeType, observer: Callback<Array<stri } ``` - ## StoreConfig 管理关系数据库配置。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-resultset.md b/zh-cn/application-dev/reference/apis/js-apis-data-resultset.md index 08dfbda473b6e3d47d1ed9d4de8bcc6ba2281c8b..f86e52ba55978a868e1fe284b24415794b449c75 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-resultset.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-resultset.md @@ -8,7 +8,7 @@ 需要通过[RdbStore.query()](js-apis-data-rdb.md#query)获取resultSet对象。 -``` +```js import dataRdb from '@ohos.data.rdb'; let predicates = new dataRdb.RdbPredicates("EMPLOYEE") predicates.equalTo("AGE", 18) @@ -18,10 +18,6 @@ promise.then((resultSet) => { console.log(TAG + "resultSet columnCount:" + resultSet.columnCount);}) ``` - - - - ## ResultSet 提供通过查询数据库生成的数据库结果集的访问方法。 @@ -63,7 +59,7 @@ getColumnIndex(columnName: string): number | number | 返回指定列的索引。 | - 示例: - ``` + ```js resultSet.goToFirstRow() const id = resultSet.getLong(resultSet.getColumnIndex("ID")) const name = resultSet.getString(resultSet.getColumnIndex("NAME")) @@ -91,7 +87,7 @@ getColumnName(columnIndex: number): string | string | 返回指定列的名称。 | - 示例: - ``` + ```js const id = resultSet.getColumnName(0) const name = resultSet.getColumnName(1) const age = resultSet.getColumnName(2) @@ -117,7 +113,7 @@ goTo(offset:number): boolean | boolean | 如果成功移动结果集,则为true;否则返回false。 | - 示例: - ``` + ```js let predicatesgoto = new dataRdb.RdbPredicates("EMPLOYEE") let promisequerygoto = rdbStore.query(predicatesgoto, ["ID", "NAME", "AGE", "SALARY", "CODES"]) promisequerygoto.then((resultSet) { @@ -148,7 +144,7 @@ goToRow(position: number): boolean | boolean | 如果成功移动结果集,则为true;否则返回false。 | - 示例: - ``` + ```js let predicatesgotorow = new dataRdb.RdbPredicates("EMPLOYEE") let promisequerygotorow = rdbStore.query(predicatesgotorow, ["ID", "NAME", "AGE", "SALARY", "CODES"]) promisequerygotorow.then((resultSet) { @@ -175,7 +171,7 @@ goToFirstRow(): boolean | boolean | 如果成功移动结果集,则为true;否则返回false。 | - 示例: - ``` + ```js let predicatesgoFirst = new dataRdb.RdbPredicates("EMPLOYEE") let promisequerygoFirst = rdbStore.query(predicatesgoFirst, ["ID", "NAME", "AGE", "SALARY", "CODES"]) promisequerygoFirst.then((resultSet) { @@ -201,7 +197,7 @@ goToLastRow(): boolean | boolean | 如果成功移动结果集,则为true;否则返回false。 | - 示例: - ``` + ```js let predicatesgoLast = new dataRdb.RdbPredicates("EMPLOYEE") let promisequerygoLast = rdbStore.query(predicatesgoLast, ["ID", "NAME", "AGE", "SALARY", "CODES"]) promisequerygoLast.then((resultSet) { @@ -227,7 +223,7 @@ goToNextRow(): boolean | boolean | 如果成功移动结果集,则为true;否则返回false。 | - 示例: - ``` + ```js let predicatesgoNext = new dataRdb.RdbPredicates("EMPLOYEE") let promisequerygoNext = rdbStore.query(predicatesgoNext, ["ID", "NAME", "AGE", "SALARY", "CODES"]) promisequerygoNext.then((resultSet) { @@ -253,7 +249,7 @@ goToPreviousRow(): boolean | boolean | 如果成功移动结果集,则为true;否则返回false。 | - 示例: - ``` + ```js let predicatesgoPrev = new dataRdb.RdbPredicates("EMPLOYEE") let promisequerygoPrev = rdbStore.query(predicatesgoPrev, ["ID", "NAME", "AGE", "SALARY", "CODES"]) promisequerygoPrev.then((resultSet) { @@ -284,7 +280,7 @@ getBlob(columnIndex: number): Uint8Array | Uint8Array | 以字节数组的形式返回指定列的值。 | - 示例: - ``` + ```js const codes = resultSet.getBlob(resultSet.getColumnIndex("CODES")) ``` @@ -308,7 +304,7 @@ getString(columnIndex: number): string | string | 以字符串形式返回指定列的值。 | - 示例: - ``` + ```js const name = resultSet.getString(resultSet.getColumnIndex("NAME")) ``` @@ -332,7 +328,7 @@ getLong(columnIndex: number): number | number | 以Long形式返回指定列的值。 | - 示例: - ``` + ```js const age = resultSet.getLong(resultSet.getColumnIndex("AGE")) ``` @@ -356,7 +352,7 @@ getDouble(columnIndex: number): number | number | 以double形式返回指定列的值。 | - 示例: - ``` + ```js const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY")) ``` @@ -380,7 +376,7 @@ isColumnNull(columnIndex: number): boolean | boolean | 如果当前行中指定列的值为null,则返回true,否则返回false。 | - 示例: - ``` + ```js const isColumnNull = resultSet.isColumnNull(resultSet.getColumnIndex("CODES")) ``` @@ -394,12 +390,13 @@ close(): void **系统能力**:SystemCapability.DistributedDataManager.RelationalStore.Core。 - 示例: - ``` - let predicatesclose = new dataRdb.RdbPredicates("EMPLOYEE") - let predicatesclose = rdbStore.query(predicatesclose, ["ID", "NAME", "AGE", "SALARY", "CODES"]) - promisequerygoPrev.then((resultSet) { + ```js + let predicatesClose = new dataRdb.RdbPredicates("EMPLOYEE") + let promiseClose = rdbStore.query(predicatesClose, ["ID", "NAME", "AGE", "SALARY", "CODES"]) + promiseClose.then((resultSet) { resultSet.close() }).catch((err) => { - console.log('query failed') + console.log('resultset close failed') }) ``` + diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-storage.md b/zh-cn/application-dev/reference/apis/js-apis-data-storage.md index 0de7d0a2385fa4f998295217b454a17acc77495b..09c94ce9de65bfd8a98cbd38ad62f0a04d9997e7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-storage.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-storage.md @@ -12,18 +12,18 @@ ## 导入模块 -``` -import dataStorage from '@ohos.data.storage' +```js +import dataStorage from '@ohos.data.storage'; ``` -## 属性 +## 常量 **系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.Preferences.Core | 名称 | 参数类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- | -------- | | MAX_KEY_LENGTH | string | 是 | 否 | key的最大长度限制,大小为80字节。 | -| MAX_VALUE_LENGTH | string | 是 | 否 | string类型value的最大长度限制,大小为8192字节。 | +| MAX_VALUE_LENGTH | string | 是 | 否 | value的最大长度限制,大小为8192字节。 | ## dataStorage.getStorageSync @@ -45,7 +45,7 @@ getStorageSync(path: string): Storage | [Storage](#storage) | 获取到要操作的Storage实例,用于进行数据存储操作。 | - 示例: - ``` + ```js import dataStorage from '@ohos.data.storage' import featureAbility from '@ohos.ability.featureAbility' @@ -78,7 +78,7 @@ getStorage(path: string, callback: AsyncCallback<Storage>): void | callback | AsyncCallback<[Storage](#storage)> | 是 | 回调函数。 | - 示例: - ``` + ```js import dataStorage from '@ohos.data.storage' import featureAbility from '@ohos.ability.featureAbility' @@ -120,7 +120,7 @@ getStorage(path: string): Promise<Storage> | Promise<[Storage](#storage)> | Promise实例,用于异步获取结果。 | - 示例: - ``` + ```js import dataStorage from '@ohos.data.storage' import featureAbility from '@ohos.ability.featureAbility' @@ -176,7 +176,7 @@ deleteStorage(path: string, callback: AsyncCallback<void>): void | callback | AsyncCallback<void> | 是 | 回调函数。 | - 示例: - ``` + ```js dataStorage.deleteStorage(path + '/mystore', function (err) { if (err) { console.info("Deleted failed with err: " + err) @@ -206,7 +206,7 @@ deleteStorage(path: string): Promise<void> | Promise<void> | Promise实例,用于异步获取结果。 | - 示例: - ``` + ```js let promisedelSt = dataStorage.deleteStorage(path + '/mystore') promisedelSt.then(() => { console.info("Deleted successfully.") @@ -232,7 +232,7 @@ removeStorageFromCacheSync(path: string): void | path | string | 是 | 应用程序内部数据存储路径。 | - 示例: - ``` + ```js dataStorage.removeStorageFromCacheSync(path + '/mystore') ``` @@ -254,7 +254,7 @@ removeStorageFromCache(path: string, callback: AsyncCallback<void>): void | callback | AsyncCallback<void> | 是 | 回调函数。 | - 示例: - ``` + ```js dataStorage.removeStorageFromCache(path + '/mystore', function (err) { if (err) { console.info("Removed storage from cache failed with err: " + err) @@ -286,7 +286,7 @@ removeStorageFromCache(path: string): Promise<void> | Promise<void> | Promise实例,用于异步获取结果。 | - 示例: - ``` + ```js let promiserevSt = dataStorage.removeStorageFromCache(path + '/mystore') promiserevSt.then(() => { console.info("Removed storage from cache successfully.") @@ -314,8 +314,8 @@ getSync(key: string, defValue: ValueType): ValueType - 参数: | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | key | string | 是 | 要获取的存储key名称。它不能为空。 | - | defValue | ValueType | 是 | 给定key的存储不存在,则要返回的默认值。支持number、string、boolean。 | + | key | string | 是 | 要获取的存储key名称,不能为空。 | + | defValue | [ValueType](#valuetype) | 是 | 给定key的存储不存在,则要返回的默认值。支持number、string、boolean。 | - 返回值: | 类型 | 说明 | @@ -323,7 +323,7 @@ getSync(key: string, defValue: ValueType): ValueType | ValueType | 键对应的值,如果值为null或者非默认值类型,返回默认数据。 | - 示例: - ``` + ```js let value = storage.getSync('startup', 'default') console.info("The value of startup is " + value) ``` @@ -342,12 +342,12 @@ get(key: string, defValue: ValueType, callback: AsyncCallback<ValueType>): - 参数: | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | key | string | 是 | 要获取的存储key名称。它不能为空。 | - | defValue | ValueType | 是 | 默认返回值。支持number、string、boolean。 | + | key | string | 是 | 要获取的存储key名称,不能为空。 | + | defValue | [ValueType](#valuetype) | 是 | 默认返回值。支持number、string、boolean。 | | callback | AsyncCallback<ValueType> | 是 | 回调函数。 | - 示例: - ``` + ```js storage.get('startup', 'default', function(err, value) { if (err) { console.info("Get the value of startup failed with err: " + err) @@ -371,8 +371,8 @@ get(key: string, defValue: ValueType): Promise<ValueType> - **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | key | string | 是 | 要获取的存储key名称。它不能为空。 | - | defValue | ValueType | 是 | 默认返回值。支持number、string、boolean。 | + | key | string | 是 | 要获取的存储key名称,不能为空。 | + | defValue | [ValueType](#valuetype) | 是 | 默认返回值。支持number、string、boolean。 | - 返回值: | 类型 | 说明 | @@ -380,7 +380,7 @@ get(key: string, defValue: ValueType): Promise<ValueType> | Promise<ValueType> | Promise实例,用于异步获取结果。 | - 示例: - ``` + ```js let promiseget = storage.get('startup', 'default') promiseget.then((value) => { console.info("The value of startup is " + value) @@ -403,11 +403,11 @@ putSync(key: string, value: ValueType): void - 参数: | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | key | string | 是 | 要修改的存储的key。它不能为空。 | - | value | ValueType | 是 | 存储的新值。支持number、string、boolean。 | + | key | string | 是 | 要修改的存储的key,不能为空。 | + | value | [ValueType](#valuetype) | 是 | 存储的新值。支持number、string、boolean。 | - 示例: - ``` + ```js storage.putSync('startup', 'auto') ``` @@ -425,12 +425,12 @@ put(key: string, value: ValueType, callback: AsyncCallback<void>): void - 参数: | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | key | string | 是 | 要修改的存储的key。它不能为空。 | - | value | ValueType | 是 | 存储的新值。支持number、string、boolean。 | + | key | string | 是 | 要修改的存储的key,不能为空。 | + | value | [ValueType](#valuetype) | 是 | 存储的新值。支持number、string、boolean。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | - 示例: - ``` + ```js storage.put('startup', 'auto', function (err) { if (err) { console.info("Put the value of startup failed with err: " + err) @@ -454,8 +454,8 @@ put(key: string, value: ValueType): Promise<void> - 参数: | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | key | string | 是 | 要修改的存储的key。它不能为空。 | - | value | ValueType | 是 | 存储的新值。支持number、string、boolean。 | + | key | string | 是 | 要修改的存储的key,不能为空。 | + | value | [ValueType](#valuetype) | 是 | 存储的新值。支持number、string、boolean。 | - 返回值: | 类型 | 说明 | @@ -463,7 +463,7 @@ put(key: string, value: ValueType): Promise<void> | Promise<void> | Promise实例,用于异步处理。 | - 示例: - ``` + ```js let promiseput = storage.put('startup', 'auto') promiseput.then(() => { console.info("Put the value of startup successfully.") @@ -486,7 +486,7 @@ hasSync(key: string): boolean - 参数: | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | key | string | 是 | 要获取的存储key名称。它不能为空。 | + | key | string | 是 | 要获取的存储key名称,不能为空。 | - 返回值: | 类型 | 说明 | @@ -494,7 +494,7 @@ hasSync(key: string): boolean | boolean | true 表示存在,false表示不存在。 | - 示例: - ``` + ```js let isExist = storage.hasSync('startup') if (isExist) { console.info("The key of startup is contained.") @@ -524,7 +524,7 @@ has(key: string, callback: AsyncCallback<boolean>): boolean | boolean | true表示存在,false表示不存在。 | - 示例: - ``` + ```js storage.has('startup', function (err, isExist) { if (err) { console.info("Check the key of startup failed with err: " + err) @@ -550,7 +550,7 @@ has(key: string): Promise<boolean> - 参数: | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | key | string | 是 | 要获取的存储key名称。它不能为空。 | + | key | string | 是 | 要获取的存储key名称,不能为空。 | - 返回值: | 类型 | 说明 | @@ -558,7 +558,7 @@ has(key: string): Promise<boolean> | Promise<boolean> | Promise实例,用于异步处理。 | - 示例: - ``` + ```js let promisehas = storage.has('startup') promisehas.then((isExist) => { if (isExist) { @@ -586,12 +586,12 @@ deleteSync(key: string): void | key | string | 是 | 要获取的存储key名称。它不能为空。 | - 示例: - ``` + ```js storage.deleteSync('startup') ``` -### delete +### deletej delete(key: string, callback: AsyncCallback<void>): void @@ -608,7 +608,7 @@ delete(key: string, callback: AsyncCallback<void>): void | callback | AsyncCallback<void> | 是 | 回调函数。 | - 示例: - ``` + ```js storage.delete('startup', function (err) { if (err) { console.info("Delete startup key failed with err: " + err) @@ -640,7 +640,7 @@ delete(key: string): Promise<void> | Promise<void> | Promise实例,用于异步处理。 | - 示例: - ``` + ```js let promisedel = storage.delete('startup') promisedel.then(() => { console.info("Deleted startup key successfully.") @@ -661,7 +661,7 @@ flushSync(): void **系统能力**:SystemCapability.DistributedDataManager.Preferences.Core - 示例: - ``` + ```js storage.flushSync() ``` @@ -682,7 +682,7 @@ flush(callback: AsyncCallback<void>): void | callback | AsyncCallback<void> | 是 | 回调函数。 | - 示例: - ``` + ```js storage.flush(function (err) { if (err) { console.info("Flush to file failed with err: " + err) @@ -709,7 +709,7 @@ flush(): Promise<void> | Promise<void> | Promise实例,用于异步处理。 | - 示例: - ``` + ```js let promiseflush = storage.flush() promiseflush.then(() => { console.info("Flushed to file successfully.") @@ -730,7 +730,7 @@ clearSync(): void **系统能力**:SystemCapability.DistributedDataManager.Preferences.Core - 示例: - ``` + ```js storage.clearSync() ``` @@ -751,7 +751,7 @@ clear(callback: AsyncCallback<void>): void | callback | AsyncCallback<void> | 是 | 回调函数。 | - 示例: - ``` + ```js storage.clear(function (err) { if (err) { console.info("Clear to file failed with err: " + err) @@ -778,7 +778,7 @@ clear(): Promise<void> | Promise<void> | Promise实例,用于异步处理。 | - 示例: - ``` + ```js let promiseclear = storage.clear() promiseclear.then(() => { console.info("Cleared to file successfully.") @@ -803,7 +803,7 @@ on(type: 'change', callback: Callback<StorageObserver>): void | callback | Callback<[StorageObserver](#storageobserver)> | 回调对象实例。 | - 示例: - ``` + ```js var observer = function (key) { console.info("The key of " + key + " changed.") } @@ -828,7 +828,7 @@ off(type: 'change', callback: Callback<StorageObserver>): void | callback | Callback<[StorageObserver](#storageobserver)> | 需要取消的回调对象实例。 | - 示例: - ``` + ```js var observer = function (key) { console.info("The key of " + key + " changed.") } @@ -843,3 +843,15 @@ off(type: 'change', callback: Callback<StorageObserver>): void | 名称 | 参数类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | key | string | 否 | 变更的数据内容。 | + +## ValueType + +用于表示允许的数据字段类型。 + +**系统能力**:SystemCapability.DistributedDataManager.Preferences.Core + +| 名称 | 说明 | +| ------- | -------------------- | +| number | 表示值类型为数字。 | +| string | 表示值类型为字符。 | +| boolean | 表示值类型为布尔值。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md b/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md index 26d8878669c097e7c3b3588c31d9847487652895..df834dddcca95d853221711878b045e13c46c8a0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md +++ b/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md @@ -6,7 +6,7 @@ ## 导入模块 -``` +```js import distributedData from '@ohos.data.distributedData'; ``` @@ -27,7 +27,7 @@ createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager> | callback | AsyncCallback<[KVManager](#kvmanager)> | 是 | KVManager实例创建时调用的回调,返回KVManager对象实例。 | **示例**: -``` +```js let kvManager; try { const kvManagerConfig = { @@ -72,7 +72,7 @@ createKVManager(config: KVManagerConfig): Promise<KVManager> **示例**: -``` +```js let kvManager; try { const kvManagerConfig = { @@ -129,7 +129,7 @@ try { ## KVManager -数据管理实例,用于获取KVStore的相关信息。在调用KVManager的方法前,需要先通过createKVManager构建一个KVManager实例。 +数据管理实例,用于获取KVStore的相关信息。在调用KVManager的方法前,需要先通过[createKVManager](#distributeddatacreatekvmanager)构建一个KVManager实例。 ### getKVStore @@ -145,11 +145,11 @@ getKVStore<T extends KVStore>(storeId: string, options: Options, callback: | ----- | ------ | ------ | ------ | | storeId | string | 是 | 数据库唯一标识符,长度不大于[MAX_STORE_ID_LENGTH](#constants)。 | | options | [Options](#options) | 是 | 创建KVStore实例的配置信息。 | -| callback | AsyncCallback<T>,<T extends KVStore> | 是 | 创建KVStore实例的回调,返回KVStore对象实例。 | +| callback | AsyncCallback<T>,<T extends [KVStore](#kvstore)> | 是 | 创建KVStore实例的回调,返回KVStore对象实例。 | **示例**: -``` +```js let kvStore; let kvManager; try { @@ -195,11 +195,11 @@ getKVStore<T extends KVStore>(storeId: string, options: Options): Promise& | 类型 | 说明 | | -------------------------------------- | ------------------------ | -| Promise<T> <T extends KVStore> | 指定的Promise回调方法,返回创建的KVStore数据库实例。 | +| Promise<T> <T extends [KVStore](#kvstore)> | 指定的Promise回调方法,返回创建的KVStore数据库实例。 | **示例**: -``` +```js let kvStore; let kvManager; try { @@ -226,7 +226,7 @@ try { closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback<void>): void -通过storId的值关闭指定的kvStore数据库,并通过callback方式返回,此方法为异步方法。 +通过storeId的值关闭指定的KVStore数据库,并通过callback方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -237,12 +237,12 @@ closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCa | ------- | ----------------- | ---- | --------------------------- | | appId | string | 是 | 所调用数据库方的包名。 | | storeId | string | 是 | 要关闭的数据库唯一标识符,长度不大于[MAX_STORE_ID_LENGTH](#constants)。 | -| kvStore | [KVStore](#kvstore) | 是 | 要关闭的KvStore数据库。 | +| kvStore | [KVStore](#kvstore) | 是 | 要关闭的KVStore数据库。 | | callback | AsyncCallback<void> | 是 | 回调函数,如果数据库关闭成功则返回true,否则返回false。 | **示例**: -``` +```js let kvStore; let kvManager; const options = { @@ -272,7 +272,7 @@ const options = { closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise<void> -通过kvStore的值关闭指定的kvStore数据库,并通过Promise方式返回,此方法为异步方法。 +通过storeId的值关闭指定的KVStore数据库,并通过Promise方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -282,17 +282,17 @@ closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise<void& | ----- | ------ | ---- | ----------------------------- | | appId | string | 是 | 所调用数据库方的包名。 | | storeId | string | 是 | 要关闭的数据库唯一标识符,长度不大于[MAX_STORE_ID_LENGTH](#constants)。 | -| kvStore | [KVStore](#kvstore) | 是 | 要关闭的KvStore数据库。 | +| kvStore | [KVStore](#kvstore) | 是 | 要关闭的KVStore数据库。 | **返回值**: | 类型 | 说明 | | ------------- | -------------- | -| Promise | Promise实例,如果数据库关闭成功则返回true,否则返回false。 | +| Promise\ | Promise实例,如果数据库关闭成功则返回true,否则返回false。 | **示例**: -``` +```js let kvManager; let kvStore; const options = { @@ -326,7 +326,7 @@ const options = { deleteKVStore(appId: string, storeId: string, callback: AsyncCallback<void>): void -通过storeId的值删除指定的kvStore数据库,并通过callback方式返回,此方法为异步方法。 +通过storeId的值删除指定的KVStore数据库,并通过callback方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -340,7 +340,7 @@ deleteKVStore(appId: string, storeId: string, callback: AsyncCallback<void> **示例**: -``` +```js let kvManager; let kvStore; const options = { @@ -369,7 +369,7 @@ try { deleteKVStore(appId: string, storeId: string): Promise<void> -通过storeId的值删除指定的kvStore数据库,并通过Promise方式返回,此方法为异步方法。 +通过storeId的值删除指定的KVStore数据库,并通过Promise方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -389,7 +389,7 @@ deleteKVStore(appId: string, storeId: string): Promise<void> **示例**: -``` +```js let kvManager; let kvStore; const options = { @@ -402,7 +402,7 @@ const options = { securityLevel : distributedData.SecurityLevel.S2, } try { - kvManager.getKVStore('storId', options).then(async (store) => { + kvManager.getKVStore('storeId', options).then(async (store) => { console.log('getKVStore success'); kvStore = store; await kvManager.deleteKVStore('appId', 'storeId').then(() => { @@ -423,7 +423,7 @@ try { getAllKVStoreId(appId: string, callback: AsyncCallback<string[]>): void -获取所有通过getKvStore方法创建的且没有调用deleteKvStore方法删除的KvStore数据库的storeId,并通过callback方式返回,此方法为异步方法。 +获取所有通过[getKVStore](#getkvstore)方法创建的且没有调用[deleteKVStore](#deletekvstore8)方法删除的KVStore数据库的storeId,并通过callback方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -436,7 +436,7 @@ getAllKVStoreId(appId: string, callback: AsyncCallback<string[]>): void **示例**: -``` +```js let kvManager; try { kvManager.getAllKVStoreId('appId', function (err, data) { @@ -453,7 +453,7 @@ try { getAllKVStoreId(appId: string): Promise<string[]> -获取所有通过getKvStore方法创建的且没有调用deleteKvStore方法删除的KvStore数据库的storeId,并通过Promise方式返回,此方法为异步方法。 +获取所有通过[getKVStore](#getkvstore)方法创建的且没有调用[deleteKVStore](#deletekvstore8)方法删除的KVStore数据库的storeId,并通过Promise方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -472,7 +472,7 @@ getAllKVStoreId(appId: string): Promise<string[]> **示例**: -``` +```js let kvManager; try { console.log('GetAllKVStoreId'); @@ -505,7 +505,7 @@ on(event: 'distributedDataServiceDie', deathCallback: Callback<void>): voi **示例** -``` +```js let kvManager; try { @@ -538,7 +538,7 @@ off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): v **示例** -``` +```js let kvManager; try { console.log('KVManagerOff'); @@ -563,7 +563,7 @@ try { | createIfMissing | boolean | 否 | 当数据库文件不存在时是否创建数据库,默认创建。 | | encrypt | boolean | 否 |设置数据库文件是否加密,默认不加密。 | | backup | boolean | 否 |设置数据库文件是否备份,默认备份。 | -| autoSync | boolean | 否 |设置数据库文件是否自动同步,默认不自动同步。**需要权限**: ohos.permission.DISTRIBUTED_DATASYNC。 | +| autoSync | boolean | 否 |设置数据库文件是否自动同步,默认不自动同步。
**需要权限**: ohos.permission.DISTRIBUTED_DATASYNC。 | | kvStoreType | [KVStoreType](#kvstoretype) | 否 |设置要创建的数据库类型,默认为多设备协同数据库。 | | securityLevel | [SecurityLevel](#securitylevel) | 否 |设置数据库安全级别,默认不设置安全级别。 | | schema8+ | [Schema](#schema8) | 否 | 设置定义存储在数据库中的值。 | @@ -621,7 +621,7 @@ KVStore常量。 | 名称 | 类型 | 说明 | | --- | ---- | ----------------------- | -| root8+ | [FieldNode](#fieldnode8) | 表示json根对象 | +| root8+ | [FieldNode](#fieldnode8) | 表示json根对象。 | | indexes8+ | Array\ | 表示json类型的字符串数组。 | | mode8+ | number | 表示Schema的模式。 | | skip8+ | number | Schema的跳跃大小。 | @@ -674,7 +674,6 @@ appendChild(child: FieldNode): boolean | ----- | ------ | ---- | ----------------------- | | child | [FieldNode](#fieldnode8) | 是 | 要附加的域节点。 | - **返回值**: | 类型 | 说明 | @@ -683,7 +682,7 @@ appendChild(child: FieldNode): boolean **示例** -``` +```js import ddm from '@ohos.data.distributedData'; try { let node = new ddm.FieldNode("root"); @@ -706,7 +705,7 @@ try { ## KvStoreResultSet8+ ## -提供获取KvStore数据库结果集的方法,提供查询和移动数据读取位置的方法,在调用KvStoreResultSet的方法前,需要先通过KvStore 构建一个KvStore 实例。 +提供获取KVStore数据库结果集的方法,提供查询和移动数据读取位置的方法,在调用KvStoreResultSet的方法前,需要先通过KVStore 构建一个KVStore 实例。 ### getCount8+ ### @@ -725,7 +724,7 @@ getCount(): number **示例** -``` +```js let kvStore; try { let resultSet; @@ -758,7 +757,7 @@ getPosition(): number **示例** -``` +```js let kvStore; try { let resultSet; @@ -792,7 +791,7 @@ moveToFirst(): boolean **示例** -``` +```js let kvStore; try { let resultSet; @@ -826,7 +825,7 @@ moveToLast(): boolean **示例** -``` +```js let kvStore; try { let resultSet; @@ -860,7 +859,7 @@ moveToNext(): boolean **示例** -``` +```js let kvStore; try { let resultSet; @@ -894,7 +893,7 @@ moveToPrevious(): boolean **示例** -``` +```js let kvStore; try { let resultSet; @@ -934,7 +933,7 @@ move(offset: number): boolean **示例** -``` +```js let kvStore; try { let resultSet; @@ -974,7 +973,7 @@ moveToPosition(position: number): boolean **示例** -``` +```js let kvStore; try { let resultSet; @@ -1008,7 +1007,7 @@ isFirst(): boolean **示例** -``` +```js let kvStore; try { let resultSet; @@ -1042,7 +1041,7 @@ isLast(): boolean **示例** -``` +```js let kvStore; try { let resultSet; @@ -1075,7 +1074,7 @@ isBeforeFirst(): boolean **示例** -``` +```js let kvStore; try { let resultSet; @@ -1109,7 +1108,7 @@ isAfterLast(): boolean **示例** -``` +```js let kvStore; try { let resultSet; @@ -1131,7 +1130,7 @@ try { getEntry(): Entry -获取键值对 +获取键值对。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -1139,11 +1138,11 @@ getEntry(): Entry | 类型 | 说明 | | ------ | ------- | -| Entry |返回键值对。| +| [Entry](#entry) |返回键值对。| **示例** -``` +```js let kvStore; try { let resultSet; @@ -1172,7 +1171,7 @@ try { constructor() -用于创建Schema实例的构造函数 +用于创建Schema实例的构造函数。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -1194,7 +1193,7 @@ reset(): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.equalTo("key", "value"); @@ -1210,7 +1209,7 @@ try { ### equalTo8+ ### -equalTo(field: string, value: number|string|boolean): Query; +equalTo(field: string, value: number|string|boolean): Query 构造一个Query对象来查询具有指定字段的条目,其值等于指定的值。 @@ -1221,7 +1220,7 @@ equalTo(field: string, value: number|string|boolean): Query; | 参数名 | 参数类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------- | | fieId | string | 是 |表示指定字段,必须以$开头, 并且不能包含' ^ '。 | -| value | number/string/boolean | 是 | 表示指定的值。| +| value | number\|string\|boolean | 是 | 表示指定的值。| **返回值**: @@ -1231,7 +1230,7 @@ equalTo(field: string, value: number|string|boolean): Query; **示例** -``` +```js try { let query = new distributedData.Query(); query.equalTo("field", "value"); @@ -1256,7 +1255,7 @@ notEqualTo(field: string, value: number|string|boolean): Query | 参数名 | 参数类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------- | | fieId | string | 是 |表示指定字段,必须以$开头, 并且不能包含' ^ '。 | -| value | number/string/boolean | 是 | 表示指定的值。| +| value | number\|string\|boolean | 是 | 表示指定的值。| **返回值**: @@ -1266,7 +1265,7 @@ notEqualTo(field: string, value: number|string|boolean): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.notEqualTo("field", "value"); @@ -1301,7 +1300,7 @@ greaterThan(field: string, value: number|string|boolean): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.greaterThan("field", "value"); @@ -1336,7 +1335,7 @@ lessThan(field: string, value: number|string): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.lessThan("field", "value"); @@ -1371,7 +1370,7 @@ greaterThanOrEqualTo(field: string, value: number|string): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.greaterThanOrEqualTo("field", "value"); @@ -1406,7 +1405,7 @@ lessThanOrEqualTo(field: string, value: number|string): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.lessThanOrEqualTo("field", "value"); @@ -1441,7 +1440,7 @@ isNull(field: string): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.isNull("field"); @@ -1477,7 +1476,7 @@ inNumber(field: string, valueList: number[]): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.inNumber("field", [0, 1]); @@ -1512,7 +1511,7 @@ inString(field: string, valueList: string[]): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.inString("field", ['test1', 'test2']); @@ -1547,7 +1546,7 @@ notInNumber(field: string, valueList: number[]): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.notInNumber("field", [0, 1]); @@ -1582,7 +1581,7 @@ notInString(field: string, valueList: string[]): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.notInString("field", ['test1', 'test2']); @@ -1617,7 +1616,7 @@ like(field: string, value: string): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.like("field", "value"); @@ -1652,7 +1651,7 @@ unlike(field: string, value: string): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.unlike("field", "value"); @@ -1680,7 +1679,7 @@ and(): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.notEqualTo("field", "value1"); @@ -1710,7 +1709,7 @@ or(): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.notEqualTo("field", "value1"); @@ -1746,7 +1745,7 @@ orderByAsc(field: string): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.notEqualTo("field", "value"); @@ -1781,7 +1780,7 @@ orderByDesc(field: string): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.notEqualTo("field", "value"); @@ -1817,7 +1816,7 @@ limit(total: number, offset: number): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.notEqualTo("field", "value"); @@ -1852,7 +1851,7 @@ isNotNull(field: string): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.isNotNull("field"); @@ -1880,7 +1879,7 @@ beginGroup(): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.beginGroup(); @@ -1910,7 +1909,7 @@ endGroup(): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.beginGroup(); @@ -1946,7 +1945,7 @@ prefixKey(prefix: string): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.prefixKey("$.name"); @@ -1981,7 +1980,7 @@ setSuggestIndex(index: string): Query **示例** -``` +```js try { let query = new distributedData.Query(); query.setSuggestIndex("$.name"); @@ -2017,7 +2016,7 @@ deviceId(deviceId:string):Query **示例** -``` +```js try { let query = new distributedData.Query(); query.deviceId("deviceId"); @@ -2044,7 +2043,7 @@ getSqlLike():string **示例** -``` +```js try { let query = new distributedData.Query(); let sql1 = query.getSqlLike(); @@ -2079,7 +2078,7 @@ put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncC **示例** -``` +```js let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; @@ -2120,7 +2119,7 @@ put(key: string, value: Uint8Array | string | number | boolean): Promise<void **示例** -``` +```js let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; @@ -2153,7 +2152,7 @@ delete(key: string, callback: AsyncCallback<void>): void **示例** -``` +```js let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; @@ -2200,7 +2199,7 @@ delete(key: string): Promise<void> **示例** -``` +```js let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; @@ -2233,13 +2232,13 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotific | 参数名 | 参数类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------- | -| event |'dataChange' | 是 |回调函数名称。 | +| event |'dataChange' | 是 |回调函数名称。
'dataChange'表示数据变更事件。 | | type |[SubscribeType](#subscribetype) | 是 |表示订阅的类型。 | | observer |Callback<[ChangeNotification](#changenotification)> | 是 |回调函数。 | **示例** -``` +```js let kvStore; kvStore.on('dataChange', distributedData.SubscribeType.SUBSCRIBE_TYPE_LOCAL, function (data) { console.log("dataChange callback call data: " + JSON.stringify(data)); @@ -2259,15 +2258,15 @@ on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]> | 参数名 | 参数类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------- | -| event |'syncComplete' | 是 |回调函数名称。 | +| event |'syncComplete' | 是 |回调函数名称。
'syncComplete'表示同步完成事件。 | | syncCallback |Callback<Array<[string, number]>> | 是 |回调函数。 | **示例** -``` +```js let kvStore; kvStore.on('syncComplete', function (data) { - console.log("syncComplete callback call data: " + data); + console.log("callback call data: " + data); }); ``` @@ -2283,18 +2282,18 @@ off(event:'dataChange', observer?: Callback<ChangeNotification>): void | 参数名 | 参数类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------- | -| event |'dataChange' | 是 |回调函数名称。 | +| event |'dataChange' | 是 |回调函数名称。
'dataChange'表示数据变更事件。 | | observer |Callback<[ChangeNotification](#changenotification)> |否 |回调函数。 | **示例** -``` +```js let kvStore; kvStore.on('dataChange', function (data) { - console.log("syncComplete callback call data: " + data); + console.log("callback call data: " + data); }); kvStore.off('dataChange', function (data) { - console.log("syncComplete callback call data: " + data); + console.log("callback call data: " + data); }); ``` @@ -2303,7 +2302,7 @@ kvStore.off('dataChange', function (data) { putBatch(entries: Entry[], callback: AsyncCallback<void>): void -批量插入键值对到KvStore数据库中,并通过callback方式返回,此方法为异步方法。 +批量插入键值对到KVStore数据库中,并通过callback方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -2316,7 +2315,7 @@ putBatch(entries: Entry[], callback: AsyncCallback<void>): void **示例** -``` +```js let kvStore; try { let entries = []; @@ -2350,7 +2349,7 @@ try { putBatch(entries: Entry[]): Promise<void> -批量插入键值对到KvStore数据库中,并通过Promise方式返回,此方法为异步方法。 +批量插入键值对到KVStore数据库中,并通过Promise方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -2368,7 +2367,7 @@ putBatch(entries: Entry[]): Promise<void> **示例** -``` +```js let kvStore; try { let entries = []; @@ -2405,7 +2404,7 @@ try { deleteBatch(keys: string[], callback: AsyncCallback<void>): void -批量删除KvStore数据库中的键值对,并通过callback方式返回,此方法为异步方法。 +批量删除KVStore数据库中的键值对,并通过callback方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -2418,7 +2417,7 @@ deleteBatch(keys: string[], callback: AsyncCallback<void>): void **示例** -``` +```js let kvStore; try { let entries = []; @@ -2452,7 +2451,7 @@ try { deleteBatch(keys: string[]): Promise<void> -批量删除键值对到KvStore数据库中,并通过Promise方式返回,此方法为异步方法。 +批量删除KVStore数据库中的键值对,并通过Promise方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -2470,7 +2469,7 @@ deleteBatch(keys: string[]): Promise<void> **示例** -``` +```js let kvStore; try { let entries = []; @@ -2508,7 +2507,7 @@ try { startTransaction(callback: AsyncCallback<void>): void -启动KvStore数据库中的事务,并通过callback方式返回,此方法为异步方法。 +启动KVStore数据库中的事务,并通过callback方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -2520,7 +2519,7 @@ startTransaction(callback: AsyncCallback<void>): void **示例** -``` +```js let kvStore; function putBatchString(len, prefix) { let entries = []; @@ -2560,7 +2559,7 @@ try { startTransaction(): Promise<void> -启动KvStore数据库中的事务,并通过Promise方式返回,此方法为异步方法。 +启动KVStore数据库中的事务,并通过Promise方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -2572,7 +2571,7 @@ startTransaction(): Promise<void> **示例** -``` +```js let kvStore; try { var count = 0; @@ -2595,7 +2594,7 @@ try { commit(callback: AsyncCallback<void>): void -提交KvStore数据库中的事务,并通过callback方式返回,此方法为异步方法。 +提交KVStore数据库中的事务,并通过callback方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -2607,7 +2606,7 @@ commit(callback: AsyncCallback<void>): void **示例** -``` +```js let kvStore; try { kvStore.commit(function (err,data) { @@ -2627,7 +2626,7 @@ try { commit(): Promise<void> -提交KvStore数据库中的事务,并通过Promise方式返回,此方法为异步方法。 +提交KVStore数据库中的事务,并通过Promise方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -2639,7 +2638,7 @@ commit(): Promise<void> **示例** -``` +```js let kvStore; try { kvStore.commit().then(async (err) => { @@ -2657,7 +2656,7 @@ try { rollback(callback: AsyncCallback<void>): void -在KvStore数据库中回滚事务,并通过callback方式返回,此方法为异步方法。 +在KVStore数据库中回滚事务,并通过callback方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -2669,7 +2668,7 @@ rollback(callback: AsyncCallback<void>): void **示例** -``` +```js let kvStore; try { kvStore.rollback(function (err,data) { @@ -2689,7 +2688,7 @@ try { rollback(): Promise<void> -在KvStore数据库中回滚事务,并通过Promise方式返回,此方法为异步方法。 +在KVStore数据库中回滚事务,并通过Promise方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -2701,7 +2700,7 @@ rollback(): Promise<void> **示例** -``` +```js let kvStore; try { kvStore.rollback().then(async (err) => { @@ -2732,7 +2731,7 @@ enableSync(enabled: boolean, callback: AsyncCallback<void>): void **示例** -``` +```js let kvStore; try { kvStore.enableSync(true, function (err,data) { @@ -2770,7 +2769,7 @@ enableSync(enabled: boolean): Promise<void> **示例** -``` +```js let kvStore; try { kvStore.enableSync(true).then((err) => { @@ -2802,7 +2801,7 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: Asy **示例** -``` +```js let kvStore; try { const localLabels = ['A', 'B']; @@ -2840,7 +2839,7 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<v **示例** -``` +```js let kvStore; try { const localLabels = ['A', 'B']; @@ -2902,7 +2901,7 @@ try { | 名称 | 参数类型 |可读 |可写 | 说明 | | ----- | ------- | -----| ------|------------------------ | | type | [ValueType](#value) | 是 | 是 |值类型。 | -| value | Uint8Array / string / number / boolean| 是 | 是 |值对象。 | +| value | Uint8Array \| string \| number \| boolean| 是 | 是 |值对象。 | ## ValueType @@ -2923,7 +2922,7 @@ try { ## SingleKVStore -单版本分布式数据库,继承自KVStore,提供查询数据和同步数据的方法。在调用 SingleKVStore 的方法前,需要先通过 getKVStore 构建一个 SingleKVStore 实例。 +单版本分布式数据库,继承自KVStore,提供查询数据和同步数据的方法。在调用 SingleKVStore 的方法前,需要先通过 [getKVStore](#getkvstore) 构建一个 SingleKVStore 实例。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -2944,7 +2943,7 @@ get(key: string, callback: AsyncCallback<Uint8Array | string | boolean | numb **示例** -``` +```js let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; @@ -2988,7 +2987,7 @@ get(key: string): Promise<Uint8Array | string | boolean | number> **示例** -``` +```js let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; @@ -3025,7 +3024,7 @@ getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void **示例** -``` +```js let kvStore; try { let entries = []; @@ -3076,7 +3075,7 @@ getEntries(keyPrefix: string): Promise<Entry[]> **示例** -``` +```js let kvStore; try { let entries = []; @@ -3129,7 +3128,7 @@ getEntries(query: Query, callback: AsyncCallback<Entry[]>): void **示例** -``` +```js let kvStore; try { var arr = new Uint8Array([21,31]); @@ -3185,7 +3184,7 @@ getEntries(query: Query): Promise<Entry[]> **示例** -``` +```js try { var arr = new Uint8Array([21,31]); let entries = []; @@ -3237,7 +3236,7 @@ getResultSet(keyPrefix: string, callback: AsyncCallback<KvStoreResultSet>) **示例** -``` +```js let kvStore; try { let resultSet; @@ -3273,7 +3272,7 @@ try { getResultSet(keyPrefix: string): Promise<KvStoreResultSet> -从 KvStore 数据库中获取具有指定前缀的结果集,并通过Promise方式返回,此方法为异步方法。 +从 KVStore 数据库中获取具有指定前缀的结果集,并通过Promise方式返回,此方法为异步方法。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -3291,7 +3290,7 @@ getResultSet(keyPrefix: string): Promise<KvStoreResultSet> **示例** -``` +```js let kvStore; try { let resultSet; @@ -3346,7 +3345,7 @@ getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): voi **示例** -``` +```js let kvStore; try { let resultSet; @@ -3399,7 +3398,7 @@ getResultSet(query: Query): Promise<KvStoreResultSet> **示例** -``` +```js let kvStore; try { let resultSet; @@ -3450,7 +3449,7 @@ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>) **示例** -``` +```js let kvStore; try { let resultSet = null; @@ -3489,7 +3488,7 @@ closeResultSet(resultSet: KvStoreResultSet): Promise<void> **示例** -``` +```js let kvStore; try { let resultSet = null; @@ -3521,7 +3520,7 @@ getResultSize(query: Query, callback: AsyncCallback<number>): void **示例** -``` +```js let kvStore; try { let entries = []; @@ -3572,7 +3571,7 @@ getResultSize(query: Query): Promise<number> **示例** -``` +```js let kvStore; try { let entries = []; @@ -3622,7 +3621,7 @@ removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void **示例** -``` +```js let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; const VALUE_TEST_STRING_ELEMENT = 'value-string-002'; @@ -3669,7 +3668,7 @@ removeDeviceData(deviceId: string): Promise<void> **示例** -``` +```js let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; const VALUE_TEST_STRING_ELEMENT = 'value-string-001'; @@ -3749,7 +3748,7 @@ off(event: 'syncComplete', syncCallback?: Callback<Array<[string, number]& **示例** -``` +```js let kvStore; try { const func = function (data) { @@ -3768,6 +3767,7 @@ try { sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void 在手动模式下,触发数据库同步,此方法为同步方法。 + **需要权限**: ohos.permission.DISTRIBUTED_DATASYNC。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -3782,7 +3782,7 @@ sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void **示例**: -``` +```js let kvStore; kvStore.sync('deviceIds', distributedData.SyncMode.PULL_ONLY, 1000); ``` @@ -3804,7 +3804,7 @@ setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback<void>) **示例** -``` +```js let kvStore; try { const defaultAllowedDelayMs = 500; @@ -3840,7 +3840,7 @@ setSyncParam(defaultAllowedDelayMs: number): Promise<void> **示例** -``` +```js let kvStore; try { const defaultAllowedDelayMs = 500; @@ -3871,7 +3871,7 @@ getSecurityLevel(callback: AsyncCallback<SecurityLevel>): void **示例** -``` +```js let kvStore; try { kvStore.getSecurityLevel(function (err,data) { @@ -3899,7 +3899,7 @@ getSecurityLevel(): Promise<SecurityLevel> **示例** -``` +```js let kvStore; try { kvStore.getSecurityLevel().then((data) => { @@ -3915,7 +3915,7 @@ try { ## DeviceKVStore8+ ## -在分布式系统中按设备管理分布式数据,继承自KvStore,提供查询数据和同步数据的方法。在调用DeviceKVStore的方法前,需要先通过getKVStore构建一个DeviceKVStore实例。 +在分布式系统中按设备管理分布式数据,继承自KVStore,提供查询数据和同步数据的方法。在调用DeviceKVStore的方法前,需要先通过[getKVStore](#getkvstore)构建一个DeviceKVStore实例。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore。 @@ -3937,7 +3937,7 @@ get(deviceId: string, key: string, callback: AsyncCallback<boolean|string|num **示例** -``` +```js let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; const VALUE_TEST_STRING_ELEMENT = 'value-string-002'; @@ -3977,7 +3977,7 @@ get(deviceId: string, key: string): Promise<boolean|string|number|Uint8Array& **示例** -``` +```js let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; const VALUE_TEST_STRING_ELEMENT = 'value-string-002'; @@ -4016,7 +4016,7 @@ getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback<Entry **示例** -``` +```js let kvStore; try { let entries = []; @@ -4069,7 +4069,7 @@ getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]> **示例** -``` +```js let kvStore; try { let entries = []; @@ -4122,7 +4122,7 @@ getEntries(query: Query, callback: AsyncCallback<Entry[]>): void **示例** -``` +```js let kvStore; try { var arr = new Uint8Array([21,31]); @@ -4180,7 +4180,7 @@ getEntries(query: Query): Promise<Entry[]> **示例** -``` +```js let kvStore; try { var arr = new Uint8Array([21,31]); @@ -4234,7 +4234,7 @@ getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]> **示例** -``` +```js let kvStore; try { var arr = new Uint8Array([21,31]); @@ -4293,7 +4293,7 @@ getEntries(deviceId: string, query: Query): Promise<Entry[]> **示例** -``` +```js let kvStore; try { var arr = new Uint8Array([21,31]); @@ -4348,7 +4348,7 @@ getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback<KvS **示例** -``` +```js let kvStore; try { let resultSet; @@ -4388,7 +4388,7 @@ getResultSet(deviceId: string, keyPrefix: string): Promise<KvStoreResultSet&g **示例** -``` +```js let kvStore; try { let resultSet; @@ -4426,7 +4426,7 @@ getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): voi **示例** -``` +```js let kvStore; try { let resultSet; @@ -4483,7 +4483,7 @@ getResultSet(query: Query): Promise<KvStoreResultSet> **示例** -``` +```js let kvStore; try { let resultSet; @@ -4543,7 +4543,7 @@ getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KvStoreR **示例** -``` +```js let kvStore; try { let resultSet; @@ -4600,7 +4600,7 @@ getResultSet(deviceId: string, query: Query): Promise<KvStoreResultSet> **示例** -``` +```js let kvStore; try { let resultSet; @@ -4660,7 +4660,7 @@ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>) **示例** -``` +```js let kvStore; try { console.log('CloseResultSet success'); @@ -4700,7 +4700,7 @@ closeResultSet(resultSet: KvStoreResultSet): Promise<void> **示例** -``` +```js let kvStore; try { console.log('CloseResultSet success'); @@ -4733,7 +4733,7 @@ getResultSize(query: Query, callback: AsyncCallback<number>): void **示例** -``` +```js let kvStore; try { let entries = []; @@ -4785,7 +4785,7 @@ getResultSize(query: Query): Promise<number> **示例** -``` +```js let kvStore; try { let entries = []; @@ -4837,7 +4837,7 @@ getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number& **示例** -``` +```js let kvStore; try { let entries = []; @@ -4889,7 +4889,7 @@ getResultSize(deviceId: string, query: Query): Promise<number> **示例** -``` +```js let kvStore; try { let entries = []; @@ -4939,7 +4939,7 @@ removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void **示例** -``` +```js let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-string-001'; @@ -4986,7 +4986,7 @@ removeDeviceData(deviceId: string): Promise<void> **示例** -``` +```js let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-string-001'; @@ -5018,6 +5018,7 @@ try { sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void 在手动模式下,触发数据库同步,此方法为同步方法。 + **需要权限**: ohos.permission.DISTRIBUTED_DATASYNC。 **系统能力**: SystemCapability.DistributedDataManager.KVStore.Core。 @@ -5032,7 +5033,7 @@ sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void **示例** -``` +```js let kvStore; const KEY_TEST_SYNC_ELEMENT = 'key_test_sync'; const VALUE_TEST_SYNC_ELEMENT = 'value-string-001'; @@ -5068,7 +5069,7 @@ on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]> **示例** -``` +```js const KEY_TEST_FLOAT_ELEMENT = 'key_test_float'; const VALUE_TEST_FLOAT_ELEMENT = 321.12; try { @@ -5103,7 +5104,7 @@ off(event: 'syncComplete', syncCallback?: Callback<Array<[string, number]& **示例** -``` +```js let kvStore; try { const func = function (data) { diff --git a/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md b/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md index 9a6c4a2c672cf5e6ce75fc133c5b6b8bb2a08eec..c625350499c909413c96d3fcdc33d641b7acb9a6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-featureAbility.md @@ -380,7 +380,7 @@ getWant(callback: AsyncCallback\): void | 名称 | 类型 | 必填 | 描述 | | -------- | ----------------------------- | ---- | --------- | -| callback | AsyncCallback\<[Want](#want)> | 是 | 被指定的回调方法。 | +| callback | AsyncCallback\<[Want](js-apis-application-Want.md)> | 是 | 被指定的回调方法。 | **示例:** @@ -403,7 +403,7 @@ getWant(): Promise\ | 类型 | 说明 | | ----------------------- | ---------------- | -| Promise\<[Want](#want)> | 以Promise的形式返回结果。 | +| Promise\<[Want](js-apis-application-Want.md)> | 以Promise的形式返回结果。 | **示例:** @@ -496,7 +496,7 @@ connectAbility(request: Want, options:ConnectOptions): number | 名称 | 类型 | 必填 | 描述 | | ------- | -------------- | ---- | --------------------- | -| request | [Want](#want) | 是 | 表示被连接的ServiceAbility。 | +| request | [Want](js-apis-application-Want.md) | 是 | 表示被连接的ServiceAbility。 | | options | ConnectOptions | 是 | 被指定的回调方法。 | **Want类型说明:** @@ -902,7 +902,7 @@ featureAbility.AbilityStartSetting.BOUNDS_KEY | 名称 | 读写属性 | 类型 | 必填 | 描述 | | ----------------------- | ---- | ------------- | ---- | ------------------------------------- | | resultCode7+ | 只读 | number | 是 | 指示销毁该能力后返回的结果代码。您可以定义结果代码来识别错误(暂不支持)。 | -| want7+ | 只读 | [Want](#want) | 否 | 指示销毁该能力后返回的数据。您可以定义返回的数据。此参数可以为null。 | +| want7+ | 只读 | [Want](js-apis-application-Want.md) | 否 | 指示销毁该能力后返回的数据。您可以定义返回的数据。此参数可以为null。 | ## StartAbilityParameter @@ -910,27 +910,9 @@ featureAbility.AbilityStartSetting.BOUNDS_KEY | 名称 | 读写属性 | 类型 | 必填 | 描述 | | ------------------- | ---- | -------------------- | ---- | -------------------------------------- | -| want | 只读 | [Want](#want) | 是 | 表示需要包含有关目标启动能力的信息。 | +| want | 只读 | [Want](js-apis-application-Want.md) | 是 | 表示需要包含有关目标启动能力的信息。 | | abilityStartSetting | 只读 | {[key: string]: any} | 否 | 表示能力的特殊属性,当开发者启动能力时,该属性可以作为调用中的输入参数传递。 | - - -## Want - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityBase - -| 名称 | 读写属性 | 类型 | 必填 | 描述 | -| -------------------------------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | -| deviceId | 只读 | string | 否 | 表示运行指定Ability的设备ID。 | -| bundleName | 只读 | string | 否 | 表示包描述。| -| abilityName | 只读 | string | 否 | 表示待启动的Ability名称。如果在Want中该字段同时指定了package和AbilityName,则Want可以直接匹配到指定的Ability。 | -| uri | 只读 | string | 否 | 表示Uri描述。如果在Want中指定了Uri,则Want将匹配指定的Uri信息,包括scheme, schemeSpecificPart, authority和path信息。 | -| type | 只读 | string | 否 | 表示MIME type类型描述,比如:"text/plain" 、 "image/*"等。 | -| flags | 只读 | number | 否 | 表示处理Want的方式。默认传数字,具体参考:[flags说明](#flags说明)。 | -| action | 只读 | string | 否 | 表示action选项描述。 | -| parameters | 只读 | {[key: string]: any} | 否 | 表示WantParams描述。 | -| entities | 只读 | Array\ | 否 | 表示entities相关描述。 | -| extensionAbilityName9+ | 只读 | string | 否 | Want中扩展能力名称的描述。 | -| extensionAbilityType9+ | 只读 | number | 否 | Want中扩展能力类型的描述。 | + | ## flags说明 diff --git a/zh-cn/application-dev/reference/apis/js-apis-formextension.md b/zh-cn/application-dev/reference/apis/js-apis-formextension.md index d549c1e4651bb39f074ddb6add65c29910626da4..5062f58bf778060f1a3aaff6fb005df79f101c20 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-formextension.md +++ b/zh-cn/application-dev/reference/apis/js-apis-formextension.md @@ -35,7 +35,7 @@ onCreate(want: Want): formBindingData.FormBindingData | 参数名 | 类型 | 必填 | 说明 | | ------ | -------------------------------------- | ---- | ------------------------------------------------------------ | - | want | [Want](js-apis-featureAbility.md#want) | 是 | 当前Extension相关的Want类型信息,包括卡片ID、卡片名称、卡片样式等。这些卡片信息必须作为持久数据进行管理,以便后续更新和删除卡片。 | + | want | [Want](js-apis-application-Want.md) | 是 | 当前Extension相关的Want类型信息,包括卡片ID、卡片名称、卡片样式等。这些卡片信息必须作为持久数据进行管理,以便后续更新和删除卡片。 | **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-formhost.md b/zh-cn/application-dev/reference/apis/js-apis-formhost.md index 3799a2fdf4622c2f72aeb918ea55c306d0109e41..8f5897902e0bac6fdc59f693c171c8a24a98c8d1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-formhost.md +++ b/zh-cn/application-dev/reference/apis/js-apis-formhost.md @@ -780,7 +780,7 @@ SystemCapability.Ability.Form | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------- | -| want | [Want](js-apis-featureAbility.md#want) | 是 | 查询卡片状态时携带的want信息 | +| want | [Want](js-apis-application-Want.md) | 是 | 查询卡片状态时携带的want信息 | | callback | AsyncCallback<[FormStateInfo](js-apis-formInfo.md#formstateinfo)> | 是 | callback形式返回卡片状态 | **示例:** @@ -808,7 +808,7 @@ function acquireFormState(want: Want): Promise<FormStateInfo>; | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------- | -| want | [Want](js-apis-featureAbility.md#want) | 是 | 查询卡片状态时携带的want信息 | +| want | [Want](js-apis-application-Want.md) | 是 | 查询卡片状态时携带的want信息 | **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-image.md b/zh-cn/application-dev/reference/apis/js-apis-image.md index b51c3585d6d882e09cf5ca5303ad9aefd936b3e1..1ab731a2d00798ba91b66859f6c8781f5bfbc9e1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-image.md +++ b/zh-cn/application-dev/reference/apis/js-apis-image.md @@ -66,9 +66,11 @@ image.createPixelMap(Color, opts, (pixelmap) => { ### 属性 -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ----------------------- | ------- | ---- | ---- | ------------------------------------------------------------ | -| isEditable7+ | boolean | 是 | 否 | 设定是否图像像素可被编辑。
**系统能力:** SystemCapability.Multimedia.Image | +**系统能力: ** SystemCapability.Multimedia.Image + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------------------- | ------- | ---- | ---- | -------------------------- | +| isEditable7+ | boolean | 是 | 否 | 设定是否图像像素可被编辑。 | ### readPixelsToBuffer7+ @@ -514,9 +516,11 @@ const imageSourceApi = image.createImageSource(0) ### 属性 +**系统能力: ** SystemCapability.Multimedia.Image + | 名称 | 类型 | 可读 | 可写 | 说明 | | ---------------- | -------------- | ---- | ---- | ------------------------------------------------------------ | -| supportedFormats | Array\ | 是 | 否 | 支持的图片格式,包括:png,jpeg,wbmp,bmp,gif,webp,heif等。
**系统能力:** SystemCapability.Multimedia.Image | +| supportedFormats | Array\ | 是 | 否 | 支持的图片格式,包括:png,jpeg,wbmp,bmp,gif,webp,heif等。 | ### getImageInfo @@ -793,9 +797,11 @@ const imagePackerApi = image.createImagePacker(); ### 属性 -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ---------------- | -------------- | ---- | ---- | ------------------------------------------------------------ | -| supportedFormats | Array\ | 是 | 否 | 图片打包支持的格式,jpeg。
**系统能力:** SystemCapability.Multimedia.Image | +**系统能力: ** SystemCapability.Multimedia.Image + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---------------- | -------------- | ---- | ---- | -------------------------- | +| supportedFormats | Array\ | 是 | 否 | 图片打包支持的格式,jpeg。 | ### packing @@ -883,10 +889,10 @@ packing(source: PixelMap, option: PackingOption): Promise> **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------------------------------- | ---- | -------------- | +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------------------------------- | ---- | ------------------ | | source | [PixelMap](#pixelmap) | 是 | 打包的PixelMap源。 | -| option | [PackingOption](#packingoption) | 是 | 设置打包参数。 | +| option | [PackingOption](#packingoption) | 是 | 设置打包参数。 | **返回值:** @@ -944,24 +950,357 @@ release(): Promise\ }).catch((error)=>{}) ``` +## image.createImageReceiver9+ + + createImageReceiver(width: number, height: number, format: number, capacity: number): ImageReceiver + +通过宽、高、图片格式、容量创建imagereceiver实例。 + +**系统能力: ** SystemCapability.Multimedia.Image.ImageReceiver + +**参数:** + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------- | +| width | number | 是 | imagereceiver将生成的图像的默认宽度。 | +| height | number | 是 | imagereceiver将生成的图像的默认高度。 | +| format | number | 是 | imagereceiver将生成的图像格式。 | +| capacity | number | 是 | 同时访问的最大图像数。 | + +**返回值:** + +| 类型 | 说明 | +| ------------- | ----------------------------------------- | +| ImageReceiver | 如果操作成功,则返回 ImageReceiver 实例。 | + +**示例:** + +```js +var receiver = image.createImageReceiver(8192, 8, 4, 8) +``` + +## ImageReceiver9+ + +图像接收类,用于获取组件surface id,接收最新的图片和读取下一张图片,以及释放 ImageReceiver 实例。在调用各方法前需要先创建 ImageReceiver 实例。 + +### 属性 + +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.ImageReceiver + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | ---------------------------- | ---- | ---- | ------------------ | +| size | [Size](#size) | 是 | 否 | 图片大小。 | +| capacity | number | 是 | 否 | 同时访问的图像数。 | +| format | [ImageFormat](#imageformat9) | 是 | 否 | 图像格式。 | + +### getReceivingSurfaceId9+ + +getReceivingSurfaceId(callback: AsyncCallback\): void + +用于获取一个surface id并使用callback返回结果。 + +**系统能力: ** SystemCapability.Multimedia.Image.ImageReceiver + +**参数:** + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | ---------------------------- | +| callback | AsyncCallback\ | 是 | 使用callback返回surface id。 | + +**示例:** + +```js + receiver.getReceivingSurfaceId((err, id) => {}); +``` + +### getReceivingSurfaceId9+ + +getReceivingSurfaceId(): Promise\ + +用于获取一个surface id并使用promise返回结果。 + +**系统能力: ** SystemCapability.Multimedia.Image.ImageReceiver + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------- | +| Promise\ | 异步返回surface id。 | + +**示例:** + +```js +receiver.getReceivingSurfaceId().then( id => { + }).catch(error => { + }) +``` + +### readLatestImage9+ + +readLatestImage(callback: AsyncCallback\): void + +从 ImageReceiver读取最新的图片,并使用callback返回结果。 + +**系统能力: ** SystemCapability.Multimedia.Image.ImageReceiver + +**参数:** + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ------------------------------- | ---- | ---------------------- | +| callback | AsyncCallback<[Image](#image8)> | 是 | callback返回最新图像。 | + +**示例:** + +```js + receiver.readLatestImage((err, img) => { }); +``` + +### readLatestImage9+ + +readLatestImage(): Promise\ + +从 ImageReceiver读取最新的图片,并使用promise返回结果。 + +**系统能力: ** SystemCapability.Multimedia.Image.ImageReceiver + +**返回值:** + +| 类型 | 说明 | +| ------------------------- | ------------------ | +| Promise<[Image](#image8)> | 异步返回最新图片。 | + +**示例:** + +```js +receiver.readLatestImage().then(img => {}) + .catch(error => {}) +``` + +### readNextImage9+ + +readNextImage(callback: AsyncCallback\): void + +从 ImageReceiver读取下一张图片,并使用callback返回结果。 + +**系统能力: ** SystemCapability.Multimedia.Image.ImageReceiver + +**参数:** + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ------------------------------- | ---- | ------------------------ | +| callback | AsyncCallback<[Image](#image8)> | 是 | callback返回下一张图片。 | + +**示例:** + +```js +receiver.readNextImage((err, img) => {}); +``` + +### readNextImage9+ + +readNextImage(): Promise\ + +从 ImageReceiver读取下一张图片,并使用promise返回结果。 + +**系统能力: ** SystemCapability.Multimedia.Image.ImageReceiver + +**返回值:** + +| 类型 | 说明 | +| ------------------------- | -------------------- | +| Promise<[Image](#image8)> | 异步返回下一张图片。 | + +**示例:** + +```js + receiver.readNextImage().then(img => { + }).catch(error => { + }) +``` + +### on9+ + +on(type: 'imageArrival', callback: AsyncCallback\): void + +接收图片时注册回调。 + +**系统能力: ** SystemCapability.Multimedia.Image.ImageReceiver + +**参数:** + +| 名称 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | ------------------------------------------------------ | +| type | imageArrival | 是 | 注册事件的类型,固定为'imageArrival',接收图片时触发。 | +| callback | AsyncCallback\ | 是 | 注册的事件回调。 | + +**示例:** + +```js + receiver.on('imageArrival', () => {}) +``` + +### release9+ + + release(callback: AsyncCallback\): void + +释放ImageReceiver实例并使用回调返回结果。 + +**系统能力: ** SystemCapability.Multimedia.Image.ImageReceiver + +**参数:** + +| 名称 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------- | +| callback | AsyncCallback\ | 是 | 返回操作结果。 | + +**示例:** + +```js + receiver.release(() => {}) +``` + +### release9+ + +release(): Promise\ + +释放ImageReceiver实例并使用promise返回结果。 + +**系统能力: ** SystemCapability.Multimedia.Image.ImageReceiver + +**返回值:** + +| 类型 | 说明 | +| -------------- | ----------------------- | +| Promise\ | 用promise返回操作结果。 | + +**示例:** + +```js + receiver.release().then(() => {}) + .catch(error => {}) +``` + +## Image9+ + +提供基本的图像操作,包括获取图像信息、读写图像数据。调用readNextImage和readLatestImage接口时会返回image。 + +### 属性 + +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Core + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | ------------------ | ---- | ---- | ---------------------------- | +| clipRect | [Region](#region8) | 是 | 是 | 设置或获取要裁剪的图像区域。 | +| size | [Size](#size) | 是 | 否 | 图像大小。 | +| format | number | 是 | 否 | 图像格式。 | + +### getComponent9+ + +getComponent(componentType: ComponentType, callback: AsyncCallback\): void + +根据图像的组件类型从图像中获取组件缓存并使用callback返回结果。 + +**系统能力: ** SystemCapability.Multimedia.Image.Core + +**参数:** + +| 名称 | 类型 | 必填 | 说明 | +| ------------- | --------------------------------------- | ---- | -------------------- | +| componentType | [ComponentType](#componenttype8) | 是 | 图像的组件类型。 | +| callback | AsyncCallback<[Component](#component8)> | 是 | 用于返回组件缓冲区。 | + +**示例:** + +```js + img.getComponent(4, (err, component) => {}) +``` + +### getComponent9+ + +getComponent(componentType: ComponentType): Promise\ + +根据图像的组件类型从图像中获取组件缓存并使用promise方式返回结果。 + +**系统能力: ** SystemCapability.Multimedia.Image.Core + +**参数:** + +| 名称 | 类型 | 必填 | 说明 | +| ------------- | -------------------------------- | ---- | ---------------- | +| componentType | [ComponentType](#componenttype8) | 是 | 图像的组件类型。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | --------------------------------- | +| Promise<[Component](#component8)> | 用于返回组件缓冲区的promise实例。 | + +**示例:** + +```js +img.getComponent(4).then(component => { }) +``` + +### release9+ + +release(callback: AsyncCallback\): void + +释放当前图像并使用callback返回结果。在接收另一个图像前必须先释放对应资源。 + +**系统能力: ** SystemCapability.Multimedia.Image.Core + +**参数:** + +| 名称 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------- | +| callback | AsyncCallback\ | 是 | 返回操作结果。 | + +**示例:** + +```js +img.release(() =>{ }) +``` + +### release9+ + +release(): Promise\ + +释放当前图像并使用promise返回结果。在接收另一个图像前必须先释放对应资源。 + +**系统能力: ** SystemCapability.Multimedia.Image.Core + +**返回值:** + +| 类型 | 说明 | +| -------------- | --------------------- | +| Promise\ | promise返回操作结果。 | + +**示例:** + +```js +img.release().then(() =>{ + }).catch(error => { + }) +``` + ## PositionArea7+ 表示图片指定区域内的数据。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image | 名称 | 类型 | 可读 | 可写 | 说明 | | ------ | ------------------ | ---- | ---- | ------------------------------------------------------------ | | pixels | ArrayBuffer | 是 | 否 | 像素。 | | offset | number | 是 | 否 | 偏移量。 | -| stride | number | 是 | 否 | 像素间距,stride >= region.size.width*4。 | +| stride | number | 是 | 否 | 像素间距,stride >= region.size.width*4。 | | region | [Region](#region8) | 是 | 否 | 区域,按照区域读写。写入的区域宽度加X坐标不能大于原图的宽度,写入的区域高度加Y坐标不能大于原图的高度 | ## ImageInfo 表示图片信息。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image | 名称 | 类型 | 可读 | 可写 | 说明 | | ---- | ------------- | ---- | ---- | ---------- | @@ -971,7 +1310,7 @@ release(): Promise\ 表示图片尺寸。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image | 名称 | 类型 | 可读 | 可写 | 说明 | | ------ | ------ | ---- | ---- | -------------- | @@ -982,7 +1321,7 @@ release(): Promise\ 枚举,像素格式。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image | 名称 | 默认值 | 描述 | | --------- | ------ | ----------------- | @@ -994,7 +1333,7 @@ release(): Promise\ 枚举,透明度。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image | 名称 | 默认值 | 描述 | | -------- | ------ | ----------------------- | @@ -1007,7 +1346,7 @@ release(): Promise\ 枚举,缩略值。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image | 名称 | 默认值 | 描述 | | --------------- | ------ | -------------------------------------------------- | @@ -1016,21 +1355,21 @@ release(): Promise\ ## InitializationOptions8+ -**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ----------- | ---------------------------------- | ---- | ---- | -------------- | -| alphaType9+ | [AlphaType](#alphatype9) | 是 | 是 | 透明度。 | -| editable | boolean | 是 | 是 | 是否可编辑。 | -| pixelFormat | [PixelMapFormat](#pixelmapformat7) | 是 | 是 | 像素格式。 | -| scaleMode9+ | [ScaleMode](#scalemode9) | 是 | 是 | 缩略值。 | -| size | [Size](#size) | 是 | 是 | 创建图片大小。 | +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---------------------- | ---------------------------------- | ---- | ---- | -------------- | +| alphaType9+ | [AlphaType](#alphatype9) | 是 | 是 | 透明度。 | +| editable | boolean | 是 | 是 | 是否可编辑。 | +| pixelFormat | [PixelMapFormat](#pixelmapformat7) | 是 | 是 | 像素格式。 | +| scaleMode9+ | [ScaleMode](#scalemode9) | 是 | 是 | 缩略值。 | +| size | [Size](#size) | 是 | 是 | 创建图片大小。 | ## DecodingOptions7+ 解码设置选项。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image | 名称 | 类型 | 可读 | 可写 | 说明 | | ------------------ | ---------------------------------- | ---- | ---- | ---------------- | @@ -1038,15 +1377,15 @@ release(): Promise\ | rotate | number | 是 | 是 | 旋转角度。 | | editable | boolean | 是 | 是 | 是否可编辑。 | | desiredSize | [Size](#size) | 是 | 是 | 期望输出大小。 | -| desiredRegion | [Region](#region7) | 是 | 是 | 解码区域。 | +| desiredRegion | [Region](#region8) | 是 | 是 | 解码区域。 | | desiredPixelFormat | [PixelMapFormat](#pixelmapformat7) | 是 | 是 | 解码的像素格式。 | | index | numer | 是 | 是 | 解码图片序号 | -## Region7+ +## Region8+ 表示区域信息。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image | 名称 | 类型 | 可读 | 可写 | 说明 | | ---- | ------------- | ---- | ---- | ------------ | @@ -1058,7 +1397,7 @@ release(): Promise\ 表示图片打包选项。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image | 名称 | 类型 | 可读 | 可写 | 说明 | | ------- | ------ | ---- | ---- | -------------- | @@ -1069,7 +1408,7 @@ release(): Promise\ 表示查询图片属性的索引。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image | 名称 | 类型 | 可读 | 可写 | 说明 | | ------------ | ------ | ---- | ---- | ------------ | @@ -1080,7 +1419,7 @@ release(): Promise\ 枚举,Exif(Exchangeable image file format)图片信息。 -**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image | 名称 | 默认值 | 说明 | | ----------------- | ----------------- | -------------------- | @@ -1093,3 +1432,40 @@ release(): Promise\ | GPS_LATITUDE_REF | "GPSLatitudeRef" | 纬度引用,例如N或S。 | | GPS_LONGITUDE_REF | "GPSLongitudeRef" | 经度引用,例如W或E。 | +## ImageFormat9+ + +枚举,图片格式。 + +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Core + +| 名称 | 默认值 | 描述 | +| ------------ | ------ | --------------------- | +| YCBCR_422_SP | 1000 | YCBCR422 半平面格式。 | +| JPEG | 2000 | JPEG编码格式。 | + +## ComponentType8+ + +枚举,图像的组件类型。 + +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.ImageReceiver + +| 名称 | 默认值 | 描述 | +| ----- | ------ | ----------- | +| YUV_Y | 1 | 亮度信息。 | +| YUV_U | 2 | 色度信息。 | +| YUV_V | 3 | 色度信息。 | +| JPEG | 4 | Jpeg 类型。 | + +## Component8+ + +描述图像颜色分量。 + +**系统能力: ** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Core + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------- | -------------------------------- | ---- | ---- | ------------ | +| componentType | [ComponentType](#componenttype8) | 是 | 否 | 组件类型。 | +| rowStride | number | 是 | 否 | 行距。 | +| pixelStride | number | 是 | 否 | 像素间距。 | +| byteBuffer | ArrayBuffer | 是 | 否 | 组件缓冲区。 | + diff --git a/zh-cn/application-dev/reference/apis/js-apis-missionManager.md b/zh-cn/application-dev/reference/apis/js-apis-missionManager.md index a079589d527ff4ab9c038d786733765c603563d6..e7f9e4bf1efe1aa4e5ecafb980260d884814fe54 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-missionManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-missionManager.md @@ -697,7 +697,7 @@ moveMissionToFront(missionId: number, options?: StartOptions): Promise<void&g | runningState | number | 是 | 是 | 表示运行状态。 | | lockedState | boolean | 是 | 是 | 表示锁定状态。 | | timestamp | string | 是 | 是 | 表示任务的最近创建或更新时间。 | -| want | [Want](js-apis-featureAbility.md#want) | 是 | 是 | 表示任务的Want信息。 | +| want | [Want](js-apis-application-Want.md) | 是 | 是 | 表示任务的Want信息。 | | label | string | 是 | 是 | 表示任务的标签。 | | iconPath | string | 是 | 是 | 表示任务的图标路径。 | | continuable | boolean | 是 | 是 | 表示任务是否可以继续。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-particleAbility.md b/zh-cn/application-dev/reference/apis/js-apis-particleAbility.md index 2a3dcf3e4f26de393aade74012bc178b4d53e407..25eb1e8ed5b5461ea11daa7feb11549226282422 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-particleAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-particleAbility.md @@ -384,7 +384,7 @@ connectAbility(request: Want, options:ConnectOptions): number | 名称 | 类型 | 必填 | 描述 | | ------- | -------------- | ---- | ---------------------------- | -| request | [Want](js-apis-featureAbility.md#want) | 是 | 表示被连接的ServiceAbility。 | +| request | [Want](js-apis-application-Want.md) | 是 | 表示被连接的ServiceAbility。 | | options | ConnectOptions | 是 | 被指定的回调方法。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md b/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md index ce2e8f8c264eaec822e89098ed321c475041cad4..ad06f77d6c56e4602f91a814a4c87a87bf5373fa 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md +++ b/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @@ -88,7 +88,7 @@ createWantData(want:Want): PasteData **参数** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| want | [Want](js-apis-featureAbility.md#want) | 是 | 待保存的Want内容。 | +| want | [Want](js-apis-application-Want.md) | 是 | 待保存的Want内容。 | **返回值** | 类型 | 说明 | @@ -193,7 +193,7 @@ createWantRecord(want:Want): PasteDataRecord **参数** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| want | [Want](js-apis-featureAbility.md#want) | 是 | Want类型数据。 | +| want | [Want](js-apis-application-Want.md) | 是 | Want类型数据。 | **返回值** | 类型 | 说明 | @@ -263,7 +263,7 @@ createUriRecord(uri:string): PasteDataRecord | 名称 | 参数类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- | -------- | | htmlText7+ | string | 是 | 否 | HTML文本内容。 | -| want7+ | [Want](js-apis-featureAbility.md#want) | 是 | 否 | Want文本内容。 | +| want7+ | [Want](js-apis-application-Want.md) | 是 | 否 | Want文本内容。 | | mimeType7+ | string | 是 | 否 | 数据类型。 | | plainText7+ | string | 是 | 否 | 文本内容。 | | uri7+ | string | 是 | 否 | URI内容。 | @@ -385,7 +385,7 @@ getPrimaryWant(): Want **返回值** | 类型 | 说明 | | -------- | -------- | -| [Want](js-apis-featureAbility.md#want) | Want对象内容。 | +| [Want](js-apis-application-Want.md) | Want对象内容。 | **示例** @@ -480,7 +480,7 @@ addWantRecord(want: Want): void **参数** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| want | [Want](js-apis-featureAbility.md#want) | 是 | Want对象内容。 | +| want | [Want](js-apis-application-Want.md) | 是 | Want对象内容。 | **示例** diff --git a/zh-cn/application-dev/reference/apis/js-apis-window.md b/zh-cn/application-dev/reference/apis/js-apis-window.md index 0dd2a18a7f4664fd1e14b8ff6eaeb941708b815f..49f11cd7164cad101a514e77067813e898d8e47d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-window.md +++ b/zh-cn/application-dev/reference/apis/js-apis-window.md @@ -10,7 +10,7 @@ import window from '@ohos.window'; ``` -## WindowType7+ +## WindowType7+ 窗口类型。 @@ -21,7 +21,7 @@ import window from '@ohos.window'; | TYPE_APP | 0 | 表示应用子窗口。 | | TYPE_SYSTEM_ALERT | 1 | 表示系统告警窗口。 | -## AvoidAreaType7+ +## AvoidAreaType7+ 窗口内容需要规避区域的类型。 @@ -32,7 +32,7 @@ import window from '@ohos.window'; | TYPE_SYSTEM | 0 | 表示系统默认区域。 | | TYPE_CUTOUT | 1 | 表示刘海屏区域。 | -## WindowMode7+ +## WindowMode7+ 窗口模式。 @@ -48,7 +48,7 @@ import window from '@ohos.window'; | SECONDARY | 4 | 表示APP分屏多窗口次要模式。 | | FLOATING | 5 | 表示APP自由悬浮形式窗口模式。 | -## SystemBarProperties +## SystemBarProperties 状态栏导航栏的属性。 @@ -63,7 +63,7 @@ import window from '@ohos.window'; | isNavigationBarLightIcon7+ | boolean | 否 | 否 | 导航栏图标是否为高亮状态。 | | navigationBarContentColor8+ | string | 否 | 是 | 导航栏文字颜色。 | -## SystemBarRegionTint 8+ +## SystemBarRegionTint8+ 单个导航栏或状态栏回调信息。 @@ -79,7 +79,7 @@ import window from '@ohos.window'; | backgroundColor | string | 是 | 是 | 系统栏背景颜色,为16进制RGB或ARGB颜色,例如"\#00FF00"或"\#FF00FF00"。 | | contentColor | string | 是 | 是 | 系统栏文字颜色。 | -## SystemBarTintState 8+ +## SystemBarTintState8+ 当前系统栏回调信息集合。 @@ -87,12 +87,12 @@ import window from '@ohos.window'; **系统能力**:以下各项对应的系统能力均为SystemCapability.WindowManager.WindowManager.Core。 -| 名称 | 参数类型 | 可读 | 可写 | 说明 | -| ---------- | -------------------------------------------------- | ---- | ---- | -------------------------- | -| displayId | number | 是 | 否 | 当前物理屏幕id。 | -| regionTint | Array<[SystemBarRegionTint](#systembartegiontint)> | 是 | 是 | 当前改变所有的系统栏信息。 | +| 名称 | 参数类型 | 可读 | 可写 | 说明 | +| ---------- | --------------------------------------------------- | ---- | ---- | -------------------------- | +| displayId | number | 是 | 否 | 当前物理屏幕id。 | +| regionTint | Array<[SystemBarRegionTint](#systembarregiontint8)> | 是 | 是 | 当前改变所有的系统栏信息。 | -## Rect7+ +## Rect7+ 矩形。 @@ -105,7 +105,7 @@ import window from '@ohos.window'; | width | number | 是 | 是 | 矩形区域的宽度。 | | height | number | 是 | 是 | 矩形区域的高度。 | -## AvoidArea7+ +## AvoidArea7+ 表示窗口内容规避区域。 @@ -118,7 +118,7 @@ import window from '@ohos.window'; | rightRect | [Rect](#rect) | 是 | 是 | 屏幕右侧的矩形区。 | | bottomRect | [Rect](#rect) | 是 | 是 | 屏幕底部的矩形区。 | -## Size7+ +## Size7+ 窗口大小。 @@ -129,7 +129,7 @@ import window from '@ohos.window'; | width | number | 是 | 是 | 窗口宽度。 | | height | number | 是 | 是 | 窗口高度。 | -## WindowProperties +## WindowProperties 窗口属性。 @@ -147,10 +147,10 @@ import window from '@ohos.window'; | dimBehindValue7+ | number | 是 | 是 | 靠后窗口的暗度值,取值范围为0~1,1表示最暗。
本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。接口将在OpenHarmony 3.1 MR版本中提供使用支持。 | | isKeepScreenOn | boolean | 是 | 是 | 屏幕是否常亮,默认为false。
本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。接口将在OpenHarmony 3.1 MR版本中提供使用支持。 | | isPrivacyMode7+ | boolean | 是 | 是 | 隐私模式,默认为false。
本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。接口将在OpenHarmony 3.1 MR版本中提供使用支持。 | -| isRoundCorner7+ | boolean | 是 | 是 | 窗口是否为圆角。
本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。接口将在OpenHarmony 3.1 MR版本中提供使用支持。 | +| isRoundCorner7+ | boolean | 是 | 是 | 窗口是否为圆角。默认为false。
本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。接口将在OpenHarmony 3.1 MR版本中提供使用支持。 | | isTransparent7+ | boolean | 是 | 是 | 窗口是否透明。默认为false。
本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。接口将在OpenHarmony 3.1 MR版本中提供使用支持。 | -## ColorSpace8+ +## ColorSpace8+ 色域模式。 @@ -301,7 +301,7 @@ create(ctx: Context, id: string, type: WindowType): Promise<Window> }); ``` -## window.find7+ +## window.find7+ find(id: string, callback: AsyncCallback<Window>): void @@ -363,7 +363,7 @@ find(id: string): Promise<Window> }); ``` -## window.getTopWindow +## window.getTopWindow getTopWindow(callback: AsyncCallback<Window>): void @@ -494,7 +494,7 @@ on(type: 'systemBarTintChange', callback: Callback<SystemBarTintState>): v | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | - | type | string | 是 | 设置监听类型。
- type为'systemBarTintChange'时表示监听类型为导航栏、状态栏属性变化监听; | + | type | string | 是 | 监听事件,固定为'systemBarTintChange',即导航栏、状态栏属性变化事件。 | | callback | Callback<[SystemBarTintState](#systembartintstate)> | 是 | 回调返回监听到的信息。 | - 示例 @@ -520,7 +520,7 @@ off(type: 'systemBarTintChange', callback?: Callback<SystemBarTintState >) | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | - | type | string | 是 | 设置监听类型。
- type为'systemBarTintChange'时表示监听类型为导航栏、状态栏属性变化监听; | + | type | string | 是 | 监听事件,固定为'systemBarTintChange',即导航栏、状态栏属性变化事件。 | | callback | Callback<[SystemBarTintState](#systembartintstate)> | 否 | 回调返回监听到的信息。 | - 示例 @@ -532,7 +532,7 @@ off(type: 'systemBarTintChange', callback?: Callback<SystemBarTintState >) ## Window -下列API示例中都需使用[getTopWindow()](#window-gettopwindow)、[create()](#windowcreate7)、[find()](#window-find)等先获取到Window实例,再通过此实例调用对应方法。 +下列API示例中都需使用[getTopWindow()](#windowgettopwindow)、[create()](#windowcreate7)、[find()](#windowfind7)等先获取到Window实例,再通过此实例调用对应方法。 ### hide7+ @@ -1363,10 +1363,10 @@ on(type: 'windowSizeChange', callback: Callback<Size>): void - 参数 - | 参数名 | 类型 | 必填 | 说明 | - | -------- | ----------------------------- | ---- | ------------------------------------------------------------ | - | type | string | 是 | 设置监听类型。
- type为'windowSizeChange'时表示监听类型为窗口尺寸变化监听; | - | callback | Callback<[Size](#size)> | 是 | 回调返回监听到的信息。 | + | 参数名 | 类型 | 必填 | 说明 | + | -------- | ----------------------------- | ---- | -------------------------------------------------------- | + | type | string | 是 | 监听事件,固定为'windowSizeChange',即窗口尺寸变化事件。 | + | callback | Callback<[Size](#size)> | 是 | 回调返回监听到的信息。 | - 示例 @@ -1387,14 +1387,14 @@ off(type: 'windowSizeChange', callback?: Callback<Size >): void - 参数 - | 参数名 | 类型 | 必填 | 说明 | - | -------- | ----------------------------- | ---- | ------------------------------------------------------------ | - | type | string | 是 | 设置监听类型。
- type为'windowSizeChange'7+时表示监听类型为窗口尺寸变化监听; | - | callback | Callback<[Size](#size)> | 否 | 回调返回监听到的信息。 | + | 参数名 | 类型 | 必填 | 说明 | + | -------- | ----------------------------- | ---- | -------------------------------------------------------- | + | type | string | 是 | 监听事件,固定为'windowSizeChange',即窗口尺寸变化事件。 | + | callback | Callback<[Size](#size)> | 否 | 回调返回监听到的信息。 | - 示例 - ``` + ```js var type = 'windowSizeChange'; windowClass.off(type); ``` @@ -1411,7 +1411,7 @@ on(type: 'systemAvoidAreaChange', callback: Callback<AvoidArea>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | - | type | string | 是 | 设置监听类型。
- type为'systemAvoidAreaChange'时表示监听类型为系统窗口规避区变化监听。 | + | type | string | 是 | 监听事件,固定为'systemAvoidAreaChange',即系统窗口规避区变化事件。 | | callback | Callback<[AvoidArea](#avoidarea)> | 是 | 回调返回监听到的信息。 | - 示例 @@ -1435,12 +1435,12 @@ off(type: 'systemAvoidAreaChange', callback?: Callback<AvoidArea>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | - | type | string | 是 | 设置监听类型。
- type为'systemAvoidAreaChange'时表示监听类型为系统窗口规避区变化监听。 | + | type | string | 是 | 监听事件,固定为'systemAvoidAreaChange',即系统窗口规避区变化事件。 | | callback | Callback<[AvoidArea](#avoidarea)> | 否 | 回调返回监听到的信息。 | - 示例 - ``` + ```js var type = 'systemAvoidAreaChange'; windowClass.off(type); ``` @@ -1459,7 +1459,7 @@ on(type: 'keyboardHeightChange', callback: Callback<number>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------ | ---- | ------------------------------------------------------------ | - | type | string | 是 | 设置监听类型。
- type为'keyboardHeightChange'时表示监听类型为键盘高度变化监听。 | + | type | string | 是 | 监听事件,固定为'keyboardHeightChange',即键盘高度变化事件。 | | callback | Callbacknumber> | 是 | 回调返回监听到的信息。 | - 示例 @@ -1485,12 +1485,12 @@ off(type: 'keyboardHeightChange', callback?: Callback<number>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------- | ---- | ------------------------------------------------------------ | - | type | string | 是 | 设置监听类型。
- type为'keyboardHeightChange'时表示监听类型为键盘高度变化监听。 | + | type | string | 是 | 监听事件,固定为'keyboardHeightChange',即键盘高度变化事件。 | | callback | Callback<number> | 否 | 回调返回监听到的信息。 | - 示例 - ``` + ```js var type = 'keyboardHeightChange'; windowClass.off(type); ``` @@ -1537,7 +1537,7 @@ isSupportWideGamut(): Promise<boolean> - 示例 - ``` + ```js let promise = windowClass.isSupportWideGamut(); promise.then((data)=> { console.info('Succeeded in checking whether the window support WideGamut. Data: ' + JSON.stringify(data)) @@ -1577,7 +1577,7 @@ setColorSpace(colorSpace:ColorSpace, callback: AsyncCallback<void>): void setColorSpace(colorSpace:ColorSpace): Promise<void> -设置当前窗口为广色域模式或默认色域模式,使用promise方式作为异步方法。 +设置当前窗口为广色域模式或默认色域模式,使用Promise方式作为异步方法。 **系统能力**:SystemCapability.WindowManager.WindowManager.Core @@ -2165,7 +2165,7 @@ setTouchable(isTouchable: boolean): Promise<void> }); ``` -## WindowStageEventType9+ +## WindowStageEventType9+ WindowStage生命周期。 @@ -2429,7 +2429,7 @@ on(eventType: 'windowStageEvent', callback: Callback<WindowStageEventType> | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | - | type | string | 是 | 设置监听类型。
- type为'windowStageEvent'时表示监听类型为WindowStage生命周期变化监听。 | + | type | string | 是 | 监听事件,固定为'windowStageEvent',即WindowStage生命周期变化事件。 | | callback | Callback<[WindowStageEventType](#windowstageeventtype9)> | 是 | 回调返回监听到的信息。 | - 示例 @@ -2458,7 +2458,7 @@ off(eventType: 'windowStageEvent', callback?: Callback<WindowStageEventType&g | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | - | type | string | 是 | 设置监听类型。
- type为'windowStageEvent'时表示监听类型为WindowStage生命周期变化监听。 | + | type | string | 是 | 监听事件,固定为'windowStageEvent',即WindowStage生命周期变化事件。 | | callback | Callback<[WindowStageEventType](#windowstageeventtype9)> | 否 | 回调返回监听到的信息。 | - 示例 diff --git a/zh-cn/application-dev/reference/arkui-js/Readme-CN.md b/zh-cn/application-dev/reference/arkui-js/Readme-CN.md index 5053eff042adcc7395f1025b845e834cdec232e9..a9f0f78cdfb53c52bedc134a22ee7ec0b4fa2be1 100644 --- a/zh-cn/application-dev/reference/arkui-js/Readme-CN.md +++ b/zh-cn/application-dev/reference/arkui-js/Readme-CN.md @@ -94,6 +94,7 @@ - [animateTransform](js-components-svg-animatetransform.md) - 自定义组件 - [基本用法](js-components-custom-basic-usage.md) + - [继承样式](js-components-custom-style.md) - [自定义事件](js-components-custom-events.md) - [Props](js-components-custom-props.md) - [事件参数](js-components-custom-event-parameter.md) diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-custom-style.md b/zh-cn/application-dev/reference/arkui-js/js-components-custom-style.md new file mode 100644 index 0000000000000000000000000000000000000000..f23322cc30b191eb17e912941b7b5265ba68d4f7 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js/js-components-custom-style.md @@ -0,0 +1,43 @@ +# 继承样式 +> **说明:** +> 从API version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + +自定义组件具有inherit-class属性,定义如下: + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| ------------ | ------ | ------ | ---- | ------------------------------------------------------ | +| inherit-class | string | - | 否 | 从父组件继承的class样式,多个class样式之间用空格分隔。 | + +可以通过设置inherit-calss属性来继承父组件的样式。 + +父页面的hml文件,其中自定义组件comp通过inherit-class属性来指定继承其父组件的样式:parent-class1和parent-class2。 +```html + + + +
+ +
+``` + +父页面的css文件 +```html +// xxx.css +.parent-class1 { + background-color:red; + border:2px; +} +.parent-class2 { + background-color:green; + border:2px; +} +``` + +自定义组件的hml文件,其中parent-class1和parent-class2是从父组件继承的样式。 +```html + +
+ 继承父组件的样式1 + 继承父组件的样式2 +
+``` \ No newline at end of file diff --git a/zh-cn/application-dev/security/hapsigntool-guidelines.md b/zh-cn/application-dev/security/hapsigntool-guidelines.md index 0150c0f8db1c27471729e4ff06ee1b7c0bff839e..1136d3346364e029669eeb8b726346239898a968 100644 --- a/zh-cn/application-dev/security/hapsigntool-guidelines.md +++ b/zh-cn/application-dev/security/hapsigntool-guidelines.md @@ -243,7 +243,7 @@ OpenHarmony系统内置密钥库文件,文件名称为OpenHarmony.p12,内含 > **注意事项:**
1.步骤一中的密钥对算法推荐使用ECC,出于安全性考虑,应用签名暂不使用RSA算法;
- 2.建议将待签名hap包、profile文件、密钥库文件OpenHarmony.p12、根CA证书、中间CA证书、签名工具放在同一个目录下,方便操作。在**developtools_hapsigner/autosign/result**路径下,有如下文件:
- OpenHarmony密钥库文件**OpenHarmony.p12**
- 根CA证书**rootCA.cer**
- 中间CA证书**subCA.cer**
- profile签名证书**OpenHarmonyProfileRelease.pem** + 2.建议将待签名hap包、profile文件、密钥库文件OpenHarmony.p12、根CA证书、中间CA证书、签名工具放在同一个目录下,方便操作。在[**developtools_hapsigner/autosign/result**](https://gitee.com/openharmony/developtools_hapsigner/tree/master/autosign/result)路径下,有如下文件:
- OpenHarmony密钥库文件**OpenHarmony.p12**
- 根CA证书**rootCA.cer**
- 中间CA证书**subCA.cer**
- profile签名证书**OpenHarmonyProfileRelease.pem** **1.生成应用签名证书密钥对** diff --git a/zh-cn/application-dev/telephony/jumping-to-the-dial-screen.md b/zh-cn/application-dev/telephony/jumping-to-the-dial-screen.md index 77243434a73ec2063bc03c7b23519e7389f0b9c8..57428b5f6610071f34e0605b148f98643f19c7a3 100644 --- a/zh-cn/application-dev/telephony/jumping-to-the-dial-screen.md +++ b/zh-cn/application-dev/telephony/jumping-to-the-dial-screen.md @@ -5,7 +5,7 @@ ## 接口说明 -call模块为开发者提供呼叫管理功能。observer模块为开发者提供蜂窝网络状态订阅和取消订阅功能。具体接口说明如下表。 +call模块为开发者提供呼叫管理功能。observer模块为开发者提供通话业务状态订阅和取消订阅功能。具体接口说明如下表。 | 功能分类 | 接口名 | 描述 | 所需权限 | | -------- | -------- | -------- | -------- | diff --git a/zh-cn/application-dev/ui/arkui-overview.md b/zh-cn/application-dev/ui/arkui-overview.md index e80deb47e22b89f623c2d13498222ea3845343fe..73e9103b88de19305b750de003d0bfaa5c998436 100644 --- a/zh-cn/application-dev/ui/arkui-overview.md +++ b/zh-cn/application-dev/ui/arkui-overview.md @@ -2,7 +2,7 @@ ## 框架介绍 -方舟开发框架(简称:ArkUI),是一套UI开发框架,提供开发者进行应用UI开发时所必须的能力。 +方舟开发框架(简称:ArkUI),是一套UI开发框架,提供开发者进行应用UI开发时所必需的能力。 ## 基本概念 diff --git a/zh-cn/application-dev/website.md b/zh-cn/application-dev/website.md index 830578b0af0fbdf1dbcfcc226d3a65ebd1962d4b..8246066f98c4f35bb0e113044d246af19a3f6cb1 100644 --- a/zh-cn/application-dev/website.md +++ b/zh-cn/application-dev/website.md @@ -4,7 +4,8 @@ - 快速入门 - [开发准备](quick-start/start-overview.md) - - [使用eTS语言开发](quick-start/start-with-ets.md) + - [使用eTS语言开发(传统代码方式)](quick-start/start-with-ets.md) + - [使用eTS语言开发(低代码方式)](quick-start/start-with-ets-low-code.md) - [使用JS语言开发(传统代码方式)](quick-start/start-with-js.md) - [使用JS语言开发(低代码方式)](quick-start/start-with-js-low-code.md) @@ -16,21 +17,24 @@ - 开发 - Ability开发 - [Ability框架概述](ability/ability-brief.md) + - [应用上下文Context概述](ability/context-userguide.md) - FA模型 - [FA模型综述](ability/fa-brief.md) - [PageAbility开发指导](ability/fa-pageability.md) - [ServiceAbility开发指导](ability/fa-serviceability.md) - [DataAbility开发指导](ability/fa-dataability.md) - - [FormAbility开发指导](ability/fa-formability.md) + - [FA卡片开发指导](ability/fa-formability.md) - Stage模型 - [Stage模型综述](ability/stage-brief.md) - [Ability开发指导](ability/stage-ability.md) - [ServiceExtensionAbility开发指导](ability/stage-serviceextension.md) - - [FormExtensionAbility开发指导](ability/stage-formextension.md) - - [应用迁移开发指导](ability/stage-ability-continuation.md) + - [跨端迁移开发指导](ability/stage-ability-continuation.md) + - [Call调用开发指导](ability/stage-call.md) + - [Stage卡片开发指导](ability/stage-formextension.md) - 其他 - - [WantAgent使用指导](ability/wantagent.md) + - [WantAgent开发指导](ability/wantagent.md) - [Ability助手使用指导](ability/ability-assistant-guidelines.md) + - [测试框架使用指导](ability/ability-delegator.md) - UI开发 - [方舟开发框架(ArkUI)概述](ui/arkui-overview.md) - 基于JS扩展的类Web开发范式 @@ -177,6 +181,14 @@ - [构建食物分类Grid布局](ui/ui-ts-building-category-grid-layout.md) - [页面跳转与数据传递](ui/ui-ts-page-redirection-data-transmission.md) - 基础功能开发 + - 公共事件与通知 + - [公共事件与通知概述](notification/notification-brief.md) + - 公共事件 + - [公共事件开发指导](notification/common-event.md) + - 通知 + - [通知开发指导](notification/notification.md) + - 调试工具 + - [调试助手使用指导](notification/assistant-guidelines.md) - 窗口管理 - 窗口 - [窗口开发概述](windowmanager/window-overview.md) @@ -188,7 +200,7 @@ - [屏幕截图开发概述](windowmanager/screenshot-overview.md) - [屏幕截图开发指导](windowmanager/screenshot-guidelines.md) - WebGL - - [概述](webgl/webgl-overview.md) + - [WebGL开发概述](webgl/webgl-overview.md) - [WebGL开发指导](webgl/webgl-guidelines.md) - 媒体 - 音频 @@ -215,10 +227,19 @@ - [访问控制开发概述](security/accesstoken-overview.md) - [访问控制开发指导](security/accesstoken-guidelines.md) - 网络与连接 + - 网络管理 + - [网络管理开发概述](connectivity/net-mgmt-overview.md) + - [HTTP数据请求](connectivity/http-request.md) + - [WebSocket连接](connectivity/websocket-connection.md) + - [Socket连接](connectivity/socket-connection.md) - IPC与RPC通信 - [IPC与RPC通信概述](connectivity/ipc-rpc-overview.md) - [IPC与RPC通信开发指导](connectivity/ipc-rpc-development-guideline.md) - [远端状态订阅开发实例](connectivity/subscribe-remote-state.md) + - 电话服务 + - [电话服务开发概述](telephony/telephony-overview.md) + - [跳转拨号界面](telephony/jumping-to-the-dial-screen.md) + - [获取当前蜂窝网络信号信息](telephony/cellular-network-signal-info.md) - 数据管理 - 分布式数据服务 - [分布式数据服务概述](database/database-mdds-overview.md) @@ -233,12 +254,15 @@ - [分布式数据对象概述](database/database-distributedobject-overview.md) - [分布式数据对象开发指导](database/database-distributedobject-guidelines.md) - 后台代理提醒 - - [概述](background-agent-scheduled-reminder/background-agent-scheduled-reminder-overview.md) - - [开发指导](background-agent-scheduled-reminder/background-agent-scheduled-reminder-guide.md) + - [后台代理概述](background-agent-scheduled-reminder/background-agent-scheduled-reminder-overview.md) + - [后台代理开发指导](background-agent-scheduled-reminder/background-agent-scheduled-reminder-guide.md) - 后台任务管理 - 后台任务 - [后台任务概述](background-task-management/background-task-overview.md) - [后台任务开发指导](background-task-management/background-task-dev-guide.md) + - 延迟任务调度 + - [延迟任务调度概述](work-scheduler/work-scheduler-overview.md) + - [延迟任务调度开发指导](work-scheduler/work-scheduler-dev-guide.md) - 设备管理 - USB服务 - [USB服务开发概述](device/usb-overview.md) @@ -253,6 +277,9 @@ - 振动 - [振动开发概述](device/vibrator-overview.md) - [振动开发指导](device/vibrator-guidelines.md) + - 升级服务 + - [示例服务器开发概述](device/sample-server-overview.md) + - [示例服务器开发指导](device/sample-server-guidelines.md) - 设备使用信息统计 - [设备使用信息统计概述](device-usage-statistics/device-usage-statistics-overview.md) - [设备使用信息统计开发指导](device-usage-statistics/device-usage-statistics-dev-guide.md) @@ -270,6 +297,8 @@ - [国际化开发概述](internationalization/international-overview.md) - [Intl开发指导](internationalization/intl-guidelines.md) - [I18n开发指导](internationalization/i18n-guidelines.md) + - [IDL工具规格及使用说明书](IDL/idl-guidelines.md) + - [Native API在应用工程中的使用指导](napi/napi-guidelines.md) - 工具 - [DevEco Studio(OpenHarmony)使用指南](quick-start/deveco-studio-user-guide-for-openharmony.md) - 示例教程 @@ -286,6 +315,7 @@ - [动画样式](reference/arkui-js/js-components-common-animation.md) - [渐变样式](reference/arkui-js/js-components-common-gradient.md) - [转场样式](reference/arkui-js/js-components-common-transition.md) + - [媒体查询](reference/arkui-js/js-components-common-mediaquery.md) - [自定义字体样式](reference/arkui-js/js-components-common-customizing-font.md) - [原子布局](reference/arkui-js/js-components-common-atomic-layout.md) - 容器组件 @@ -375,7 +405,8 @@ - [事件参数](reference/arkui-js/js-components-custom-event-parameter.md) - [slot插槽](reference/arkui-js/js-components-custom-slot.md) - [生命周期定义](reference/arkui-js/js-components-custom-lifecycle.md) - - [类型说明](reference/arkui-js/js-appendix-types.md) + - 附录 + - [类型说明](reference/arkui-js/js-appendix-types.md) - 组件参考(基于TS扩展的声明式开发范式) - 组件 - 通用 @@ -451,7 +482,7 @@ - [Slider](reference/arkui-ts/ts-basic-components-slider.md) - [Span](reference/arkui-ts/ts-basic-components-span.md) - [Stepper](reference/arkui-ts/ts-basic-components-stepper.md) - - [StepperItem](reference/arkui-ts/ts-basic-components-stepperitem.md) + - [StepperItem](reference/arkui-ts/ts-basic-components-stepperitem.md) - [Text](reference/arkui-ts/ts-basic-components-text.md) - [TextArea](reference/arkui-ts/ts-basic-components-textarea.md) - [TextClock](reference/arkui-ts/ts-basic-components-textclock.md) @@ -520,7 +551,8 @@ - [警告弹窗](reference/arkui-ts/ts-methods-alert-dialog-box.md) - [列表选择弹窗](reference/arkui-ts/ts-methods-action-sheet.md) - [自定义弹窗](reference/arkui-ts/ts-methods-custom-dialog-box.md) - - [日期时间选择弹窗](reference/arkui-ts/ts-methods-datepicker-dialog.md) + - [日期选择弹窗](reference/arkui-ts/ts-methods-datepicker-dialog.md) + - [时间选择弹窗](reference/arkui-ts/ts-methods-timepicker-dialog.md) - [文本选择弹窗](reference/arkui-ts/ts-methods-textpicker-dialog.md) - [菜单](reference/arkui-ts/ts-methods-menu.md) - [文档中涉及到的内置枚举值](reference/arkui-ts/ts-appendix-enums.md) @@ -568,81 +600,81 @@ - [MissionSnapshot (MissionSnapshot)](reference/apis/js-apis-application-MissionSnapshot.md) - [PermissionRequestResult (PermissionRequestResult)](reference/apis/js-apis-permissionrequestresult.md) - [ProcessRunningInfo (ProcessRunningInfo)](reference/apis/js-apis-processrunninginfo.md) - - [ServiceExtensionContext (ServiceExtensionContext)](reference/apis/js-apis-service-extension-context.md) + - [ServiceExtensionContext (ServiceExtensionContext)](reference/apis/js-apis-service-extension-context.md) - [shellCmdResult (ShellCmdResult)](reference/apis/js-apis-application-shellCmdResult.md) - - - 公共事件与通知 - - - [@ohos.commonEvent (公共事件模块)](reference/apis/js-apis-commonEvent.md) + - 公共事件与通知 + + - [@ohos.commonEvent (公共事件模块)](reference/apis/js-apis-commonEvent.md) - [@ohos.events.emitter (Emitter)](reference/apis/js-apis-emitter.md) - [@ohos.notification (Notification模块)](reference/apis/js-apis-notification.md) - [@ohos.reminderAgent (后台代理提醒)](reference/apis/js-apis-reminderAgent.md) - [EventHub (EventHub)](reference/apis/js-apis-eventhub.md) - - - 应用程序包管理 - - - [@ohos.bundle (Bundle模块)](reference/apis/js-apis-Bundle.md) + + - 应用程序包管理 + + - [@ohos.bundle (Bundle模块)](reference/apis/js-apis-Bundle.md) - [@ohos.bundleState (设备使用信息统计)](reference/apis/js-apis-deviceUsageStatistics.md) - [@ohos.zlib (Zip模块)](reference/apis/js-apis-zlib.md) - - - UI界面 - - - [@ohos.animator (动画)](reference/apis/js-apis-animator.md) + + - UI界面 + + - [@ohos.animator (动画)](reference/apis/js-apis-animator.md) - [@ohos.mediaquery (媒体查询)](reference/apis/js-apis-mediaquery.md) - [@ohos.prompt (弹窗)](reference/apis/js-apis-prompt.md) - [@ohos.router (页面路由)](reference/apis/js-apis-router.md) - - - 图形图像 - - - [@ohos.display (屏幕属性)](reference/apis/js-apis-display.md) + + - 图形图像 + + - [@ohos.display (屏幕属性)](reference/apis/js-apis-display.md) - [@ohos.screenshot (屏幕截图)](reference/apis/js-apis-screenshot.md) - [@ohos.window (窗口)](reference/apis/js-apis-window.md) - [webgl (WebGL)](reference/apis/js-apis-webgl.md) - [webgl2 (WebGL2)](reference/apis/js-apis-webgl2.md) - - - 媒体 - - - [@ohos.multimedia.audio (音频管理)](reference/apis/js-apis-audio.md) + + - 媒体 + + - [@ohos.multimedia.audio (音频管理)](reference/apis/js-apis-audio.md) - [@ohos.multimedia.camera (相机管理)](reference/apis/js-apis-camera.md) - [@ohos.multimedia.image (图片处理)](reference/apis/js-apis-image.md) - [@ohos.multimedia.media (媒体服务)](reference/apis/js-apis-media.md) - [@ohos.multimedia.medialibrary (媒体库管理)](reference/apis/js-apis-medialibrary.md) - - - 资源管理 + + - 资源管理 - [@ohos.i18n (国际化-I18n)](reference/apis/js-apis-i18n.md) - [@ohos.intl (国际化-Intl)](reference/apis/js-apis-intl.md) - [@ohos.resourceManager (资源管理)](reference/apis/js-apis-resource-manager.md) - - - 资源调度 - - - [@ohos.backgroundTaskManager (后台任务管理)](reference/apis/js-apis-backgroundTaskManager.md) + + - 资源调度 + + - [@ohos.backgroundTaskManager (后台任务管理)](reference/apis/js-apis-backgroundTaskManager.md) - [@ohos.workScheduler (延迟任务调度)](reference/apis/js-apis-workScheduler.md) - [@ohos.WorkSchedulerExtensionAbility (延迟任务调度回调)](reference/apis/js-apis-WorkSchedulerExtensionAbility.md) - - - 定制管理 - - - [@ohos.configPolicy (配置策略)](reference/apis/js-apis-config-policy.md) + + - 定制管理 + + - [@ohos.configPolicy (配置策略)](reference/apis/js-apis-config-policy.md) - [@ohos.enterpriseDeviceManager (企业设备管理)](reference/apis/js-apis-enterprise-device-manager.md) - - - 安全 - - - [@ohos.abilityAccessCtrl (访问控制管理)](reference/apis/js-apis-abilityAccessCtrl.md) + + - 安全 + + - [@ohos.abilityAccessCtrl (访问控制管理)](reference/apis/js-apis-abilityAccessCtrl.md) - [@ohos.security.huks (通用密钥库系统)](reference/apis/js-apis-huks.md) - [@ohos.userIAM.userAuth (用户认证)](reference/apis/js-apis-useriam-userauth.md) - [@system.cipher (加密算法)](reference/apis/js-apis-system-cipher.md) - - - 数据管理 - - - [@ohos.data.dataAbility (DataAbility谓词)](reference/apis/js-apis-data-ability.md) + + - 数据管理 + + - [@ohos.data.dataAbility (DataAbility谓词)](reference/apis/js-apis-data-ability.md) - [@ohos.data.distributedData (分布式数据管理)](reference/apis/js-apis-distributed-data.md) - [@ohos.data.distributedDataObject (分布式数据对象)](reference/apis/js-apis-data-distributedobject.md) - [@ohos.data.preferences (首选项)](reference/apis/js-apis-data-preferences.md) - [@ohos.data.rdb (关系型数据库)](reference/apis/js-apis-data-rdb.md) - [@ohos.settings (设置数据项名称)](reference/apis/js-apis-settings.md) - [resultSet (结果集)](reference/apis/js-apis-data-resultset.md) - - - 文件管理 - + + - 文件管理 + + - [@ohos.document (文件交互)](reference/apis/js-apis-document.md) - [@ohos.environment (目录环境能力)](reference/apis/js-apis-environment.md) - [@ohos.fileio (文件管理)](reference/apis/js-apis-fileio.md) - [@ohos.fileManager (公共文件访问与管理)](reference/apis/js-apis-filemanager.md) diff --git a/zh-cn/application-dev/work-scheduler/Readme-CN.md b/zh-cn/application-dev/work-scheduler/Readme-CN.md index 2e20de349f0a4d666b50a99009243e55619de987..789acd86ce1e7bb35fd329ea5ea689eced36dfb0 100644 --- a/zh-cn/application-dev/work-scheduler/Readme-CN.md +++ b/zh-cn/application-dev/work-scheduler/Readme-CN.md @@ -1,5 +1,3 @@ # 延迟任务调度 - -- 后台任务 - - [延迟任务调度概述](work-scheduler-overview.md) - - [延迟任务调度开发指导](work-scheduler-dev-guide.md) \ No newline at end of file + - [延迟任务调度概述](work-scheduler-overview.md) + - [延迟任务调度开发指导](work-scheduler-dev-guide.md) \ No newline at end of file diff --git a/zh-cn/contribute/OpenHarmony-security-design-guide.md b/zh-cn/contribute/OpenHarmony-security-design-guide.md index a4ad5776c70930e44b39c0ee95c7011ebb465dc7..2e9da38765fcda1732419a3a570005c7e05b87a8 100644 --- a/zh-cn/contribute/OpenHarmony-security-design-guide.md +++ b/zh-cn/contribute/OpenHarmony-security-design-guide.md @@ -8,7 +8,7 @@ **说明:**为减少系统攻击面,对于可对系统进行管理(包括配置、升级、调试等)的接口必须要启用认证机制,避免未授权的访问。 -1-2 只保留运行维护所必须的对外通信连接,关闭不需要连接、端口。 +1-2 只保留运行维护所必需的对外通信连接,关闭不需要连接、端口。 **说明:**关闭不必要的通信端口,可大大降低安全威胁,是系统安全防护的基础手段。 diff --git a/zh-cn/contribute/template/README-template.md b/zh-cn/contribute/template/README-template.md index 0d87ac700824089f89cc7ad300011fcf202c0318..5cd6423131a6446b4b7fa4c3815a9d67426a5459 100644 --- a/zh-cn/contribute/template/README-template.md +++ b/zh-cn/contribute/template/README-template.md @@ -119,7 +119,7 @@ | 要求项 | 内容要求 | | -------- | -------- | | **F.1** | **如何写好步骤** | -| F.1.1 | 步骤完整:提供必须的步骤,顺利指导完成操作,无缺失。 | +| F.1.1 | 步骤完整:提供必需的步骤,顺利指导完成操作,无缺失。 | | F.1.2 | 脉络清楚:文档逻辑清晰、合理。文档前面的概述、准备、操作围绕一条线描述,不能章节断裂或前后矛盾的现象。 | | F.1.3 | 任务句式:标题或句子尽量使用“动词+名词”的句式表述动作。 | | F.1.4 | 预防提前:操作过程中的限制、易错的、有潜在风险的,要提前描述。 | diff --git a/zh-cn/contribute/template/guide-template.md b/zh-cn/contribute/template/guide-template.md index bca7c5b552d6397c7d6683c9b1696e82917d0d8e..641dbb1c75376b247c08f58c2da4a01f1c927391 100644 --- a/zh-cn/contribute/template/guide-template.md +++ b/zh-cn/contribute/template/guide-template.md @@ -71,7 +71,7 @@ | 内容要求 | 是否满足 | | -------- | -------- | | **如何写好步骤** | | -| 步骤完整:提供必须的步骤,顺利指导完成操作,无缺失。 | | +| 步骤完整:提供必需的步骤,顺利指导完成操作,无缺失。 | | | 脉络清楚:文档逻辑清晰、合理。文档前面的概述、准备、操作围绕一条线描述,不能章节断裂或前后矛盾的现象。 | | | 任务句式:标题或句子尽量使用“动词+名词”的句式表述动作。 | | | 预防提前:操作过程中的限制、易错的、有潜在风险的,要提前描述,使用DOCS平台的“插入> 说明 > 须知”描述。 | | diff --git a/zh-cn/device-dev/device-demo.md b/zh-cn/device-dev/device-demo.md new file mode 100644 index 0000000000000000000000000000000000000000..e4ef63b6668952d66b35a8d5cbcbb316305aefa0 --- /dev/null +++ b/zh-cn/device-dev/device-demo.md @@ -0,0 +1,88 @@ +# 场景Demo示例 + +本页面提供了典型场景的部分简单有趣的示例,可以帮助您迅速了解OpenHarmony的开发和使用。 + + **表 1** 智能家居场景Demo示例 +| 示例 | 简介 | 系统 | OpenHarmony版本 | +| -------- | -------- | -------- | -------- | +| [智能加湿器](https://growing.openharmony.cn/mainPlay/detail?sampleId=3727) | 该样例使用JS编写本地设备应用界面,通过JSI机制与HDF交互来控制加湿器和显示当前湿度。样例还显示日期时间、天气和WIFI状态、阈值调解功能。还已接入数字管家应用,支持远程操作和日程安排,语音控制加湿器开关功能。 | LiteOS-M | 3.1 Beta | +| [智能门铃](https://growing.openharmony.cn/mainPlay/detail?sampleId=3728) | 该样例人感配合按键监测入户门前状态“无人”,“不明人员逗留”,“访客按门铃”。将这些信息实时同步到室内屏幕上,并且在监测到门前有人时,蜂鸣器会报警,提醒室内用户。如果设备联网的情况下,这些信息也会同步到数字管家,并且数字管家还可以远程一键开锁。 | LiteOS-M | 3.1 Beta | +| [智能保险柜](https://growing.openharmony.cn/mainPlay/detail?sampleId=3731) | 该样例利用碰一碰配网接入数字管家,并外接震动传感器,实现保险柜实时监控、报警功能。如果保险柜被震动,则手机会收到告警。 | LiteOS-M | 3.1 Beta | +| [智能烟感系统](https://growing.openharmony.cn/mainPlay/detail?sampleId=3703) | 智能烟感系统通过实时监测环境中烟雾浓度,当烟雾浓度超标时,及时向用户发出警报。在连接网络后,配合数字管家应用,用户可以远程配置智能烟感系统的报警阈值,远程接收智能烟感系统报警信息。实现对危险及时报警,及时处理,守护居家安全。 | LiteOS-M | 1.0.1 LTS | +| [智能可燃气体检测系统](https://growing.openharmony.cn/mainPlay/detail?sampleId=3704) | 此样例是基于BearPi套件开发的智能可燃气体检测开发样例,该系统内主要由小熊派单板套件和和MQ5可燃气体检测传感器组成。 智能可燃气体检测系统可以通过云和手机建立连接,可以在手机上控制感应的阈值,传感器感知到的可燃气体浓度超过阈值之后,将会通过云传给手机,并报警。 | LiteOS-M | 1.0.1 LTS | +| [智能甲醛检测系统](https://growing.openharmony.cn/mainPlay/detail?sampleId=3705) | 此样例是基于BearPi套件开发的智能甲醛检测系统开发样例,该设备硬件部分主要由小熊派单板套件和和甲醛检测传感器组成。智能甲醛检测系统可以通过云和手机建立连接,可以在手机上设置甲醛浓度阈值,传感器感知到的甲醛浓度超过阈值之后,将会通过云传给手机,并报警。 | LiteOS-M | 1.0.1 LTS | +| [智慧窗帘](https://growing.openharmony.cn/mainPlay/detail?sampleId=3706) | 智能窗帘设备不仅接收数字管家应用下发的指令来控制窗帘开启的时间,而且还可以加入到数字管家的日程管理中。通过日程可以设定窗帘开关的时间段,使其在特定的时间段内,窗帘自动打开或者关闭;通过日程管家还可以实现窗帘和其他的智能设备联动。 | LiteOS-M | 1.0.1 LTS | +| [智能扫地机](https://growing.openharmony.cn/mainPlay/detail?sampleId=3707) | 此样例采用润和的智能小车套件为硬件模型,通过修改代码具备了扫地机器人简易的避障功能及防跌落功能,并且能通过wifi接入数字管家应用场景。智能扫地机不仅能接收数字管家应用下发的指令启动或停止扫地机器人,而且还可以加入到数字管家的日程管理中。通过日程可以设定智能扫地机启动的时间段,使其在特定的时间段内,智能扫地机自动启动或者停止。 | LiteOS-M | 1.0.1 LTS | +| [智能养花机](https://growing.openharmony.cn/mainPlay/detail?sampleId=3708) | 智能养花机通过感知花卉、盆栽等植宠生长环境的温度、湿度信息,适时为它们补充水分。在连接网络后,配合数字管家应用,用户可远程进行浇水操作。用户还可在应用中设定日程,有计划的按日、按周进行浇水。在日程中用户可添加其它智能设备(例如:智能窗帘),一起呵护植宠的成长。 | LiteOS-M | 1.0.1 LTS | +| [护花使者](https://growing.openharmony.cn/mainPlay/detail?sampleId=3699) | 此样例是用BearPi-HM_Nano开发板加上一块“护花使者“底板及抽水电机等配件,快速DIY出一款具备远程监测土壤湿度并实现远程浇水的设备。该项目具备成本低、耗时少、操作简单等特点,时时刻刻呵护您的植物,伴其茁壮成长。 | LiteOS-M | 1.1.0 LTS | +| [智能垃圾桶](https://growing.openharmony.cn/mainPlay/detail?sampleId=3709) | 智能垃圾桶可以通过数字管家应用来监测垃圾桶当前可用容量,提醒主人及时处理垃圾;通过日程管家可以实现和其他智能设备联动。 | LiteOS-M | 1.0.1 LTS | +| [智能风扇](https://growing.openharmony.cn/mainPlay/detail?sampleId=3711) | 智能风扇设备不仅接收数字管家应用下发的指令来控制风扇开启的时间,调节风扇挡位,更改风扇定时时间,而且还可以加入到数字管家的日程管理中。通过日程可以设定风扇相关的任务,使其在特定的时间段内,风扇自动打开或者关闭,调节挡位大小和定时时间;通过日程管家还可以实现风扇和其他的智能设备联动。 | LiteOS-M | 1.0.1 LTS | +| [启航KP_IOT智能风扇模块](https://growing.openharmony.cn/mainPlay/detail?sampleId=3802) | 本次实验主要讲述基于软通动力启航KP_IoT智能开发套件智能风扇控制,让开发者在学习过程中找到开发的乐趣,从而创造更多实用的应用场景。 | LiteOS-M | 3.0 LTS | +| [智能手表](https://growing.openharmony.cn/mainPlay/detail?sampleId=3712) | 此样例是基于BearPi套件开发的智能儿童手表系统,该系统通过与GSM模块(型号:SIM808)的通信来实现通话和定位功能。 智能儿童手表系统可以通过云和手机建立连接,同步时间和获取天气信息,通过手机下达日程安排到儿童手表,并显示在儿童手表的屏幕端,还可以通过SIM808模块获取地理位置信息,接收和拨打电话等功能。 | LiteOS-M | 1.0.1 LTS | +| [智能台灯(BearPi-HM Nano)](https://growing.openharmony.cn/mainPlay/detail?sampleId=3713) | 智能台灯设备不仅接收数字管家应用下发的指令来控制台灯的开关及亮度,而且还可以加入到数字管家的日程管理中。通过日程可以设定台灯开关的时间段,使其在特定的时间段内,台灯自动打开或者熄灭,并能自动调节相应时间段台灯的亮度;通过日程管家还可以实现台灯和其他的智能设备联动。此样例演示如何在BearPi-HM Nano开发板上实现智能台灯。 | LiteOS-M | 1.0.1 LTS | +| [智能台灯(Pegasus Wi-Fi IoT)](https://growing.openharmony.cn/mainPlay/detail?sampleId=3793) | 此样例演示如何在Pegasus Wi-Fi IoT智能家居套件上实现智能台灯。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [智能炫彩灯](https://growing.openharmony.cn/mainPlay/detail?sampleId=3787) | 此样例演示如何在Pegasus Wi-Fi IoT智能家居套件上使用PWM实现炫彩灯。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [智能光控灯](https://growing.openharmony.cn/mainPlay/detail?sampleId=3788) | 此样例演示如何在Pegasus Wi-Fi IoT智能家居套件上使用ADC实现智能光控灯。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [JS灯控应用](https://growing.openharmony.cn/mainPlay/detail?sampleId=3804) | 该样例利用OpenHarmony JS API接口,开发灯控应用,并与开发板进行交互。 | LiteOS-A | 3.0 LTS | +| [启航KS_智能灯光控制](https://growing.openharmony.cn/mainPlay/detail?sampleId=3801) | 本次实验主要讲述基于软通动力启航KS_IoT智能开发套件智能灯光控制,让开发者在学习过程中找到开发的乐趣,从而创造更多实用的应用场景。 | LiteOS-M | 1.1.3 LTS | +| [智能温湿度采集](https://growing.openharmony.cn/mainPlay/detail?sampleId=3789) | 此样例演示如何在Pegasus Wi-Fi IoT智能家居套件上使用I2C实现智能温湿度采集。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [智能电子牌](https://growing.openharmony.cn/mainPlay/detail?sampleId=3710) | 此样例是基于hi3516dv300开发板,使用开源鸿蒙OpenHarmony 开发的应用。通过该应用不仅可以查看时间、日期以及对应的室内外温湿度、空气质量等,还可以查看当日的行程,让我们随时随地把握行程,不会遗漏任何重要的安排。 | LiteOS-A | 1.0.1 LTS | +| [智能中控面板](https://growing.openharmony.cn/mainPlay/detail?sampleId=3714) | 此样例是基于Hi3516开发板,使用开源OpenHarmony开发的应用。通过控制面板可以控制同一局域网内的空调,窗帘,灯等智能家居设备。 | LiteOS-A | 1.0.1 LTS | +| [智能猫眼3516](https://growing.openharmony.cn/mainPlay/detail?sampleId=3716) | 此样例是基于Hi3516开发板,使用开源OpenHarmony开发的应用。通过手机应用可以看到Hi3516摄像头捕获的数据。 | LiteOS-A | 1.0.1 LTS | +| [智能猫眼3518](https://growing.openharmony.cn/mainPlay/detail?sampleId=3717) | 此样例是基于Hi3518开发板,使用开源OpenHarmony开发的应用。通过手机应用可以看到Hi3518摄像头捕获的数据。 | LiteOS-A | 1.0.1 LTS | +| [智能环境监控](https://growing.openharmony.cn/mainPlay/detail?sampleId=3794) | 此样例演示如何在Pegasus Wi-Fi IoT智能家居套件上实现智能环境监测系统。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [温度监控](https://growing.openharmony.cn/mainPlay/detail?sampleId=3803) | 根据温度传感设备上报的数据来显示设备所在环境中的温度,并在手机端实时展现出来。 | LiteOS-M | 3.0 LTS | +| [WIFI连接热点实验](https://growing.openharmony.cn/mainPlay/detail?sampleId=3795) | 此样例演示如何在Pegasus Wi-Fi IoT智能家居套件上开发wifi_STA模式。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [路由器热点功能](https://growing.openharmony.cn/mainPlay/detail?sampleId=3795) | 此样例演示如何在Pegasus Wi-Fi IoT智能家居套件上开发wifi_AP模式。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | + + + + **表 2** 影音娱乐场景Demo示例 +| 示例 | 简介 | 系统 | OpenHarmony版本 | +| -------- | -------- | -------- | ------ | +| [贪吃蛇](https://growing.openharmony.cn/mainPlay/detail?sampleId=3718) | 此样例是基于LYEVK-3861开发板IOT套件开发的简易贪吃蛇小游戏,使用了套件中的OLED屏幕扩展板和带按键的照明板。用OLED屏幕显示游戏运行界面,按键复用为游戏选择和游戏控制方向键。 | LiteOS-M | 3.0 LTS | +| [音乐播放](https://growing.openharmony.cn/mainPlay/detail?sampleId=3719) | 此样例是基于LYEVK-3861开发板IOT套件开发的音乐播放放器,通过不同频率的PWM波驱动蜂鸣器可以产生不同音符的声音,利用这一特点,就可以奏出一段音乐。 | LiteOS-M | 3.0 LTS | +| [智能相机](https://growing.openharmony.cn/mainPlay/detail?sampleId=3715) | 此样例是基于Hi3516开发板,使用开源OpenHarmony3.0 LTS开发的应用。通过获取摄像头数据,实现预览拍照以及路视频等功能。并且通过后台AI服务识别唤醒词来进行语音控制拍照及录视频。 | LiteOS-A | 3.0 LTS | +| [多功能OLED屏幕](https://growing.openharmony.cn/mainPlay/detail?sampleId=3791) | 此样例演示如何在Pegasus Wi-Fi IoT智能家居套件上使用SSD 1306库驱动OLED屏。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | + + + + **表 3** 快速上手场景Demo示例 +| 示例 | 简介 | 系统 | OpenHarmony版本 | +| -------- | -------- | -------- | ------ | +| [任务交替打印](https://growing.openharmony.cn/mainPlay/detail?sampleId=3722) | 此样例将演示如何在BearPi-HM_Nano开发板上使用cmsis 2.0 接口进行多线程开发。 | LiteOS-M | 1.1.0 LTS | +| [定时器](https://growing.openharmony.cn/mainPlay/detail?sampleId=3723) | 此样例将演示如何在BearPi-HM_Nano开发板上使用cmsis 2.0 接口进行定时器开发。 | LiteOS-M | 1.1.0 LTS | +| [事件](https://growing.openharmony.cn/mainPlay/detail?sampleId=3724) | 此样例将演示如何在BearPi-HM_Nano开发板上使用cmsis 2.0 接口使用事件标志同步线程。 | LiteOS-M | 1.1.0 LTS | +| [互斥锁](https://growing.openharmony.cn/mainPlay/detail?sampleId=3725) | 此样例将演示如何在BearPi-HM_Nano开发板上使用cmsis 2.0 接口使用互斥来同步任务。 | LiteOS-M | 1.1.0 LTS | +| [信号量](https://growing.openharmony.cn/mainPlay/detail?sampleId=3726) | 此样例将演示如何在BearPi-HM_Nano开发板上使用cmsis 2.0 接口通过信号量同时从不同的线程访问共享资源。 | LiteOS-M | 1.1.0 LTS | +| [基于LYEVK-3861接入华为IoT平台](https://growing.openharmony.cn/mainPlay/detail?sampleId=3721) | 本Demo是基于LYEVK-3861A IoT 开发套件开发,通过温湿度传感器模块获取温度,并上传华为云服务器。 | LiteOS-M | 3.0 LTS | +| [Pegasus智能家居套件样例开发--PWM(pwm_beer)](https://growing.openharmony.cn/mainPlay/detail?sampleId=3755) | 使用润和软件Pegasus Wi-Fi IoT智能家居套件中的蜂鸣器播放两只老虎音乐。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [Pegasus智能家居套件样例开发--oled_player](https://growing.openharmony.cn/mainPlay/detail?sampleId=3756) | 使用润和软件Pegasus Wi-Fi IoT智能家居套件中的OLED屏,播放视频。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [Pegasus智能家居套件样例开发--等待(Delay)](https://growing.openharmony.cn/mainPlay/detail?sampleId=3759) | 此样例将演示如何在Pegasus Wi-Fi IoT智能家居套件上使用cmsis 2.0 接口进行OS延时开发。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [Pegasus智能家居套件样例开发--互斥锁(Mutex)](https://growing.openharmony.cn/mainPlay/detail?sampleId=3760) | 此样例将演示如何在Pegasus Wi-Fi IoT智能家居套件上使用cmsis 2.0 接口进行互斥锁开发。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [Pegasus智能家居套件样例开发--软定时器(Timer)](https://growing.openharmony.cn/mainPlay/detail?sampleId=3758) | 此样例将演示如何在Pegasus Wi-Fi IoT智能家居套件上使用cmsis 2.0 接口进行定时器开发。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [Pegasus智能家居套件样例开发--信号量(Semaphore)](https://growing.openharmony.cn/mainPlay/detail?sampleId=3761) | 此样例将演示如何在Pegasus Wi-Fi IoT智能家居套件上使用cmsis 2.0 接口进行信号量开发。| LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [Pegasus智能家居套件样例开发--线程](https://growing.openharmony.cn/mainPlay/detail?sampleId=3757) | 此样例将演示如何在Pegasus Wi-Fi IoT智能家居套件上使用cmsis 2.0 接口进行线程开发。| LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [Pegasus智能家居套件样例开发--消息队列](https://growing.openharmony.cn/mainPlay/detail?sampleId=3762) | 此样例将演示如何在Pegasus Wi-Fi IoT智能家居套件上使用cmsis 2.0 接口进行消息队列开发。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [Pegasus智能家居套件样例开发--IO控制](https://growing.openharmony.cn/mainPlay/detail?sampleId=3763) | 此样例将演示如何在Pegasus Wi-Fi IoT智能家居套件上使用cmsis 2.0 接口进行IO口控制开发。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [串口通信实验](https://growing.openharmony.cn/mainPlay/detail?sampleId=3790) | 此样例演示如何在Pegasus Wi-Fi IoT智能家居套件上实现串口通信。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [基于LYEVK-3861 接入华为IoT平台](https://growing.openharmony.cn/mainPlay/detail?sampleId=3721) | 本样例是基于LYEVK-3861A IoT 开发套件开发,通过温湿度传感器模块获取温度,并上传华为云服务器。 | LiteOS-M | 3.0 LTS | + + + + **表 4** 智慧出行场景Demo示例 +| 示例 | 简介 | 系统 | OpenHarmony版本 | +| -------- | -------- | -------- | ------ | +| [智慧停车](https://growing.openharmony.cn/mainPlay/detail?sampleId=3720) | 此样例是基于LYEVK-3861A IoT 开发套件开发,通过获取光照强度变化感知是否有车停放。 | LiteOS-M | 3.0 LTS | +| [智能交通灯](https://growing.openharmony.cn/mainPlay/detail?sampleId=3792) | 此样例演示如何在Pegasus Wi-Fi IoT智能家居套件上实现智能交通灯实验。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | + + + + **表 5** 智慧办公Demo示例 +| 示例 | 简介 | 系统 | OpenHarmony版本 | +| -------- | -------- | -------- | ------ | +| [蓝牙键盘](https://growing.openharmony.cn/mainPlay/detail?sampleId=3700) | 此样例是基于润和Neptune开发板开发的蓝牙键盘开发样例,搭配USB转串口模块,实现有线键盘转成蓝牙键盘的功能。 | LiteOS-M | 1.1.0 LTS | +| [TCP客户端实验](https://growing.openharmony.cn/mainPlay/detail?sampleId=3797) | 此样例演示如何在Pegasus Wi-Fi IoT智能家居套件上完成TCP客户端实验。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [TCP服务端实验](https://growing.openharmony.cn/mainPlay/detail?sampleId=3798) | 此样例演示如何在Pegasus Wi-Fi IoT智能家居套件上完成TCP服务端实验。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [UDP客户端实验](https://growing.openharmony.cn/mainPlay/detail?sampleId=3799) | 此样例演示如何在Pegasus Wi-Fi IoT智能家居套件上完成UDP客户端实验。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | +| [UDP服务端实验](https://growing.openharmony.cn/mainPlay/detail?sampleId=3800) | 此样例演示如何在Pegasus Wi-Fi IoT智能家居套件上完成UDP服务端实验。 | LiteOS-M | 1.0.1 LTS
3.0 LTS | \ No newline at end of file diff --git a/zh-cn/device-dev/device-dev-guide.md b/zh-cn/device-dev/device-dev-guide.md index f69bf04c173c2c82b8cd6c3a2f7fc82c06c452cf..9b05909487c9835a1255671a1ec91539e1995a33 100644 --- a/zh-cn/device-dev/device-dev-guide.md +++ b/zh-cn/device-dev/device-dev-guide.md @@ -30,13 +30,13 @@ OpenHarmony也提供了一系列可选的系统组件,方便设备开发者按 ## 文档导读 -**表 1** 轻量和小型系统开发指导(参考内存<128MB) +**表 1** 轻量和小型系统开发指导(参考内存<128MiB) | 学习路径 | 开发者业务 | 相关文档 | | -------- | -------- | -------- | | 了解OpenHarmony | 整体认知OpenHarmony | - [OpenHarmony概述](https://gitee.com/openharmony)
- [术语](../glossary.md) | | 获取开发资源 | 准备开发前相关资源 | - [获取源码](get-code/sourcecode-acquire.md)
- [获取工具](get-code/gettools-acquire.md) | -| 快速入门 | 快速熟悉OpenHarmony环境搭建、编译、烧录、调测、运行。 | [轻量和小型系统快速入门](quick-start/quickstart-ide-lite-overview.md) | +| 快速入门 | 快速熟悉OpenHarmony环境搭建、编译、烧录、调测、运行 | [轻量和小型系统快速入门](quick-start/quickstart-ide-lite-overview.md) | | 基础能力使用 | 使用OpenHarmony提供的基础能力 | - [轻量系统内核开发指南](kernel/kernel-mini-overview.md)
- [小型系统内核开发指南](kernel/kernel-small-overview.md)
- [驱动开发指南](driver/driver-hdf-overview.md)
- [子系统开发指南](subsystems/subsys-build-mini-lite.md)
- [安全指南](security/security-guidelines-overall.md)
- [隐私保护](security/security-privacy-protection.md) | | 进阶开发 | 结合系统能力开发智能设备 | - [WLAN连接类产品](guide/device-wlan-led-control.md)
- [无屏摄像头类产品](guide/device-iotcamera-control-overview.md)
- [带屏摄像头类产品](guide/device-camera-control-overview.md) | | 移植适配 | - 针对特定芯片做移植适配
- 对三方库进行移植适配 | - [轻量系统芯片移植指导](porting/porting-minichip.md)
- [小型系统芯片移植指导](porting/porting-smallchip-prepare-needs.md)
- [轻量和小型系统三方库移植指导](porting/porting-thirdparty-overview.md) | @@ -44,12 +44,12 @@ OpenHarmony也提供了一系列可选的系统组件,方便设备开发者按 | 参考 | 开发参考 | [常见问题](faqs/faqs-overview.md) | -**表 2** 标准系统开发指导(参考内存≥128MB) +**表 2** 标准系统开发指导(参考内存≥128MiB) | 学习路径 | 开发者业务 | 相关文档 | | -------- | -------- | -------- | | 了解OpenHarmony | 整体认知OpenHarmony | - [OpenHarmony概述](https://gitee.com/openharmony)
- [术语](../glossary.md) | | 获取开发资源 | 准备开发前相关资源 | - [获取源码](get-code/sourcecode-acquire.md)
- [获取工具](get-code/gettools-acquire.md) | -| 快速入门 | 快速熟悉OpenHarmony环境搭建、编译、烧录、调测、运行。 | [标准系统快速入门](quick-start/quickstart-ide-standard-overview.md) | +| 快速入门 | 快速熟悉OpenHarmony环境搭建、编译、烧录、调测、运行 | [标准系统快速入门](quick-start/quickstart-ide-standard-overview.md) | | 基础能力使用 | 使用OpenHarmony提供的基础能力 | - [内核开发指南](kernel/kernel-standard.md)
- [驱动开发指南](driver/driver-hdf-overview.md)
- [子系统开发指南](subsystems/subsys-build-standard-large.md)
- [安全指南](security/security-guidelines-overall.md)
- [隐私保护](security/security-privacy-protection.md) | | 进阶开发 | 结合系统能力开发智能设备 | - [时钟应用开发指导](guide/device-clock-guide.md)
- [平台驱动开发示例](guide/device-driver-demo.md)
- [外设驱动开发示例](guide/device-outerdriver-demo.md) | | 移植适配 | 对三方库进行移植适配 | - [标准系统芯片移植指导](porting/standard-system-porting-guide.md)
- [一种快速移植OpenHarmony Linux内核的方法](porting/porting-linux-kernel.md) | diff --git a/zh-cn/device-dev/driver/driver-platform-watchdog-des.md b/zh-cn/device-dev/driver/driver-platform-watchdog-des.md index 29457de37e855ce2355554f8640b271c8d85f009..9b3b0a38cc19983d85d6a0ff2c46d21211031461 100644 --- a/zh-cn/device-dev/driver/driver-platform-watchdog-des.md +++ b/zh-cn/device-dev/driver/driver-platform-watchdog-des.md @@ -10,15 +10,18 @@ **表1** 看门狗API接口功能介绍 -| 功能分类 | 接口描述 | +| 接口 | 接口描述 | | -------- | -------- | -| 打开/关闭看门狗 | WatchdogOpen:打开看门狗设备
WatchdogClose:关闭看门狗设备 | -| 启动/停止看门狗 | WatchdogStart:启动看门狗
WatchdogStop:停止看门狗 | -| 设置/获取超时时间 | WatchdogSetTimeout:设置看门狗超时时间
WatchdogGetTimeout:获取看门狗超时时间 | -| 获取看门狗状态 | WatchdogGetStatus:获取看门狗状态 | -| 清除看门狗定时器 | WatchdogFeed:清除看门狗定时器(喂狗) | - -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +| WatchdogOpen | 打开看门狗 | +| WatchdogClose | 关闭看门狗 | +| WatchdogStart | 启动看门狗 | +| WatchdogStop | 停止看门狗 | +| WatchdogSetTimeout | 设置看门狗超时时间 | +| WatchdogGetTimeout | 获取看门狗超时时间 | +| WatchdogGetStatus | 获取看门狗状态 | +| WatchdogFeed | 清除看门狗定时器(喂狗) | + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本文涉及的看门狗的所有接口,仅限内核态使用,不支持在用户态使用。 @@ -344,4 +347,4 @@ static int32_t TestCaseWatchdog(void) WatchdogClose(handle); return -1; } -``` +``` \ No newline at end of file diff --git a/zh-cn/device-dev/driver/driver-platform-watchdog-develop.md b/zh-cn/device-dev/driver/driver-platform-watchdog-develop.md index d8d49c2b74a2442873e8974b8c45552b9de67c27..ee489d1432db682584018dcdf78c1d154cbd21dd 100755 --- a/zh-cn/device-dev/driver/driver-platform-watchdog-develop.md +++ b/zh-cn/device-dev/driver/driver-platform-watchdog-develop.md @@ -3,7 +3,7 @@ ## 概述 -看门狗(Watchdog),又叫看门狗计时器(Watchdog timer),是一种硬件的计时设备,在HDF框架中,Watchdog接口适配模式采用独立服务模式,在这种模式下,每一个设备对象会独立发布一个设备服务来处理外部访问,设备管理器收到API的访问请求之后,通过提取该请求的参数,达到调用实际设备对象的相应内部方法的目的。独立服务模式可以直接借助HDFDeviceManager的服务管理能力,但需要为每个设备单独配置设备节点,增加内存占用。 +看门狗(Watchdog),又叫看门狗计时器(Watchdog timer),是一种硬件的计时设备。在HDF框架中,Watchdog接口适配模式采用独立服务模式,在这种模式下,每一个设备对象会独立发布一个设备服务来处理外部访问,设备管理器收到API的访问请求之后,通过提取该请求的参数,达到调用实际设备对象的相应内部方法的目的。独立服务模式可以直接借助HDFDeviceManager的服务管理能力,但需要为每个设备单独配置设备节点,增加内存占用。 **图1** Watchdog独立服务模式结构图 @@ -23,7 +23,7 @@ struct WatchdogMethod { int32_t (*start)(struct WatchdogCntlr *wdt); int32_t (*stop)(struct WatchdogCntlr *wdt); int32_t (*feed)(struct WatchdogCntlr *wdt); - int32_t (*getPriv)(struct WatchdogCntlr *wdt); //【可选】如果WatchdogCntlr 中的priv成员存在,则按需实例化 + int32_t (*getPriv)(struct WatchdogCntlr *wdt); //【可选】如果WatchdogCntlr中的priv成员存在,则按需实例化 void (*releasePriv)(struct WatchdogCntlr *wdt);//【可选】 }; ``` @@ -32,12 +32,12 @@ struct WatchdogMethod { | 成员函数 | 入参 | 出参 | 返回值 | 功能 | | -------- | -------- | -------- | -------- | -------- | -| getStatus | wdt: 结构体指针,核心层WDG控制器; | status: int32_t指针,表示狗的状态(打开或关闭); | HDF_STATUS相关状态 | 获取看门狗所处的状态 | -| start | wdt: 结构体指针,核心层WDG控制器; | 无 | HDF_STATUS相关状态 | 打开开门狗 | -| stop | wdt: 结构体指针,核心层WDG控制器; | 无 | HDF_STATUS相关状态 | 关闭开门狗 | -| setTimeout | wdt: 结构体指针,核心层WDG控制器;seconds: uint32_t,时间传入值; | 无 | HDF_STATUS相关状态 | 设置超时时间值,单位秒,需要保证看门狗实际运行的时间符合该值 | -| getTimeout | wdt: 结构体指针,核心层WDG控制器; | seconds: uint32_t,传出的时间值 | HDF_STATUS相关状态 | 回读设置的超时时间值 | -| feed | wdt: 结构体指针,核心层WDG控制器; | 无 | HDF_STATUS相关状态 | 喂狗 | +| getStatus | wdt: 结构体指针,核心层WDG控制器 | status: int32_t指针,表示狗的状态(打开或关闭) | HDF_STATUS相关状态 | 获取看门狗所处的状态 | +| start | wdt: 结构体指针,核心层WDG控制器 | 无 | HDF_STATUS相关状态 | 打开开门狗 | +| stop | wdt: 结构体指针,核心层WDG控制器 | 无 | HDF_STATUS相关状态 | 关闭开门狗 | +| setTimeout | wdt: 结构体指针,核心层WDG控制器 | seconds: uint32_t,时间传入值; | 无 | HDF_STATUS相关状态 | 设置超时时间值,单位秒,需要保证看门狗实际运行的时间符合该值 | +| getTimeout | wdt: 结构体指针,核心层WDG控制器 | seconds: uint32_t,传出的时间值 | HDF_STATUS相关状态 | 回读设置的超时时间值 | +| feed | wdt: 结构体指针,核心层WDG控制器 | 无 | HDF_STATUS相关状态 | 喂狗 | ## 开发步骤 @@ -55,7 +55,7 @@ Watchdog模块适配HDF框架的三个环节是配置属性文件,实例化驱 3. **实例化Watchdog控制器对象:** - 初始化WatchdogCntlr成员。 - 实例化WatchdogCntlr成员WatchdogMethod。 - > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** + > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 实例化WatchdogCntlr成员WatchdogMethod,其定义和成员说明见[接口说明](#接口说明)。 4. **驱动调试:** @@ -74,17 +74,17 @@ Watchdog模块适配HDF框架的三个环节是配置属性文件,实例化驱 ``` struct HdfDriverEntry g_watchdogDriverEntry = { .moduleVersion = 1, - .Bind = Hi35xxWatchdogBind, //见Bind参考 - .Init = Hi35xxWatchdogInit, //见Init参考 - .Release = Hi35xxWatchdogRelease, //见Release参考 - .moduleName = "HDF_PLATFORM_WATCHDOG",//【必要且与HCS文件中里面的moduleName匹配】 + .Bind = Hi35xxWatchdogBind, // 见Bind参考 + .Init = Hi35xxWatchdogInit, // 见Init参考 + .Release = Hi35xxWatchdogRelease, // 见Release参考 + .moduleName = "HDF_PLATFORM_WATCHDOG",// 【必要且与HCS文件中里面的moduleName匹配】 }; - HDF_INIT(g_watchdogDriverEntry);//调用HDF_INIT将驱动入口注册到HDF框架中 + HDF_INIT(g_watchdogDriverEntry);// 调用HDF_INIT将驱动入口注册到HDF框架中 ``` 2. 完成驱动入口注册之后,下一步请在device_info.hcs文件中添加deviceNode信息,并在 watchdog_config.hcs 中配置器件属性。deviceNode信息与驱动入口注册相关,器件属性值与核心层WatchdogCntlr 成员的默认值或限制范围有密切关系。 本例只有一个Watchdog控制器,如有多个器件信息,则需要在device_info文件增加deviceNode信息,以及在watchdog_config文件中增加对应的器件属性。 - - device_info.hcs 配置参考。 + - device_info.hcs 配置参考: ``` @@ -108,20 +108,20 @@ Watchdog模块适配HDF框架的三个环节是配置属性文件,实例化驱 } ``` - - watchdog_config.hcs 配置参考。 + - watchdog_config.hcs 配置参考: ``` root { platform { - template watchdog_controller {//【必要】模板配置,继承该模板的节点如果使用模板中的默认值,则节点字段可以缺省 + template watchdog_controller {// 【必要】模板配置,继承该模板的节点如果使用模板中的默认值,则节点字段可以缺省 id = 0; match_attr = ""; - regBase = 0x12050000; //【必要】地址映射需要 - regStep = 0x1000; //【必要】地址映射需要 + regBase = 0x12050000; // 【必要】地址映射需要 + regStep = 0x1000; // 【必要】地址映射需要 } - controller_0x12050000 :: watchdog_controller {//【必要】是作为设备驱动私有数据匹配的关键字 - match_attr = "hisilicon_hi35xx_watchdog_0"; //【必要】必须和device_info.hcs中的deviceMatchAttr值一致 + controller_0x12050000 :: watchdog_controller {// 【必要】是作为设备驱动私有数据匹配的关键字 + match_attr = "hisilicon_hi35xx_watchdog_0"; // 【必要】必须和device_info.hcs中的deviceMatchAttr值一致 } //存在多个 watchdog 时【必须】添加,否则不用 ... @@ -137,20 +137,20 @@ Watchdog模块适配HDF框架的三个环节是配置属性文件,实例化驱 ``` struct Hi35xxWatchdog { - struct WatchdogCntlr wdt; //【必要】是链接上下层的载体,具体描述见下面 + struct WatchdogCntlr wdt; // 【必要】是链接上下层的载体,具体描述见下面 OsalSpinlock lock; - volatile unsigned char *regBase;//【必要】地址映射需要 - uint32_t phyBase; //【必要】地址映射需要 - uint32_t regStep; //【必要】地址映射需要 + volatile unsigned char *regBase;// 【必要】地址映射需要 + uint32_t phyBase; // 【必要】地址映射需要 + uint32_t regStep; // 【必要】地址映射需要 }; //WatchdogCntlr是核心层控制器结构体,其中的成员在Init函数中会被赋值 struct WatchdogCntlr { - struct IDeviceIoService service;//驱动服务 - struct HdfDeviceObject *device; //驱动设备 - OsalSpinlock lock; //此变量在HDF核心层被调用来实现自旋锁功能 - struct WatchdogMethod *ops; //接口回调函数 - int16_t wdtId; //WDG设备的识别id - void *priv; //存储指针 + struct IDeviceIoService service;// 驱动服务 + struct HdfDeviceObject *device; // 驱动设备 + OsalSpinlock lock; // 此变量在HDF核心层被调用来实现自旋锁功能 + struct WatchdogMethod *ops; // 接口回调函数 + int16_t wdtId; // WDG设备的识别id + void *priv; // 存储指针 }; ``` - WatchdogCntlr成员回调函数结构体WatchdogMethod的实例化,其他成员在Init和Bind函数中初始化。 @@ -167,7 +167,7 @@ Watchdog模块适配HDF框架的三个环节是配置属性文件,实例化驱 }; ``` - - Init函数和Bind函数参考 + - Init函数和Bind函数参考: 入参: @@ -210,12 +210,12 @@ Watchdog模块适配HDF框架的三个环节是配置属性文件,实例化驱 ... hwdt->regBase = OsalIoRemap(hwdt->phyBase, hwdt->regStep); //地址映射 ... - hwdt->wdt.priv = (void *)device->property;//【可选】此处是将设备属性的内容赋值给priv成员,但后续没有调用 priv 成员, + hwdt->wdt.priv = (void *)device->property;// 【可选】此处是将设备属性的内容赋值给priv成员,但后续没有调用 priv 成员, // 如果需要用到priv成员,需要额外实例化WatchdogMethod的getPriv和releasePriv成员函数 - hwdt->wdt.ops = &g_method; //【必要】将实例化后的对象赋值给ops成员,就可以实现顶层调用WatchdogMethod成员函数 - hwdt->wdt.device = device; //【必要】这是为了方便HdfDeviceObject与WatchdogcCntlr相互转化 - ret = WatchdogCntlrAdd(&hwdt->wdt); //【必要】调用此函数初始化核心层结构体,返回成功信号后驱动才完全接入平台核心层 - if (ret != HDF_SUCCESS) { //不成功的话,需要释放Init函数申请的资源 + hwdt->wdt.ops = &g_method; // 【必要】将实例化后的对象赋值给ops成员,就可以实现顶层调用WatchdogMethod成员函数 + hwdt->wdt.device = device; // 【必要】这是为了方便HdfDeviceObject与WatchdogcCntlr相互转化 + ret = WatchdogCntlrAdd(&hwdt->wdt); // 【必要】调用此函数初始化核心层结构体,返回成功信号后驱动才完全接入平台核心层 + if (ret != HDF_SUCCESS) { // 不成功的话,需要释放Init函数申请的资源 OsalIoUnmap((void *)hwdt->regBase); OsalMemFree(hwdt); return ret; @@ -223,11 +223,11 @@ Watchdog模块适配HDF框架的三个环节是配置属性文件,实例化驱 return HDF_SUCCESS; } ``` - - Release函数参考 + - Release函数参考: 入参: - HdfDeviceObject :HDF框架给每一个驱动创建的设备对象,用来保存设备相关的私有数据和服务接口。 + HdfDeviceObject:HDF框架给每一个驱动创建的设备对象,用来保存设备相关的私有数据和服务接口。 返回值: @@ -244,17 +244,17 @@ Watchdog模块适配HDF框架的三个环节是配置属性文件,实例化驱 struct WatchdogCntlr *wdt = NULL; struct Hi35xxWatchdog *hwdt = NULL; ... - wdt = WatchdogCntlrFromDevice(device);//这里会通过service成员将HdfDeviceObject转化为WatchdogCntlr - //return (device == NULL) ? NULL : (struct WatchdogCntlr *)device->service; + wdt = WatchdogCntlrFromDevice(device);// 这里会通过service成员将HdfDeviceObject转化为WatchdogCntlr + // return (device == NULL) ? NULL : (struct WatchdogCntlr *)device->service; if (wdt == NULL) { return; } - WatchdogCntlrRemove(wdt); //核心层函数,实际执行wdt->device->service = NULL以及cntlr->lock的释放 - hwdt = (struct Hi35xxWatchdog *)wdt; //这里将WatchdogCntlr转化为HimciHost - if (hwdt->regBase != NULL) { //解除地址映射 + WatchdogCntlrRemove(wdt); // 核心层函数,实际执行wdt->device->service = NULL以及cntlr->lock的释放 + hwdt = (struct Hi35xxWatchdog *)wdt; // 这里将WatchdogCntlr转化为HimciHost + if (hwdt->regBase != NULL) { // 解除地址映射 OsalIoUnmap((void *)hwdt->regBase); hwdt->regBase = NULL; } - OsalMemFree(hwdt); //释放厂商自定义对象占用的内存 + OsalMemFree(hwdt); // 释放厂商自定义对象占用的内存 } ``` diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-lite-env-setup-win-ubuntu.md b/zh-cn/device-dev/quick-start/quickstart-ide-lite-env-setup-win-ubuntu.md index 2ace66a732a0e7544297914c5fdd4d00ae2b2af6..70fce953e3b7e3a0b38c579ed8059baf756e572e 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-lite-env-setup-win-ubuntu.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-lite-env-setup-win-ubuntu.md @@ -1,7 +1,7 @@ # 搭建Windows+Ubuntu混合开发环境 -通常在嵌入式开发中,很多开发者习惯于使用Windows进行代码的编辑,比如使用Windows的Visual Studio Code进行OpenHarmony代码的开发。但当前阶段,大部分的开发板源码还不支持在Windows环境下进行编译,如Hi3861、Hi3516系列开发板。因此,需要使用Ubuntu的编译环境对源码进行编译。 +通常在嵌入式开发中,很多开发者习惯于使用Windows进行代码的编辑,比如使用Windows的Visual Studio Code进行OpenHarmony代码的开发。但当前阶段,大部分的开发板源码还不支持在Windows环境下进行编译,如Hi3861、Hi3516系列开发板。此时,可以使用Ubuntu的编译环境对源码进行编译。 在以上的设备开发场景中,可以搭建一套Windows+Ubuntu混合开发的环境,其中使用Windows平台的DevEco Device Tool可视化界面进行相关操作,通过远程连接的方式对接Ubuntu下的DevEco Device Tool(可以不安装Visual Studio Code),然后对Ubuntu下的源码进行开发、编译、烧录等操作。 diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-lite-introduction-hi3516.md b/zh-cn/device-dev/quick-start/quickstart-ide-lite-introduction-hi3516.md index c0e420294b3a6e05dfd96f96d9d48d32ab58fbf9..a3b2887dccd86defd30624c103297ec5405099a1 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-lite-introduction-hi3516.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-lite-introduction-hi3516.md @@ -3,7 +3,7 @@ ## 简介 -Hi3516DV300作为新一代行业专用Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器,同时集成高性能NNIE引擎,使得Hi3516DV300在低码率、高画质、智能处理和分析、低功耗等方面引领行业水平。 +Hi3516DV300作为新一代行业专用Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器以及高性能NNIE引擎,具备低码率、高画质、低功耗等特点,并具备强劲的智能处理和分析能力。 **图1** Hi3516单板正面外观图 diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-lite-overview.md b/zh-cn/device-dev/quick-start/quickstart-ide-lite-overview.md index 3f1b6b56cb815e006e5f4ce5ccf7b9f3a108ebc4..43dce30b0a3021d7241bf232fb22c7239ca07e7a 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-lite-overview.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-lite-overview.md @@ -12,12 +12,12 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存 - 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。 OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 -本文采用Deveco Device Tool进行一站式开发介绍,习惯使用命令行的开发者可参考[轻量和小型系统快速入门(安装包方式)](../quick-start/quickstart-lite-package-directory.md)。 +本文采用Deveco Device Tool进行一站式开发介绍,习惯使用命令行的开发者可参考[轻量和小型系统快速入门(安装包方式)](../quick-start/quickstart-lite-overview.md)。 ## 开发环境 -开发者通常习惯采用Windows+Ubuntu环境进行OpenHarmony开发: +推荐开发者采用Windows+Ubuntu环境进行OpenHarmony开发: - Windows:用于源码开发、烧录等。 @@ -28,7 +28,7 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存 ## 开发板 -本文基于以下两款典型开发板进行开发介绍 :Hi3861 WLAN模组、Hi3516DV300。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-ide-lite-board-introduction.md),开发者可根据需要自行购买开发板。 +本文基于以下两款典型开发板进行开发介绍 :Hi3861 WLAN模组、Hi3516DV300。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-ide-lite-introduction-hi3861.md),开发者可根据需要自行购买开发板。 ## 开发流程 diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-lite-sourcecode-acquire.md b/zh-cn/device-dev/quick-start/quickstart-ide-lite-sourcecode-acquire.md index 4558077deaccbf400db66d5d8c3a3da352df9b2c..8c10913bcdc7cd4d9a38c7e3d58b47af94637b9c 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-lite-sourcecode-acquire.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-lite-sourcecode-acquire.md @@ -1,7 +1,7 @@ # 获取源码 -在Ubuntu环境下通过以下步骤拉取OpenHarmony源码。 +在Ubuntu环境下通过以下步骤获取OpenHarmony源码。 ## 准备工作 @@ -41,7 +41,7 @@ ``` -## 获取源码 +## 获取方式 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > Master主干为开发分支,开发者可通过Master主干获取最新特性。发布分支代码相对比较稳定,开发者可基于发布分支代码进行商用功能开发。 diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-burn.md b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-burn.md index 997dbb125390e8de6d359d3d153d5354b1493074..bdc4896bf0c6810c1b8ea128902e4348e71437e9 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-burn.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-burn.md @@ -6,7 +6,9 @@ Hi3516DV300支持USB烧录、网口烧录和串口烧录三种方式,本文采 1. 请连接好电脑和待烧录开发板,需要同时连接串口和USB口,具体可参考[Hi3516DV300开发板介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md)。 -2. 在DevEco Device Tool中,选择REMOTE DEVELOPMENT > Local PC,查看远程计算机(Ubuntu开发环境)与本地计算机(Windows开发环境)的连接状态。 +2. 根据[Hi3516DV300/Hi3518EV300开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/documentation/guide/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。若您的设备中已安装此驱动,请忽略该步骤。 + +3. 在DevEco Device Tool中,选择REMOTE DEVELOPMENT > Local PC,查看远程计算机(Ubuntu开发环境)与本地计算机(Windows开发环境)的连接状态。 - 如果Local PC右边连接按钮为![zh-cn_image_0000001261315939](figures/zh-cn_image_0000001261315939.png),则远程计算机与本地计算机为已连接状态,不需要执行其他操作。 - 如果Local PC右边连接按钮为![zh-cn_image_0000001261515989](figures/zh-cn_image_0000001261515989.png),则点击绿色连接进行按钮。 @@ -16,18 +18,15 @@ Hi3516DV300支持USB烧录、网口烧录和串口烧录三种方式,本文采 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 该操作仅在远程模式(Windows+Ubuntu混合开发环境)中需要设置,如果采用本地模式(Windows开发环境或Ubuntu开发环境),则请跳过该步骤。 -3. 在DevEco Device Tool中,点击QUICK ACCESS > DevEco Home > Device,查看并记录对应的串口号。 +4. 在DevEco Device Tool中,点击QUICK ACCESS > DevEco Home > Device,查看并记录对应的串口号。 ![zh-cn_image_0000001216516128](figures/zh-cn_image_0000001216516128.png) - > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** - > 如果对应的串口异常,请根据[Hi3516DV300/Hi3518EV300开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/documentation/guide/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。 - -4. 在QUICK ACCESS > DevEco Home > Projects中,点击**Settings**打开工程配置界面。 +5. 在QUICK ACCESS > DevEco Home > Projects中,点击**Settings**打开工程配置界面。 ![zh-cn_image_0000001198566364](figures/zh-cn_image_0000001198566364.png) -5. 在“hi3516dv300”页签,设置烧录选项,包括upload_partitions、upload_port和upload_protocol。 +6. 在“hi3516dv300”页签,设置烧录选项,包括upload_partitions、upload_port和upload_protocol。 - upload_partitions:选择待烧录的文件,默认情况下会同时烧录fastboot、kernel、rootfs和userfs。 - upload_port:选择已查询到的串口号。 @@ -35,7 +34,7 @@ Hi3516DV300支持USB烧录、网口烧录和串口烧录三种方式,本文采 ![zh-cn_image_0000001223190441](figures/zh-cn_image_0000001223190441.png) -6. 分别检查待烧录文件的烧录信息,DevEco Device Tool已预置默认的烧录文件信息,可根据实际情况进行调整。待烧录文件包括:fastboot、kernel、rootfs和userfs。 +7. 分别检查待烧录文件的烧录信息,DevEco Device Tool已预置默认的烧录文件信息,可根据实际情况进行调整。待烧录文件包括:fastboot、kernel、rootfs和userfs。 1. 在“hi3516dv300_fastboot”页签,在New Option选项中选择需要修改的项,例如partition_bin(烧录文件路径)、partition_addr(烧录文件起始地址)、partition_length(烧录文件分区长度)等。 @@ -50,21 +49,18 @@ Hi3516DV300支持USB烧录、网口烧录和串口烧录三种方式,本文采 3. 按照相同的方法修改kernel、rootfs和userfs的烧录文件信息。 -7. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 +8. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 -8. 点击hi3516dv300下的**Upload**按钮,启动烧录。 - - > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** - > 如果您是第一次在工作台烧录Hi3516DV300/Hi3518EV300开发板,可能烧录失败,提示“not find the Devices”,然后根据[Hi3516DV300/Hi3518EV300开发板USB驱动安装](https://device.harmonyos.com/cn/docs/documentation/guide/usb_driver-0000001058690393)进行处理后再重新烧录。 +9. 点击hi3516dv300下的**Upload**按钮,启动烧录。 ![zh-cn_image_0000001267231481](figures/zh-cn_image_0000001267231481.png) -9. 在终端窗口显示如下提示信息时,按住复位键,插拔USB线,最后松开复位键启动烧录。 +10. 在终端窗口显示如下提示信息时,按住复位键,插拔USB线,最后松开复位键启动烧录。 - ![zh-cn_image_0000001114129426](figures/zh-cn_image_0000001114129426.png) + ![zh-cn_image_0000001114129426](figures/zh-cn_image_0000001114129426.png) - 启动烧录后,界面提示如下信息时,表示烧录成功。 + 启动烧录后,界面提示如下信息时,表示烧录成功。 - ![zh-cn_image_0000001160649343](figures/zh-cn_image_0000001160649343.png) + ![zh-cn_image_0000001160649343](figures/zh-cn_image_0000001160649343.png) -10. 烧录成功后,请根据镜像运行章节进行操作,启动系统。 +11. 烧录成功后,请根据[运行](quickstart-ide-lite-steps-hi3516-running.md)章节进行操作,启动系统。 diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-burn.md b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-burn.md index 18fb1a3a32ed0b7e51c686a4ef545e9b1bfdf16a..2ee9e414ca7186d3b2bbe52c255b25ee100a7ce0 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-burn.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-burn.md @@ -6,7 +6,9 @@ Hi3861V100开发板支持串口烧录方式,在Windows下通过以下步骤进 1. 请连接好电脑和待烧录开发板,需要连接USB口,具体可参考[Hi3861V100开发板介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3861.md)。 -2. 在DevEco Device Tool中,选择REMOTE DEVELOPMENT > Local PC,查看远程计算机(Ubuntu开发环境)与本地计算机(Windows开发环境)的连接状态。 +2. 根据[Hi3861V100开发板串口驱动安装](https://device.harmonyos.com/cn/docs/documentation/guide/hi3861-drivers-0000001058153433)安装USB转串口的驱动程序。若您的设备中已安装此驱动,请忽略该步骤。 + +3. 在DevEco Device Tool中,选择REMOTE DEVELOPMENT > Local PC,查看远程计算机(Ubuntu开发环境)与本地计算机(Windows开发环境)的连接状态。 - 如果Local PC右边连接按钮为![zh-cn_image_0000001261315939](figures/zh-cn_image_0000001261315939.png),则远程计算机与本地计算机为已连接状态,不需要执行其他操作。 - 如果Local PC右边连接按钮为![zh-cn_image_0000001261515989](figures/zh-cn_image_0000001261515989.png),则点击绿色连接进行按钮。 @@ -16,18 +18,15 @@ Hi3861V100开发板支持串口烧录方式,在Windows下通过以下步骤进 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 该操作仅在远程模式(Windows+Ubuntu混合开发环境)中需要设置,如果采用本地模式(Windows开发环境或Ubuntu开发环境),则请跳过该步骤。 -3. 在DevEco Device Tool中,点击QUICK ACCESS > DevEco Home > Device,查看并记录对应的串口号。 +4. 在DevEco Device Tool中,点击QUICK ACCESS > DevEco Home > Device,查看并记录对应的串口号。 ![zh-cn_image_0000001216274840](figures/zh-cn_image_0000001216274840.png) - > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** - > 如果对应的串口异常,请根据[Hi3861V100开发板串口驱动安装](https://device.harmonyos.com/cn/docs/documentation/guide/hi3861-drivers-0000001058153433)安装USB转串口的驱动程序。 - -4. 在QUICK ACCESS > DevEco Home > Projects中,点击**Settings**打开工程配置界面。 +5. 在QUICK ACCESS > DevEco Home > Projects中,点击**Settings**打开工程配置界面。 ![zh-cn_image_0000001198943768](figures/zh-cn_image_0000001198943768.png) -5. 在“hi3861”页签,设置烧录选项,包括upload_port、upload_protocol和upload_partitions。 +6. 在“hi3861”页签,设置烧录选项,包括upload_port、upload_protocol和upload_partitions。 - upload_port:选择已查询的串口号。 - upload_protocol:选择烧录协议,选择“hiburn-serial”。 @@ -35,22 +34,22 @@ Hi3861V100开发板支持串口烧录方式,在Windows下通过以下步骤进 ![zh-cn_image_0000001243704061](figures/zh-cn_image_0000001243704061.png) -6. 检查待烧录文件的烧录信息,DevEco Device Tool已预置默认的烧录文件信息,可根据实际情况进行调整。 +7. 检查待烧录文件的烧录信息,DevEco Device Tool已预置默认的烧录文件信息,可根据实际情况进行调整。 在“hi3861_app”页签,在New Option选项中选择partition_bin(烧录文件路径),然后设置待烧录文件的地址。 ![zh-cn_image_0000001260919759](figures/zh-cn_image_0000001260919759.png) -7. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 +8. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 -8. 点击**Open**打开工程文件,然后在“PROJECT TASKS”中,点击hi3861下的**Upload**按钮,启动烧录。 +9. 点击**Open**打开工程文件,然后在“PROJECT TASKS”中,点击hi3861下的**Upload**按钮,启动烧录。 ![zh-cn_image_0000001216440138](figures/zh-cn_image_0000001216440138.png) -9. 启动烧录后,显示如下提示信息时,请按开发板上的RST按钮重启开发板。 +10. 启动烧录后,显示如下提示信息时,请按开发板上的RST按钮重启开发板。 - ![zh-cn_image_0000001198466090](figures/zh-cn_image_0000001198466090.png) + ![zh-cn_image_0000001198466090](figures/zh-cn_image_0000001198466090.png) -10. 重新上电后,界面提示如下信息时,表示烧录成功。 +11. 重新上电后,界面提示如下信息时,表示烧录成功。 - ![zh-cn_image_0000001216761476](figures/zh-cn_image_0000001216761476.png) + ![zh-cn_image_0000001216761476](figures/zh-cn_image_0000001216761476.png) diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-standard-board-introduction-hi3516.md b/zh-cn/device-dev/quick-start/quickstart-ide-standard-board-introduction-hi3516.md index fe7e28246dea89f0f07384d7ce5d1401a1229972..afd3e00d7c950a25e433f3971e78e5f8ae96bdd7 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-standard-board-introduction-hi3516.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-standard-board-introduction-hi3516.md @@ -3,7 +3,7 @@ ## 开发板简介 -Hi3516DV300是新一代行业专用Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器、高性能NNIE引擎,在低码率、高画质、智能处理和分析、低功耗等方面引领行业水平。 +Hi3516DV300作为新一代行业专用Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器以及高性能NNIE引擎,具备低码率、高画质、低功耗等特点,并具备强劲的智能处理和分析能力。 **图1** Hi3516单板正面外观图 diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-standard-env-setup-win-ubuntu.md b/zh-cn/device-dev/quick-start/quickstart-ide-standard-env-setup-win-ubuntu.md index e9078ff9c80c13a5bf59dc85de2b416d45376e09..48fef1c494d139ae3ec58ef49074571631d01f4f 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-standard-env-setup-win-ubuntu.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-standard-env-setup-win-ubuntu.md @@ -1,7 +1,7 @@ # 搭建Windows+Ubuntu混合开发环境 -通常在嵌入式开发中,很多开发者习惯于使用Windows进行代码的编辑,比如使用Windows的Visual Studio Code进行OpenHarmony代码的开发。但当前阶段,大部分的开发板源码还不支持在Windows环境下进行编译,如Hi3861、Hi3516系列开发板。因此,需要使用Ubuntu的编译环境对源码进行编译。 +通常在嵌入式开发中,很多开发者习惯于使用Windows进行代码的编辑,比如使用Windows的Visual Studio Code进行OpenHarmony代码的开发。但当前阶段,大部分的开发板源码还不支持在Windows环境下进行编译,如Hi3861、Hi3516系列开发板。此时,可以使用Ubuntu的编译环境对源码进行编译。 在以上的设备开发场景中,可以搭建一套Windows+Ubuntu混合开发的环境,其中使用Windows平台的DevEco Device Tool可视化界面进行相关操作,通过远程连接的方式对接Ubuntu下的DevEco Device Tool(可以不安装Visual Studio Code),然后对Ubuntu下的源码进行开发、编译、烧录等操作。 diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-standard-overview.md b/zh-cn/device-dev/quick-start/quickstart-ide-standard-overview.md index a63a062889da8bdf6e09308e52abb0a511060977..0b3ff6ea3b9896a9c816845be7223fc274b51bd2 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-standard-overview.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-standard-overview.md @@ -7,17 +7,17 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文, 考虑到开发者的开发习惯,OpenHarmony为开发者提供了以下两种入门指导: -- IDE方式:完全采用IDE(Deveco Device Tool)进行一站式开发,编译依赖工具的安装及编译、烧录、运行都通过IDE进行操作。 +- IDE方式:完全采用IDE(DevEco Device Tool)进行一站式开发,编译依赖工具的安装及编译、烧录、运行都通过IDE进行操作。 - 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。 OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 -本文采用Deveco Device Tool进行一站式开发介绍,习惯使用命令行的开发者可参考[标准系统快速入门(安装包方式)](../quick-start/quickstart-standard-package-directory.md)。 +本文采用DevEco Device Tool进行一站式开发介绍,习惯使用命令行的开发者可参考[标准系统快速入门(安装包方式)](../quick-start/quickstart-standard-overview.md)。 ## 开发环境 -开发者通常习惯采用Windows+Ubuntu环境进行OpenHarmony开发: +推荐开发者采用Windows+Ubuntu环境进行OpenHarmony开发: - Windows:用于源码开发、烧录等。 @@ -28,7 +28,7 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文, ## 开发板 -本文选取了两款典型开发板:Hi3516DV300、RK3568,并基于上述两款开发板进行开发介绍。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-standard-board-introduction.md),开发者可根据需要自行购买开发板。 +本文选取了两款典型开发板:Hi3516DV300、RK3568,并基于上述两款开发板进行开发介绍。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-ide-standard-board-introduction-hi3516.md),开发者可根据需要自行购买开发板。 ## 开发流程 diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-standard-running-hi3516-burning.md b/zh-cn/device-dev/quick-start/quickstart-ide-standard-running-hi3516-burning.md index 91eb2201ae897796459d41e0c73829a0fd854a6e..17b61de0288457cc4f556cb5b47563b936bdc2f4 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-standard-running-hi3516-burning.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-standard-running-hi3516-burning.md @@ -6,7 +6,9 @@ 1. 请连接好电脑和待烧录开发板,需要同时连接串口和USB口,具体可参考[Hi3516DV300开发板介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md)。 -2. 在DevEco Device Tool中,选择REMOTE DEVELOPMENT > Local PC,查看远程计算机(Ubuntu开发环境)与本地计算机(Windows开发环境)的连接状态。 +2. 根据[Hi3516DV300/Hi3518EV300开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/documentation/guide/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。若您的设备中已安装此驱动,请忽略该步骤。 + +3. 在DevEco Device Tool中,选择REMOTE DEVELOPMENT > Local PC,查看远程计算机(Ubuntu开发环境)与本地计算机(Windows开发环境)的连接状态。 - 如果Local PC右边连接按钮为![zh-cn_image_0000001261315939](figures/zh-cn_image_0000001261315939.png),则远程计算机与本地计算机为已连接状态,不需要执行其他操作。 - 如果Local PC右边连接按钮为![zh-cn_image_0000001261515989](figures/zh-cn_image_0000001261515989.png),则点击绿色连接进行按钮。 @@ -16,18 +18,15 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 该操作仅在远程模式(Windows+Ubuntu混合开发环境)中需要设置,如果采用本地模式(Windows开发环境或Ubuntu开发环境),则请跳过该步骤。 -3. 在DevEco Device Tool中,点击QUICK ACCESS > DevEco Home > Device,查看并记录对应的串口号。 +4. 在DevEco Device Tool中,点击QUICK ACCESS > DevEco Home > Device,查看并记录对应的串口号。 ![zh-cn_image_0000001216516128](figures/zh-cn_image_0000001216516128.png) - > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** - > 如果对应的串口异常,请根据[Hi3516DV300/Hi3518EV300开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/documentation/guide/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。 - -4. 在QUICK ACCESS > DevEco Home > Projects中,点击**Settings**打开工程配置界面。 +5. 在QUICK ACCESS > DevEco Home > Projects中,点击**Settings**打开工程配置界面。 ![zh-cn_image_0000001198566364](figures/zh-cn_image_0000001198566364.png) -5. 在“hi3516dv300”页签,设置烧录选项,包括upload_partitions、upload_port和upload_protocol。 +6. 在“hi3516dv300”页签,设置烧录选项,包括upload_partitions、upload_port和upload_protocol。 - upload_partitions:选择待烧录的文件,默认情况下会同时烧录fastboot、kernel、rootfs和userfs。 - upload_port:选择已查询到的串口号。 @@ -35,7 +34,7 @@ ![zh-cn_image_0000001223190441](figures/zh-cn_image_0000001223190441.png) -6. 分别检查待烧录文件的烧录信息,DevEco Device Tool已预置默认的烧录文件信息,可根据实际情况进行调整。待烧录文件包括:fastboot、kernel、rootfs和userfs。 +7. 分别检查待烧录文件的烧录信息,DevEco Device Tool已预置默认的烧录文件信息,可根据实际情况进行调整。待烧录文件包括:fastboot、kernel、rootfs和userfs。 1. 在“hi3516dv300_fastboot”页签,在New Option选项中选择需要修改的项,例如partition_bin(烧录文件路径)、partition_addr(烧录文件起始地址)、partition_length(烧录文件分区长度)等。 @@ -50,21 +49,18 @@ 3. 按照相同的方法修改kernel、rootfs和userfs的烧录文件信息。 -7. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 +8. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 -8. 点击hi3516dv300下的**Upload**按钮,启动烧录。 - - > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** - > 如果您是第一次在工作台烧录Hi3516DV300/Hi3518EV300开发板,可能烧录失败,提示“not find the Devices”,然后根据[Hi3516DV300/Hi3518EV300开发板USB驱动安装](https://device.harmonyos.com/cn/docs/documentation/guide/usb_driver-0000001058690393)进行处理后再重新烧录。 +9. 点击hi3516dv300下的**Upload**按钮,启动烧录。 ![zh-cn_image_0000001267231481](figures/zh-cn_image_0000001267231481.png) -9. 在终端窗口显示如下提示信息时,按住复位键,插拔USB线,最后松开复位键启动烧录。 +10. 在终端窗口显示如下提示信息时,按住复位键,插拔USB线,最后松开复位键启动烧录。 - ![zh-cn_image_0000001114129426](figures/zh-cn_image_0000001114129426.png) + ![zh-cn_image_0000001114129426](figures/zh-cn_image_0000001114129426.png) - 启动烧录后,界面提示如下信息时,表示烧录成功。 + 启动烧录后,界面提示如下信息时,表示烧录成功。 - ![zh-cn_image_0000001160649343](figures/zh-cn_image_0000001160649343.png) + ![zh-cn_image_0000001160649343](figures/zh-cn_image_0000001160649343.png) -10. 烧录成功后,请根据镜像运行章节进行操作,启动系统。 +11. 烧录成功后,请根据[运行](quickstart-ide-standard-running-hi3516-running.md)章节进行操作,启动系统。 diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-standard-sourcecode-acquire.md b/zh-cn/device-dev/quick-start/quickstart-ide-standard-sourcecode-acquire.md index aba0a3439fffb157d2b72498621bfb2d6576eeff..a19a83d8365223208e0840d0ce403dde74479347 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-standard-sourcecode-acquire.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-standard-sourcecode-acquire.md @@ -1,7 +1,7 @@ # 获取源码 -在Ubuntu环境下通过以下步骤拉取OpenHarmony源码。 +在Ubuntu环境下通过以下步骤获取OpenHarmony源码。 ## 前提条件 @@ -41,7 +41,7 @@ ``` -## 获取源码 +## 获取方式 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > Master主干为开发分支,开发者可通过Master主干获取最新特性。发布分支代码相对比较稳定,开发者可基于发布分支代码进行商用功能开发。 diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md b/zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md index d532100705baa187c2c2a825bca8ef1a4a7c223f..be0892ab022b5f5737b96e038b36217202998a3f 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md @@ -238,7 +238,7 @@ ## 获取源码 -在Ubuntu环境下通过以下步骤拉取OpenHarmony源码。 +在Ubuntu环境下通过以下步骤获取OpenHarmony源码。 ### 准备工作 @@ -278,7 +278,7 @@ ``` -### 获取源码 +### 获取方式 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > Master主干为开发分支,开发者可通过Master主干获取最新特性。发布分支代码相对比较稳定,开发者可基于发布分支代码进行商用功能开发。 diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md b/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md index 2424e5b823237f233eadac771ddfdde72ff8005e..f616bbbbad2a8efdcd8f687602410450049657c3 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md @@ -3,7 +3,7 @@ ## 简介 -Hi3516DV300作为新一代行业专用Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器,同时集成高性能NNIE引擎,使得Hi3516DV300在低码率、高画质、智能处理和分析、低功耗等方面引领行业水平。 +Hi3516DV300作为新一代行业专用Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器以及高性能NNIE引擎,具备低码率、高画质、低功耗等特点,并具备强劲的智能处理和分析能力。 **图1** Hi3516单板正面外观图 diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-overview.md b/zh-cn/device-dev/quick-start/quickstart-lite-overview.md index 865787f829656c8cfa8601266432e56094e65967..151592d2fe0d3aab44cfec641ddd05dfd0126b23 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-overview.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-overview.md @@ -15,12 +15,12 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存 - 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 -本文采用安装包方式进行介绍,习惯使用DevEco Device Tool的开发者可参考[轻量与小型系统快速入门(IDE方式)](../quick-start/quickstart-lite-ide-directory.md)。 +本文采用安装包方式进行介绍,习惯使用DevEco Device Tool的开发者可参考[轻量与小型系统快速入门(IDE方式)](../quick-start/quickstart-ide-lite-overview.md)。 ## 开发环境 -开发者通常习惯采用Windows+Ubuntu环境进行OpenHarmony开发: +推荐开发者采用Windows+Ubuntu环境进行OpenHarmony开发: - Windows:用于源码开发、烧录等。 @@ -31,7 +31,7 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存 ## 开发板 -本文基于以下两款典型开发板进行开发介绍 :Hi3861 WLAN模组、Hi3516DV300。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-lite-board-introduction.md),开发者可根据需要自行购买开发板。 +本文基于以下两款典型开发板进行开发介绍 :Hi3861 WLAN模组、Hi3516DV300。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-lite-introduction-hi3861.md),开发者可根据需要自行购买开发板。 ## 开发流程 diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-building.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-building.md index 2622d47f7d43f8be82273274f75b15594611c006..2b1c8dc4d78e7e77305927374ed85ab111877456 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-building.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-building.md @@ -42,7 +42,7 @@ OpenHarmony支持hb和build.sh两种编译方式。此处介绍hb方式,build. ![zh-cn_image_0000001271594749](figures/zh-cn_image_0000001271594749.png) -5. 编译结束后,出现“build success”字样,则证明构建成功。 +5. 编译结束后,出现“build success”字样,说明构建成功。 > ![icon-notice.gif](public_sys-resources/icon-notice.gif) **须知:** > 烧录相关文件获取路径: > diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-burn.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-burn.md index 909d3e44fc71fa645d3b6aea691f7db1dce42d46..e4bcfdb3ca57f4af3df2fed40cfe13a8f7b7f426 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-burn.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-burn.md @@ -40,7 +40,9 @@ Hi3516DV300支持USB烧录、网口烧录和串口烧录三种方式,本文采 1. 请连接好电脑和待烧录开发板,需要同时连接串口和USB口,具体可参考[Hi3516DV300开发板介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md)。 -2. 在DevEco Device Tool中,选择REMOTE DEVELOPMENT > Local PC,查看远程计算机(Ubuntu开发环境)与本地计算机(Windows开发环境)的连接状态。 +2. 根据[Hi3516DV300/Hi3518EV300开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/documentation/guide/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。若您的设备中已安装此驱动,请忽略该步骤。 + +3. 在DevEco Device Tool中,选择REMOTE DEVELOPMENT > Local PC,查看远程计算机(Ubuntu开发环境)与本地计算机(Windows开发环境)的连接状态。 - 如果Local PC右边连接按钮为![zh-cn_image_0000001261315939](figures/zh-cn_image_0000001261315939.png),则远程计算机与本地计算机为已连接状态,不需要执行其他操作。 - 如果Local PC右边连接按钮为![zh-cn_image_0000001261515989](figures/zh-cn_image_0000001261515989.png),则点击绿色连接进行按钮。 @@ -50,18 +52,15 @@ Hi3516DV300支持USB烧录、网口烧录和串口烧录三种方式,本文采 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 该操作仅在远程模式(Windows+Ubuntu混合开发环境)中需要设置,如果采用本地模式(Windows开发环境或Ubuntu开发环境),则请跳过该步骤。 -3. 在DevEco Device Tool中,点击QUICK ACCESS > DevEco Home > Device,查看并记录对应的串口号。 +4. 在DevEco Device Tool中,点击QUICK ACCESS > DevEco Home > Device,查看并记录对应的串口号。 ![zh-cn_image_0000001216516128](figures/zh-cn_image_0000001216516128.png) - > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** - > 如果对应的串口异常,请根据[Hi3516DV300/Hi3518EV300开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/documentation/guide/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。 - -4. 在QUICK ACCESS > DevEco Home > Projects中,点击**Settings**打开工程配置界面。 +5. 在QUICK ACCESS > DevEco Home > Projects中,点击**Settings**打开工程配置界面。 ![zh-cn_image_0000001198566364](figures/zh-cn_image_0000001198566364.png) -5. 在“hi3516dv300”页签,设置烧录选项,包括upload_partitions、upload_port和upload_protocol。 +6. 在“hi3516dv300”页签,设置烧录选项,包括upload_partitions、upload_port和upload_protocol。 - upload_partitions:选择待烧录的文件,默认情况下会同时烧录fastboot、kernel、rootfs和userfs。 - upload_port:选择已查询到的串口号。 @@ -69,7 +68,7 @@ Hi3516DV300支持USB烧录、网口烧录和串口烧录三种方式,本文采 ![zh-cn_image_0000001223190441](figures/zh-cn_image_0000001223190441.png) -6. 分别检查待烧录文件的烧录信息,DevEco Device Tool已预置默认的烧录文件信息,可根据实际情况进行调整。待烧录文件包括:fastboot、kernel、rootfs和userfs。 +7. 分别检查待烧录文件的烧录信息,DevEco Device Tool已预置默认的烧录文件信息,可根据实际情况进行调整。待烧录文件包括:fastboot、kernel、rootfs和userfs。 1. 在“hi3516dv300_fastboot”页签,在New Option选项中选择需要修改的项,例如partition_bin(烧录文件路径)、partition_addr(烧录文件起始地址)、partition_length(烧录文件分区长度)等。 @@ -84,21 +83,18 @@ Hi3516DV300支持USB烧录、网口烧录和串口烧录三种方式,本文采 3. 按照相同的方法修改kernel、rootfs和userfs的烧录文件信息。 -7. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 +8. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 -8. 点击hi3516dv300下的**Upload**按钮,启动烧录。 - - > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** - > 如果您是第一次在工作台烧录Hi3516DV300/Hi3518EV300开发板,可能烧录失败,提示“not find the Devices”,然后根据[Hi3516DV300/Hi3518EV300开发板USB驱动安装](https://device.harmonyos.com/cn/docs/documentation/guide/usb_driver-0000001058690393)进行处理后再重新烧录。 +9. 点击hi3516dv300下的**Upload**按钮,启动烧录。 ![zh-cn_image_0000001267231481](figures/zh-cn_image_0000001267231481.png) -9. 在终端窗口显示如下提示信息时,按住复位键,插拔USB线,最后松开复位键启动烧录。 +10. 在终端窗口显示如下提示信息时,按住复位键,插拔USB线,最后松开复位键启动烧录。 - ![zh-cn_image_0000001114129426](figures/zh-cn_image_0000001114129426.png) + ![zh-cn_image_0000001114129426](figures/zh-cn_image_0000001114129426.png) - 启动烧录后,界面提示如下信息时,表示烧录成功。 + 启动烧录后,界面提示如下信息时,表示烧录成功。 - ![zh-cn_image_0000001160649343](figures/zh-cn_image_0000001160649343.png) + ![zh-cn_image_0000001160649343](figures/zh-cn_image_0000001160649343.png) -10. 烧录成功后,请根据镜像运行章节进行操作,启动系统。 +11. 烧录成功后,请根据[运行](quickstart-lite-steps-hi3516-running.md)章节进行操作,启动系统。 diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-building.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-building.md index a7cc08cb1c8a12b394b459fd678200c2da5e3696..578394672bf86601eacb8b6baad5d757680289e3 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-building.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-building.md @@ -41,7 +41,7 @@ OpenHarmony支持hb和build.sh两种编译方式。此处介绍hb方式,build. ![zh-cn_image_0000001226634716](figures/zh-cn_image_0000001226634716.png) -5. 编译结束后,出现“build success”字样,则证明构建成功。 +5. 编译结束后,出现“build success”字样,说明构建成功。 > ![icon-notice.gif](public_sys-resources/icon-notice.gif) **须知:** > 编译结果文件及编译日志获取路径:out/hispark_pegasus/wifiiot_hispark_pegasus。 diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-burn.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-burn.md index d2139896825a1d36bb79261511d034cac533a649..d63f7e6821b8cd2ddcc9699fd159b685f9c10e9f 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-burn.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-burn.md @@ -40,7 +40,9 @@ 1. 请连接好电脑和待烧录开发板,需要连接USB口,具体可参考[Hi3861V100开发板介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3861.md)。 -2. 在DevEco Device Tool中,选择REMOTE DEVELOPMENT > Local PC,查看远程计算机(Ubuntu开发环境)与本地计算机(Windows开发环境)的连接状态。 +2. 根据[Hi3861V100开发板串口驱动安装](https://device.harmonyos.com/cn/docs/documentation/guide/hi3861-drivers-0000001058153433)安装USB转串口的驱动程序。若您的设备中已安装此驱动,请忽略该步骤。 + +3. 在DevEco Device Tool中,选择REMOTE DEVELOPMENT > Local PC,查看远程计算机(Ubuntu开发环境)与本地计算机(Windows开发环境)的连接状态。 - 如果Local PC右边连接按钮为![zh-cn_image_0000001261315939](figures/zh-cn_image_0000001261315939.png),则远程计算机与本地计算机为已连接状态,不需要执行其他操作。 - 如果Local PC右边连接按钮为![zh-cn_image_0000001261515989](figures/zh-cn_image_0000001261515989.png),则点击绿色连接进行按钮。 @@ -50,18 +52,15 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 该操作仅在远程模式(Windows+Ubuntu混合开发环境)中需要设置,如果采用本地模式(Windows开发环境或Ubuntu开发环境),则请跳过该步骤。 -3. 在DevEco Device Tool中,点击QUICK ACCESS > DevEco Home > Device,查看并记录对应的串口号。 +4. 在DevEco Device Tool中,点击QUICK ACCESS > DevEco Home > Device,查看并记录对应的串口号。 ![zh-cn_image_0000001216274840](figures/zh-cn_image_0000001216274840.png) - > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** - > 如果对应的串口异常,请根据[Hi3861V100开发板串口驱动安装](https://device.harmonyos.com/cn/docs/documentation/guide/hi3861-drivers-0000001058153433)安装USB转串口的驱动程序。 - -4. 在QUICK ACCESS > DevEco Home > Projects中,点击**Settings**打开工程配置界面。 +5. 在QUICK ACCESS > DevEco Home > Projects中,点击**Settings**打开工程配置界面。 ![zh-cn_image_0000001198943768](figures/zh-cn_image_0000001198943768.png) -5. 在“hi3861”页签,设置烧录选项,包括upload_port、upload_protocol和upload_partitions。 +6. 在“hi3861”页签,设置烧录选项,包括upload_port、upload_protocol和upload_partitions。 - upload_port:选择已查询的串口号。 - upload_protocol:选择烧录协议,选择“hiburn-serial”。 @@ -69,22 +68,22 @@ ![zh-cn_image_0000001243704061](figures/zh-cn_image_0000001243704061.png) -6. 检查待烧录文件的烧录信息,DevEco Device Tool已预置默认的烧录文件信息,可根据实际情况进行调整。 +7. 检查待烧录文件的烧录信息,DevEco Device Tool已预置默认的烧录文件信息,可根据实际情况进行调整。 在“hi3861_app”页签,在New Option选项中选择partition_bin(烧录文件路径),然后设置待烧录文件的地址。 ![zh-cn_image_0000001260919759](figures/zh-cn_image_0000001260919759.png) -7. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 +8. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 -8. 点击**Open**打开工程文件,然后在“PROJECT TASKS”中,点击hi3861下的**Upload**按钮,启动烧录。 +9. 点击**Open**打开工程文件,然后在“PROJECT TASKS”中,点击hi3861下的**Upload**按钮,启动烧录。 ![zh-cn_image_0000001216440138](figures/zh-cn_image_0000001216440138.png) -9. 启动烧录后,显示如下提示信息时,请按开发板上的RST按钮重启开发板。 +10. 启动烧录后,显示如下提示信息时,请按开发板上的RST按钮重启开发板。 - ![zh-cn_image_0000001198466090](figures/zh-cn_image_0000001198466090.png) + ![zh-cn_image_0000001198466090](figures/zh-cn_image_0000001198466090.png) -10. 重新上电后,界面提示如下信息时,表示烧录成功。 +11. 重新上电后,界面提示如下信息时,表示烧录成功。 - ![zh-cn_image_0000001216761476](figures/zh-cn_image_0000001216761476.png) + ![zh-cn_image_0000001216761476](figures/zh-cn_image_0000001216761476.png) diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-setting.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-setting.md index 9b0236fb8d4db55e520d734b21876c14fb27ed04..bb2b313371407d21fd24a89c66878af7dbb070f2 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-setting.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-setting.md @@ -148,7 +148,7 @@ Hi3861 WLAN模组需要的工具如下表所示。 > ![icon-notice.gif](public_sys-resources/icon-notice.gif) **须知:** > - Hi3861开发板平台仅支持使用libgcc运行时库的静态链接,不建议开发者使用libgcc运行时库的动态链接,以免产品需遵从GPLV3许可证。 > -> - 通过下述步骤2-14,我们编译好了gcc_riscv32镜像,提供给开发者[直接下载](https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz)使用。直接下载gcc_riscv32镜像的开发者可省略下述2-14步。 +> - 通过下述步骤2-14,编译好了gcc_riscv32镜像,提供给开发者[直接下载](https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz)使用。直接下载gcc_riscv32镜像的开发者可省略下述2-14步。 1. 打开Linux编译服务器终端。 diff --git a/zh-cn/device-dev/quick-start/quickstart-standard-board-introduction-hi3516.md b/zh-cn/device-dev/quick-start/quickstart-standard-board-introduction-hi3516.md index 15aec7eb2652f98587fd2756d50f3bf87a1dbe8c..7e5324fc2c86e47283fc3f6d067983af388d1149 100644 --- a/zh-cn/device-dev/quick-start/quickstart-standard-board-introduction-hi3516.md +++ b/zh-cn/device-dev/quick-start/quickstart-standard-board-introduction-hi3516.md @@ -3,7 +3,7 @@ ## 开发板简介 -Hi3516DV300是新一代行业专用Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器、高性能NNIE引擎,在低码率、高画质、智能处理和分析、低功耗等方面引领行业水平。 +Hi3516DV300作为新一代行业专用Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器以及高性能NNIE引擎,具备低码率、高画质、低功耗等特点,并具备强劲的智能处理和分析能力。 **图1** Hi3516单板正面外观图 diff --git a/zh-cn/device-dev/quick-start/quickstart-standard-env-setup.md b/zh-cn/device-dev/quick-start/quickstart-standard-env-setup.md index a4c2007a79c2d055c5e3de5d507061453ccedf4c..c0bed0e81cc3e7487d6965ef194ac4d6da2632cd 100644 --- a/zh-cn/device-dev/quick-start/quickstart-standard-env-setup.md +++ b/zh-cn/device-dev/quick-start/quickstart-standard-env-setup.md @@ -227,7 +227,7 @@ ## 获取源码 -在Ubuntu环境下通过以下步骤拉取OpenHarmony源码。 +在Ubuntu环境下通过以下步骤获取OpenHarmony源码。 ### 准备工作 @@ -267,7 +267,7 @@ ``` -### 获取源码 +### 获取方式 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > Master主干为开发分支,开发者可通过Master主干获取最新特性。发布分支代码相对比较稳定,开发者可基于发布分支代码进行商用功能开发。 diff --git a/zh-cn/device-dev/quick-start/quickstart-standard-overview.md b/zh-cn/device-dev/quick-start/quickstart-standard-overview.md index 27e8b31479c9e1dd291873ad3e83440a476a5b7e..669cb227e46cd0f6488828daf2e0abb2a7a89942 100644 --- a/zh-cn/device-dev/quick-start/quickstart-standard-overview.md +++ b/zh-cn/device-dev/quick-start/quickstart-standard-overview.md @@ -12,12 +12,12 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文, - 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。 OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 -本文采用安装包方式进行介绍,习惯使用DevEco Device Tool的开发者可参考[标准系统快速入门(IDE方式)](../quick-start/quickstart-standard-ide-directory.md)。 +本文采用安装包方式进行介绍,习惯使用DevEco Device Tool的开发者可参考[标准系统快速入门(IDE方式)](../quick-start/quickstart-ide-standard-overview.md)。 ## 开发环境 -开发者通常习惯采用Windows+Ubuntu环境进行OpenHarmony开发: +推荐开发者采用Windows+Ubuntu环境进行OpenHarmony开发: - Windows:用于源码开发、烧录等。 @@ -28,7 +28,7 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文, ## 开发板 -本文选取了两款典型开发板:Hi3516DV300、RK3516,并基于上述两款开发板进行开发介绍。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-standard-board-introduction.md),开发者可根据需要自行购买开发板。 +本文选取了两款典型开发板:Hi3516DV300、RK3516,并基于上述两款开发板进行开发介绍。开发板的具体外观和规格可参见[本文附录](../quick-start/quickstart-standard-board-introduction-hi3516.md),开发者可根据需要自行购买开发板。 ## 开发流程 diff --git a/zh-cn/device-dev/quick-start/quickstart-standard-running-hi3516-build.md b/zh-cn/device-dev/quick-start/quickstart-standard-running-hi3516-build.md index 3866dcba6003f1d12c0d4324298838c557633ba7..6e49f79f8e2ea6d3423fa5befad0bd0618ec69f1 100644 --- a/zh-cn/device-dev/quick-start/quickstart-standard-running-hi3516-build.md +++ b/zh-cn/device-dev/quick-start/quickstart-standard-running-hi3516-build.md @@ -42,7 +42,7 @@ OpenHarmony支持hb和build.sh两种编译方式。此处介绍hb方式,build. ![zh-cn_image_0000001271562433](figures/zh-cn_image_0000001271562433.png) -5. 编译结束后,出现“build success”字样,则证明构建成功。 +5. 编译结束后,出现“build success”字样,说明构建成功。 > ![icon-notice.gif](public_sys-resources/icon-notice.gif) **须知:** > 编译结果文件及编译日志文件获取路径:out/hi3516dv300。 diff --git a/zh-cn/device-dev/quick-start/quickstart-standard-running-hi3516-burning.md b/zh-cn/device-dev/quick-start/quickstart-standard-running-hi3516-burning.md index 80f0d61561042ffd8f19f91de9176899ea6f2623..30d91c07ebc4a6f3a30e44a6ef76d14e6553586d 100644 --- a/zh-cn/device-dev/quick-start/quickstart-standard-running-hi3516-burning.md +++ b/zh-cn/device-dev/quick-start/quickstart-standard-running-hi3516-burning.md @@ -40,7 +40,9 @@ 1. 请连接好电脑和待烧录开发板,需要同时连接串口和USB口,具体可参考[Hi3516DV300开发板介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3516.md)。 -2. 在DevEco Device Tool中,选择REMOTE DEVELOPMENT > Local PC,查看远程计算机(Ubuntu开发环境)与本地计算机(Windows开发环境)的连接状态。 +2. 根据[Hi3516DV300/Hi3518EV300开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/documentation/guide/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。若您的设备中已安装此驱动,请忽略该步骤。 + +3. 在DevEco Device Tool中,选择REMOTE DEVELOPMENT > Local PC,查看远程计算机(Ubuntu开发环境)与本地计算机(Windows开发环境)的连接状态。 - 如果Local PC右边连接按钮为![zh-cn_image_0000001261315939](figures/zh-cn_image_0000001261315939.png),则远程计算机与本地计算机为已连接状态,不需要执行其他操作。 - 如果Local PC右边连接按钮为![zh-cn_image_0000001261515989](figures/zh-cn_image_0000001261515989.png),则点击绿色连接进行按钮。 @@ -50,18 +52,15 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 该操作仅在远程模式(Windows+Ubuntu混合开发环境)中需要设置,如果采用本地模式(Windows开发环境或Ubuntu开发环境),则请跳过该步骤。 -3. 在DevEco Device Tool中,点击QUICK ACCESS > DevEco Home > Device,查看并记录对应的串口号。 +4. 在DevEco Device Tool中,点击QUICK ACCESS > DevEco Home > Device,查看并记录对应的串口号。 ![zh-cn_image_0000001216516128](figures/zh-cn_image_0000001216516128.png) - > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** - > 如果对应的串口异常,请根据[Hi3516DV300/Hi3518EV300开发板串口驱动安装指导](https://device.harmonyos.com/cn/docs/documentation/guide/hi3516_hi3518-drivers-0000001050743695)安装USB转串口的驱动程序。 - -4. 在QUICK ACCESS > DevEco Home > Projects中,点击**Settings**打开工程配置界面。 +5. 在QUICK ACCESS > DevEco Home > Projects中,点击**Settings**打开工程配置界面。 ![zh-cn_image_0000001198566364](figures/zh-cn_image_0000001198566364.png) -5. 在“hi3516dv300”页签,设置烧录选项,包括upload_partitions、upload_port和upload_protocol。 +6. 在“hi3516dv300”页签,设置烧录选项,包括upload_partitions、upload_port和upload_protocol。 - upload_partitions:选择待烧录的文件,默认情况下会同时烧录fastboot、kernel、rootfs和userfs。 - upload_port:选择已查询到的串口号。 @@ -69,7 +68,7 @@ ![zh-cn_image_0000001223190441](figures/zh-cn_image_0000001223190441.png) -6. 分别检查待烧录文件的烧录信息,DevEco Device Tool已预置默认的烧录文件信息,可根据实际情况进行调整。待烧录文件包括:fastboot、kernel、rootfs和userfs。 +7. 分别检查待烧录文件的烧录信息,DevEco Device Tool已预置默认的烧录文件信息,可根据实际情况进行调整。待烧录文件包括:fastboot、kernel、rootfs和userfs。 1. 在“hi3516dv300_fastboot”页签,在New Option选项中选择需要修改的项,例如partition_bin(烧录文件路径)、partition_addr(烧录文件起始地址)、partition_length(烧录文件分区长度)等。 @@ -84,21 +83,18 @@ 3. 按照相同的方法修改kernel、rootfs和userfs的烧录文件信息。 -7. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 +8. 所有的配置都修改完成后,在工程配置页签的顶部,点击**Save**进行保存。 -8. 点击hi3516dv300下的**Upload**按钮,启动烧录。 - - > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** - > 如果您是第一次在工作台烧录Hi3516DV300/Hi3518EV300开发板,可能烧录失败,提示“not find the Devices”,然后根据[Hi3516DV300/Hi3518EV300开发板USB驱动安装](https://device.harmonyos.com/cn/docs/documentation/guide/usb_driver-0000001058690393)进行处理后再重新烧录。 +9. 点击hi3516dv300下的**Upload**按钮,启动烧录。 ![zh-cn_image_0000001267231481](figures/zh-cn_image_0000001267231481.png) -9. 在终端窗口显示如下提示信息时,按住复位键,插拔USB线,最后松开复位键启动烧录。 +10. 在终端窗口显示如下提示信息时,按住复位键,插拔USB线,最后松开复位键启动烧录。 - ![zh-cn_image_0000001114129426](figures/zh-cn_image_0000001114129426.png) + ![zh-cn_image_0000001114129426](figures/zh-cn_image_0000001114129426.png) - 启动烧录后,界面提示如下信息时,表示烧录成功。 + 启动烧录后,界面提示如下信息时,表示烧录成功。 - ![zh-cn_image_0000001160649343](figures/zh-cn_image_0000001160649343.png) + ![zh-cn_image_0000001160649343](figures/zh-cn_image_0000001160649343.png) -10. 烧录成功后,请根据镜像运行章节进行操作,启动系统。 +11. 烧录成功后,请根据[运行](quickstart-standard-running-hi3516-running.md)章节进行操作,启动系统。 diff --git a/zh-cn/device-dev/security/security-guidelines-overall.md b/zh-cn/device-dev/security/security-guidelines-overall.md index 67f688e5248773928d4e6fa71002a5c1efa08269..9eecdc9eb82ae88918ee1e21fe5afbb266c93015 100644 --- a/zh-cn/device-dev/security/security-guidelines-overall.md +++ b/zh-cn/device-dev/security/security-guidelines-overall.md @@ -74,7 +74,7 @@ OpenHarmony操作系统是一个开放的系统,开发者可以通过OpenHarmo ![zh-cn_image_0000001057233092](figures/zh-cn_image_0000001057233092.png) - Capability机制 - Capability机制实际上是对root权限的具体细分。在多用户计算机系统中,一般会有一个特殊的角色拥有系统的所有权限,这个角色一般是系统管理员(root)。对于OpenHarmony这种需要支持三方应用生态的内核,需要将系统中的特权访问进行管控。系统需要对用户层访问内核的特权级系统调用进行限制。仅允许部分高权限应用进行特权操作。具体实现方式是内核spawn第一个用户程序INIT,其包含全部的特权能力,此后,INIT拉起其他应用框架服务,拉起过程中,对各应用框架进行相应的降权操作,为各应用保留必须的特权能力。 当应用去调用特权接口时,内核态就会通过进程ID查看当前访问者是否有权限访问目标接口。 + Capability机制实际上是对root权限的具体细分。在多用户计算机系统中,一般会有一个特殊的角色拥有系统的所有权限,这个角色一般是系统管理员(root)。对于OpenHarmony这种需要支持三方应用生态的内核,需要将系统中的特权访问进行管控。系统需要对用户层访问内核的特权级系统调用进行限制。仅允许部分高权限应用进行特权操作。具体实现方式是内核spawn第一个用户程序INIT,其包含全部的特权能力,此后,INIT拉起其他应用框架服务,拉起过程中,对各应用框架进行相应的降权操作,为各应用保留必需的特权能力。 当应用去调用特权接口时,内核态就会通过进程ID查看当前访问者是否有权限访问目标接口。 - 安全启动 安全启动是整个系统安全的基础,通过采用数字签名和完整性校验机制,从芯片内部固化的可信启动根开始,逐级校验每一层软件的完整性和合法性,确保最终启动的操作系统软件是厂家提供的正确合法的软件,防止攻击者对系统软件做恶意的篡改和植入,为整个系统提供初始安全的基础运行环境。 diff --git a/zh-cn/device-dev/subsystems/Readme-CN.md b/zh-cn/device-dev/subsystems/Readme-CN.md index 53bcf341a54a8bc42dd05e90649334c66de48305..84dc4d42279148a94130c9ff78ca05aae1d8ac0b 100755 --- a/zh-cn/device-dev/subsystems/Readme-CN.md +++ b/zh-cn/device-dev/subsystems/Readme-CN.md @@ -100,4 +100,4 @@ - [bytrace使用指导](subsys-toolchain-bytrace-guide.md) - [hdc_std使用指导](subsys-toolchain-hdc-guide.md) - [hiperf使用指导](subsys-toolchain-hiperf.md) -- [XTS认证用例开发指导](subsys-xts-guide.md) \ No newline at end of file +- [XTS测试用例开发指导](subsys-xts-guide.md) \ No newline at end of file diff --git a/zh-cn/device-dev/subsystems/subsys-aiframework-demo-conf.md b/zh-cn/device-dev/subsystems/subsys-aiframework-demo-conf.md index 3ceb3d8dab4a1077a3476b8ae9acd92757023c24..81074ff915c321e7d20dfaedacc2b0e5d5862de0 100755 --- a/zh-cn/device-dev/subsystems/subsys-aiframework-demo-conf.md +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-demo-conf.md @@ -1,7 +1,7 @@ # 唤醒词识别配置文件的开发示例 -1. 代码路径//foundation/ai/engine/services/common/protocol/plugin_config/plugin_config_ini/中添加唤醒词识别的配置文件。 +1. 在代码路径//foundation/ai/engine/services/common/protocol/plugin_config/plugin_config_ini/中添加唤醒词识别的配置文件。 ``` [base] @@ -15,21 +15,21 @@ VersionName = 2.00.01.002 XPU = NNIE District = China - // 编译出的插件so所在的位置 + // 编译出的插件so文件所在的位置 FullPath = /usr/lib/libasr_keyword_spotting.so Chipset = ALL ChkSum = '' Key = '' ``` -2. 代码路径//foundation/ai/engine/services/common/protocol/plugin_config/aie_algorithm_type.h文件中添加唤醒词识别算法类型id。 +2. 在代码路径//foundation/ai/engine/services/common/protocol/plugin_config/中的aie_algorithm_type.h文件添加唤醒词识别算法类型id。 ``` // 唤醒词识别的算法类型id与唤醒词识别在ALGORITHM_TYPE_ID_LIST中的序号一一对应 const int ALGORITHM_TYPE_KWS = 3; ``` -3. 代码路径//foundation/ai/engine/services/server/plugin_manager/include/aie_plugin_info.h文件中添加唤醒词识别算法名称及在ALGORITHM_TYPE_ID_LIST中的序号。 +3. 在代码路径//foundation/ai/engine/services/server/plugin_manager/include/中的aie_plugin_info.h文件添加唤醒词识别算法名称及在ALGORITHM_TYPE_ID_LIST中的序号。 ``` const std::string ALGORITHM_ID_SAMPLE_1 = "sample_plugin_1"; diff --git a/zh-cn/device-dev/subsystems/subsys-aiframework-demo-plugin.md b/zh-cn/device-dev/subsystems/subsys-aiframework-demo-plugin.md index fbe5f2ba9b659a2d614ea027ad6c041a36f2ca01..2dccd242658665edaa7477e28e67848eaf658e4e 100755 --- a/zh-cn/device-dev/subsystems/subsys-aiframework-demo-plugin.md +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-demo-plugin.md @@ -1,7 +1,7 @@ # 唤醒词识别插件的开发示例 -1. 在//foundation/ai/engine/services/server/plugin的目录中添加唤醒词识别插件的接口定义(IPlugin),并实现AI能力的调用。如下代码片段即实现唤醒词识别的算法插件的接口定义。更多插件开发的相关代码参考路径如下://foundation/ai/engine/services/server/plugin/asr/keyword_spotting +1. 在代码路径//foundation/ai/engine/services/server/plugin中添加唤醒词识别插件的接口定义(IPlugin),并实现AI能力的调用。如下代码片段即实现唤醒词识别的算法插件的接口定义。更多插件开发的相关代码参考路径如下://foundation/ai/engine/services/server/plugin/asr/keyword_spotting ``` #include "plugin/i_plugin.h @@ -22,16 +22,16 @@ ``` 上述代码实现server提供的IPlugin接口。唤醒词识别的sample中调用的client端接口与插件中的接口对应关系及其实现功能如下表所示。 - **表1** 唤醒词识别中client端接口与插件接口对应关系 + **表1** 唤醒词识别中client端接口与插件中的接口对应关系 | client端定义的接口 | 插件中定义的接口 | 功能 | | -------- | -------- | -------- | | AieClientPrepare | Prepare | 提供推理算法插件初始化功能,例如:加载唤醒词识别模型,将固定位置(/sdcard/wenwen_inst.wk)模型加载至内存。 | | AieClientSyncProcess | SyncProcess | 提供同步执行推理算法的能力,例如:实现同步执行音频推理算法,判断音频中是否存在唤醒词。 | | AieClientAsyncProcess | AsyncProcess | 提供异步执行推理算法的能力,当前唤醒词识别场景不涉及,但开发者可根据具体场景自行实现。 | - | AieClientSetOption | SetOption | 提供手动设置算法相关配置项,如置信度阈值、时延等超参数的能力,当前唤醒词识别场景未涉及。开发者可视具体场景自行实现。 | + | AieClientSetOption | SetOption | 提供手动设置算法相关配置项,如置信度阈值、时延等超参数的能力。当前唤醒词识别场景未涉及,开发者可视具体场景自行实现。 | | AieClientGetOption | GetOption | 提供获取算法相关配置项,以唤醒词识别为例:获取唤醒词模型中输入输出的规模,输入规模即为唤醒词识别模型要求输入的MFCC特征的维度(固定值:4000),输出规模即为结果的置信度得分维度(固定值:2)。 | - | AieClientRelease | Release | 提供卸载算法模型功能,以唤醒词识别为例:实现卸载相关模型,并将特征处理器中的动态内存清理。 | + | AieClientRelease | Release | 提供卸载算法模型功能,以唤醒词识别为例:实现卸载相关模型,并清理特征处理器中的动态内存。 | 注意: diff --git a/zh-cn/device-dev/subsystems/subsys-aiframework-demo-sdk.md b/zh-cn/device-dev/subsystems/subsys-aiframework-demo-sdk.md index 1c551c680580c8e0cebd94b6275a3d0aa47af3d7..1f80a4874cc967d60a9a6a933c7579873952be0a 100644 --- a/zh-cn/device-dev/subsystems/subsys-aiframework-demo-sdk.md +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-demo-sdk.md @@ -1,7 +1,7 @@ # 唤醒词识别SDK的开发示例 -1. 在//foundation/ai/engine /interfaces/kits目录中添加唤醒词识别SDK的API接口定义,该接口可用三方应用的调用。如下代码片段即为唤醒词识别定义的API接口示例,其相关代码参考路径为://foundation/ai/engine /interfaces/kits/asr/keyword_spotting。 +1. 在//foundation/ai/engine /interfaces/kits目录中添加唤醒词识别SDK的API接口定义,该接口可用三方应用进行调用。如下代码片段即为唤醒词识别定义的API接口示例,其相关代码参考路径为://foundation/ai/engine/interfaces/kits/asr/keyword_spotting。 ``` class KWSSdk { @@ -23,7 +23,7 @@ }; ``` -2. 在//foundation/ai/engine/services/client/algorithm_sdk的目录中增加SDK中API接口的具体实现,调用client端提供的接口,实现算法插件能力的使用。如下代码片段即为唤醒词识别的API接口中create方法的具体实现示例,更多详细代码可参考://foundation/ai/engine/services/client/algorithm_sdk/asr/keyword_spotting。 +2. 在//foundation/ai/engine/services/client/algorithm_sdk目录中增加SDK中API接口的具体实现,调用client端提供的接口,实现算法插件能力的使用。如下代码片段即为唤醒词识别的API接口中create方法的具体实现示例,更多详细代码可参考://foundation/ai/engine/services/client/algorithm_sdk/asr/keyword_spotting。 ``` int32_t KWSSdk::KWSSdkImpl::Create() @@ -76,5 +76,5 @@ 上述代码为API接口的具体实现,从上述示例的代码中,SDK中create接口的具体实现即为上述示例代码中create方法,该方法调用了AI引擎框架client端开放接口AieClientInit,AieClientPrepare,从而实现与server端建立连接及加载算法模型的能力。 - > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** - > SDK调用AI引擎client端接口顺序应遵循AieClientInit->AieClientPrepare->AieClientSyncProcess/AieClientAsyncProcess->AieClientRelease->AieClientDestroy,否则调用接口会返回错误码。 + > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
+ > SDK调用AI引擎client端接口应遵循AieClientInit->AieClientPrepare->AieClientSyncProcess/AieClientAsyncProcess->AieClientRelease->AieClientDestroy顺序,否则调用接口会返回错误码。 diff --git a/zh-cn/device-dev/subsystems/subsys-aiframework-demo.md b/zh-cn/device-dev/subsystems/subsys-aiframework-demo.md index fc9b90ea1ca4a91cff0eaba6c275fcfc3dd5e08d..92d97285dd7bd8fcab65a90a50d2dd26909e1564 100644 --- a/zh-cn/device-dev/subsystems/subsys-aiframework-demo.md +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-demo.md @@ -1,10 +1,10 @@ # 开发示例 -以开发唤醒词识别为例,开发者可在Hi3516DV300开发板上,基于AI引擎框架开发唤醒词识别的SDK以及唤醒词识别的plugin,通过编译命令编出新的版本镜像并将其烧入版本。同时,开发者开发唤醒词识别的应用,该应用能够接收外部音频,将listen到的音频传入SDK中的接口,若音频中带有关键词,唤醒词识别的应用会识别出相应的词语,并打印在命令行中。 +以开发唤醒词识别为例,开发者可在Hi3516DV300开发板上,基于AI引擎框架开发唤醒词识别的SDK以及唤醒词识别的plugin,通过编译命令编出新的版本镜像并将其烧入版本。同时,开发者开发唤醒词识别的应用,该应用能够接收外部音频,将接收到的音频传入SDK中的接口。若音频中带有关键词,唤醒词识别的应用会识别出相应的词语,并打印在命令行中。 -本示例中唤醒词识别的场景中唤醒词是固定的,当开发者传入的音频包含”Hi,小问“,启动的应用就会打印"[Hi, xiaowen]",当不包含时,会打印'[UNKNOWN]"。 +本示例中唤醒词识别的场景中唤醒词是固定的,当开发者传入的音频包含“Hi,小问”,启动的应用就会打印"[Hi, xiaowen]",当不包含时,会打印"[UNKNOWN]"。 - **[唤醒词识别SDK的开发示例](subsys-aiframework-demo-sdk.md)** diff --git a/zh-cn/device-dev/subsystems/subsys-aiframework-devguide-conf.md b/zh-cn/device-dev/subsystems/subsys-aiframework-devguide-conf.md index cab853a3903266bf3e090cea7bfa6171a074104b..2add218e8e2a8a92f70effce393fb46d0443ed62 100755 --- a/zh-cn/device-dev/subsystems/subsys-aiframework-devguide-conf.md +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-devguide-conf.md @@ -4,11 +4,11 @@ 开发者开发的SDK通过AlgorithmInfo结构体中algorithmVersion以及algorithmType识别出具体的插件类型,实现插件能力的调用。因此开发者需完成以下步骤: -1. 代码路径//foundation/ai/engine/services/common/protocol/plugin_config/plugin_config_ini/目录中添加插件的配置文件。 +1. 代码路径//foundation/ai/engine/services/common/protocol/plugin_config/plugin_config_ini/中添加插件的配置文件。 -2. 代码路径//foundation/ai/engine/services/common/protocol/plugin_config/aie_algorithm_type.h文件中添加算法类型。 +2. 代码路径//foundation/ai/engine/services/common/protocol/plugin_config/中的aie_algorithm_type.h文件添加算法类型。 -3. 代码路径//foundation/ai/engine/services/server/plugin_manager/include/aie_plugin_info.h文件中添加唤醒词识别的算法名称及其在ALGORITHM_TYPE_ID_LIST中的序号。 +3. 代码路径//foundation/ai/engine/services/server/plugin_manager/include/中的aie_plugin_info.h文件添加唤醒词识别的算法名称及其在ALGORITHM_TYPE_ID_LIST中的序号。 具体开发过程可参考[唤醒词识别配置文件开发示例](../subsystems/subsys-aiframework-demo-conf.md)。 diff --git a/zh-cn/device-dev/subsystems/subsys-aiframework-guide.md b/zh-cn/device-dev/subsystems/subsys-aiframework-guide.md index 653117b888410fffbb96fceedf29abc84e313c26..1cc85a265daa79558e6f90349d478e2cf4862e2e 100644 --- a/zh-cn/device-dev/subsystems/subsys-aiframework-guide.md +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-guide.md @@ -1,7 +1,9 @@ # 概述 -AI业务子系统是OpenHarmony提供原生的分布式AI能力的子系统。AI业务子系统提供了统一的AI引擎框架,实现算法能力快速插件化集成。框架中主要包含插件管理、模块管理和通信管理等模块,完成对AI算法能力的生命周期管理和按需部署。插件管理主要实现插件的生命周期管理及插件的按需部署,快速集成AI能力插件;模块管理主要实现任务的调度及管理客户端的实例;通信管理主要实现客户端和服务端之间的跨进程通信及引擎与插件之间的数据传输。后续,会逐步定义统一的AI能力接口,便于AI能力的分布式调用。同时,提供适配不同推理框架层级的统一推理接口。AI引擎框架如下图所示。 +AI业务子系统是OpenHarmony提供原生的分布式AI能力的子系统。AI业务子系统提供了统一的AI引擎框架,实现算法能力快速插件化集成。 +AI引擎框架主要包含插件管理、模块管理和通信管理模块,完成对AI算法能力的生命周期管理和按需部署。插件管理主要实现插件的生命周期管理及插件的按需部署,快速集成AI能力插件;模块管理主要实现任务的调度及管理客户端的实例;通信管理主要实现客户端和服务端之间的跨进程通信管理及AI服务与插件之间的数据传输。后续,会逐步定义统一的AI能力接口,便于AI能力的分布式调用。同时,框架提供适配不同推理框架层级的统一推理接口。 +AI引擎框架结构如下图所示。 **图1** AI引擎框架 diff --git a/zh-cn/device-dev/subsystems/subsys-aiframework-tech-interface.md b/zh-cn/device-dev/subsystems/subsys-aiframework-tech-interface.md index 1e917c941ee29e008de14deb7d08affd2182b818..71b3005765f00e10ad0c39fdd24b777919de5d0d 100755 --- a/zh-cn/device-dev/subsystems/subsys-aiframework-tech-interface.md +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-tech-interface.md @@ -89,7 +89,7 @@ retCode = ProcessDecode(dataInfo, arg1, arg2, arg3) //可以接收任意多个 ## 规则:在SDK中,对以编解码返回的出参数据类型,需要进行内存释放,否则会出现内存泄漏 -编码得到的通用数据,本质上是将不同类型数据封装在同一块内存中,然后将这块内存的首地址与长度封装到结构体中。通过编码返回到SDK中的出参数据,在插件中申请了内存,但插件无法释放,否则SDK将无法拿到数据;因此SDK在拿到数据之后,需要对内存进行释放。 +编码得到的通用数据,本质上是将不同类型数据封装在同一块内存中,然后将这块内存的首地址与长度封装到结构体中。通过编码返回到SDK中的出参数据,在插件中申请了内存,但插件无法释放;因此SDK在拿到数据之后,需要对内存进行释放,否则SDK将无法拿到数据。 内存释放示例: @@ -115,7 +115,7 @@ Server端管理的插件内部接口实现逻辑各不相同,为了统一插 ## 规则:plugin需要使用AI引擎提供的统一数据通道 -AI Engine在server与插件之间,提供了一个统一的数据通道,用来处理来自SDK的推理请求和来自插件的结果返回;plugin在推理接口中,需按数据通道完成请求数据的获取以及推理结果的封装。 +AI引擎在server与插件之间,提供了一个统一的数据通道,用来处理来自SDK的推理请求和来自插件的结果返回;plugin在推理接口中,需按数据通道完成请求数据的获取以及推理结果的封装。 数据通道使用示例: @@ -142,4 +142,4 @@ return RETCODE_SUCCESS; } ``` -示例中request和response是数据通道的内容主体,server端会将数据封装在request中,传递到插件,插件进行算法处理之后,则需要将结果封装成response进行返回。 +示例中request和response是数据通道的内容主体。server端会将数据封装在request中,传递到插件,插件进行算法处理之后,则需要将结果封装成response进行返回。 diff --git a/zh-cn/device-dev/subsystems/subsys-aiframework-tech-name.md b/zh-cn/device-dev/subsystems/subsys-aiframework-tech-name.md index f81b525b0b4a464046ab809ad246015e4169e53f..b680d9ea5df4442281d72ede24601664bf5be31c 100755 --- a/zh-cn/device-dev/subsystems/subsys-aiframework-tech-name.md +++ b/zh-cn/device-dev/subsystems/subsys-aiframework-tech-name.md @@ -3,15 +3,13 @@ ## SDK命名规则:领域_关键词<_其他信息1_其他信息2_…>_sdk.so -关于领域,建议使用当前主流简称,比如图片视频相关的使用"cv",语音识别相关的使用“asr”,翻译相关的使用“translation”等,存在其他领域的可增加定义;关键词则需要恰当准确的描述所对应插件的算法能力,比如唤醒词识别,则使用keyword_spotting;对于其他信息,比如插件支持的芯片类型、国内海外等信息,可在关键词与“SDK”之间依次添加,每个信息之间以下划线连接;北向SDK命名,必须以“SDK”结尾。 +关于领域,建议使用当前主流简称,比如图片视频相关的使用"cv",语音识别相关的使用“asr”,翻译相关的使用“translation”等,存在其他领域的可增加定义;关键词则需要恰当准确的描述所对应插件的算法能力,比如唤醒词识别,则使用keyword_spotting;对于其他信息,比如插件支持的芯片类型、国内海外等信息,可在关键词与“sdk”之间依次添加,信息之间以下划线连接;SDK命名,必须以“_sdk”结尾。 -例如:唤醒词识别插件对应 的SDK,只支持麒麟9000芯片,适用于中国国内地区适用,则对应的SDK命名为:asr_keyword_spotting_kirin9000_china_sdk.so +例如:唤醒词识别插件对应的SDK,只支持麒麟9000芯片,适用于中国国内地区适用,则对应的SDK命名为:asr_keyword_spotting_kirin9000_china_sdk.so ## 插件命名规则:领域_关键词<_其他信息1_其他信息2_…>.so -插件命名的领域、关键词、其他信息等名词解释与要求,均与SDK命名要求保持一致。 - -插件与SDK存在一一对应的关系,故两者命名在领域、关键词、其他信息上要保持一致,两者唯一的不同之处在于SDK命名多了个“_sdk”结尾;比如插件命名为“asr_keyword_spotting.so”,则对应北向SDK命名为“asr_keyword_spotting_sdk.so”。 +插件与SDK存在一一对应的关系,故插件命名的领域、关键词、其他信息等名词解释与要求,均与SDK命名要求保持一致。两者唯一的不同之处在于SDK命名多了个“_sdk”结尾;比如插件命名为“asr_keyword_spotting.so”,则对应SDK命名为“asr_keyword_spotting_sdk.so”。 例如:唤醒词识别插件对应的SDK,只支持麒麟9000芯片,适用于中国国内地区适用,则对应的插件命名为:asr_keyword_spotting_kirin9000_china.so diff --git a/zh-cn/device-dev/subsystems/subsys-application-framework-demo.md b/zh-cn/device-dev/subsystems/subsys-application-framework-demo.md index 96b77366ad69113a49fda26e82646ccf6bc46266..3ff6c84c1b4eaad774c7e8010d0dd102dfefbd71 100755 --- a/zh-cn/device-dev/subsystems/subsys-application-framework-demo.md +++ b/zh-cn/device-dev/subsystems/subsys-application-framework-demo.md @@ -1,4 +1,4 @@ # 开发实例 -开发实例可参考[开源项目中的示例](https://gitee.com/openharmony/aafwk_aafwk_lite/tree/master/frameworks/ability_lite/example) +开发实例可参考[开源项目中的示例](https://gitee.com/openharmony/aafwk_aafwk_lite/tree/master/frameworks/ability_lite/example)。 diff --git a/zh-cn/device-dev/subsystems/subsys-application-framework-envbuild.md b/zh-cn/device-dev/subsystems/subsys-application-framework-envbuild.md index 740c3824704f6118034398898f4e2c2bf18b6b64..632f5e0f27ebd31e3af764278fc7e1e06d36dd51 100644 --- a/zh-cn/device-dev/subsystems/subsys-application-framework-envbuild.md +++ b/zh-cn/device-dev/subsystems/subsys-application-framework-envbuild.md @@ -1,7 +1,7 @@ # 搭建环境 -- 开发板:Hi3516DV300 +- 准备开发板:Hi3516DV300 - [下载源码](../get-code/sourcecode-acquire.md)[下载源码](../get-code/sourcecode-acquire.md) diff --git a/zh-cn/device-dev/subsystems/subsys-application-framework-guide.md b/zh-cn/device-dev/subsystems/subsys-application-framework-guide.md index 9b10a5baa6caca924b177d4b92632bd8a55a9f41..94a70866aa4a6b1d91fe20925a3abc1e6101afbe 100644 --- a/zh-cn/device-dev/subsystems/subsys-application-framework-guide.md +++ b/zh-cn/device-dev/subsystems/subsys-application-framework-guide.md @@ -7,7 +7,7 @@ - 不带界面的Ability应用,比如:音乐播放器能在后台播放音乐、后台提供计算服务、导航服务的各类应用等。 -- 不管是带界面的Ability应用还是不带界面的Ability应用,都要打包成Hap包,最终发布到应用市场,用户通过应用市场下载安装相应的应用。 +不管是带界面的Ability应用还是不带界面的Ability应用,都要打包成Hap包,最终发布到应用市场,用户通过应用市场下载安装相应的应用。 ## 接口说明 @@ -17,7 +17,7 @@ | 接口名称 | 接口描述 | | -------- | -------- | | Want \*WantParseUri(const char \*uri) | 反序列化接口,由字符串生成Want对象。 | -| const char \*WantToUri(Want want) | 序列化,把Want对象生成字符串。 | +| const char \*WantToUri(Want want) | 序列化接口,把Want对象生成字符串。 | | void SetWantElement(Want \*want, ElementName element); | 设置ElementName对象。 | | void SetWantData(Want \*want, const void \*data, uint16_t dataLength) | 设置数据。 | | bool SetWantSvcIdentity(Want \*want, SvcIdentity sid) | 设置SvcIdentity。 | @@ -80,7 +80,7 @@ }; ``` -2. 调用REGISTER_AA宏将ServiceAbility注册到应用框架中,以便应用框架实例化的MyServiceAbility。 +2. 调用REGISTER_AA宏将ServiceAbility注册到应用框架中,以便应用框架实例化MyServiceAbility。 ``` #include "my_service_ability.h" @@ -303,7 +303,7 @@ ``` const uint32_t WAIT_TIMEOUT = 30; sem_init(&g_sem, 0, 0); - std::string installPath = “/storage/bundle/demo.hap”; // hap包的存储路径 + std::string installPath = “/storage/bundle/demo.hap”; // Hap包的存储路径 bool result = Install(installPath.c_str(), &installParam, InstallCallback); struct timespec ts = {}; clock_gettime(CLOCK_REALTIME, &ts); @@ -389,7 +389,7 @@ | 命令参数 | 对应的资源文件 | 说明 | 是否可缺省 | | -------- | -------- | -------- | -------- | - | --mode | - | 为“hap”字段,打包生成hap | 否 | + | --mode | - | 为“hap”字段,打包生成Hap | 否 | | --json-path | 清单文件config.json | - | 否 | | --resources-path | 资源文件resources | - | 是 | | --assets-path | 资源文件assets | - | 是 | @@ -397,7 +397,7 @@ | --shared-libs-path | 共享库文件 | 针对系统应用的共享库,特殊情况下使用 | 是 | | --ability-so-path | 主功能so文件 | - | 是 | | --index-path | 资源索引 | 资源索引文件由资源生成工具生成,由资源流水线会集成该工具 | 是 | - | --out-path | - | 生成的hap包输出路径,默认为当前目录 | 是 | + | --out-path | - | 生成的Hap包输出路径,默认为当前目录 | 是 | | --force | - | 是否覆盖原有同名文件,默认为false | 是 | - 打包示例 diff --git a/zh-cn/device-dev/subsystems/subsys-boot-appspawn.md b/zh-cn/device-dev/subsystems/subsys-boot-appspawn.md index 839f4e385eb7fd998662d0551df1d8d03644331e..0ac9b5c98ceab59faee82e1cad7b9d41af04cf08 100755 --- a/zh-cn/device-dev/subsystems/subsys-boot-appspawn.md +++ b/zh-cn/device-dev/subsystems/subsys-boot-appspawn.md @@ -8,26 +8,25 @@ appspawn被init启动后,等待接收进程间消息,根据消息内容启 ## 功能简介 -- 安全控制  支持为app设置SELinux标签。 +- 安全控制
  支持为app设置SELinux标签。 - 应用进程控制 - 支持为app设置AccessToken。 - 支持重启前,appspawn停止后,可同时停止所有已孵化的app进程。 -- 冷启动 - 支持应用通过aa命令冷启动应用。 +- 冷启动
支持应用通过aa命令冷启动应用。 ``` - param set appspawn.cold.boot true // 打开冷启动状态 + param set appspawn.cold.boot true // 打开冷启动开关 aa start -d 12345 -a $name -b $package -C - 参考: + 参考命令: aa start -d 12345 -a ohos.acts.startup.sysparam.function.MainAbility -b ohos.acts.startup.sysparam.function -C ``` ## 基本概念 -appspawn注册的服务名称为“appspawn”, appspawn 通过监听本地socket,接收来自客户端的请求消息。消息类型为AppProperty的结构体, 定义路径为:“base/startup/appspawn_standard/interfaces/innerkits/include/sclient_socket.h“。 +appspawn注册的服务名称为“appspawn”。appspawn 通过监听本地socket,接收来自客户端的请求消息。消息类型为AppProperty的结构体,定义路径为:“base/startup/appspawn_standard/interfaces/innerkits/include/sclient_socket.h”。 **表1** 字段说明 @@ -46,14 +45,14 @@ appspawn注册的服务名称为“appspawn”, appspawn 通过监听本地socke ## 开发指导 -接口定义路径: “base/startup/appspawn_standard/interfaces/innerkits/include/client_socket.h“,表 2为接口说明。 +接口定义路径: “base/startup/appspawn_standard/interfaces/innerkits/include/client_socket.h”,表 2为接口说明。 ### 接口说明 - **表2** 字段说明 + **表2** 接口说明 -| 字段名 | 说明 | +| 接口名 | 说明 | | -------- | -------- | | CreateClient | 创建client。 | | CloseClient | 关闭client。 | @@ -64,7 +63,7 @@ appspawn注册的服务名称为“appspawn”, appspawn 通过监听本地socke ## 开发实例 -接口使用参考方式: +接口使用参考: ``` @@ -83,14 +82,14 @@ std::shared_ptr clientSocket = std::make_uniqueReadSocketMessage((void *)&pid, sizeof(pid)); - // 如果失败,返回pid如果小于等于0,则错误,否则返回应用的进程id + // 如果失败,返回pid小于等于0;否则返回应用的进程id ``` ## 常见问题 -### 冷启动失败 +### 冷启动应用失败 **现象描述** @@ -98,6 +97,6 @@ std::shared_ptr clientSocket = std::make_unique- 小型系统设备(参考内存≥1MB),如Hi3516DV300、Hi3518EV300 | +| base/startup/appspawn_lite | 小型系统设备(参考内存 ≥ 1 MiB),如Hi3516DV300 、Hi3518EV300 | +| base/startup/bootstrap_lite | 轻量系统设备(参考内存 ≥ 128 KiB),如Hi3861V100 | +| base/startup/init_lite | 小型系统设备(参考内存 ≥ 1 MiB),如Hi3516DV300、Hi3518EV300 | +| base/startup/syspara_lite | - 轻量系统设备(参考内存 ≥ 128 KiB),如Hi3861V100
- 小型系统设备(参考内存 ≥ 1 MiB),如Hi3516DV300、Hi3518EV300 | - init启动引导组件: - 每个系统服务启动时都需要编写各自的启动脚本文件init.cfg,定义各自的服务名、可执行文件路径、权限和其他信息。 - - 每个系统服务各自安装其启动脚本到/system/etc/init目录下,init进程统一扫码执行。 + - 每个系统服务各自安装其启动脚本到/system/etc/init目录下,init进程统一扫描执行。 -- 新芯片平台移植时,平台相关的初始化配置需要增加平台相关的初始化配置文件/vendor/etc/init/init.{hardware}.cfg;该文件完成平台相关的初始化设置,如安装ko驱动,设置平台相关的/proc节点信息。 - - 配置文件init.cfg仅支持json格式。 +- 新芯片平台移植时,平台相关的初始化配置需要增加平台相关的初始化配置文件/vendor/etc/init/init.{hardware}.cfg。该文件完成平台相关的初始化设置,如安装ko驱动,设置平台相关的/proc节点信息。配置文件init.cfg仅支持json格式。 - bootstrap服务启动组件:需要在链接脚本中配置zInit代码段。 diff --git a/zh-cn/device-dev/subsystems/subsys-boot-syspara.md b/zh-cn/device-dev/subsystems/subsys-boot-syspara.md index f5ce784775bd766dfa13e5f2d81d18b5a1117ef4..234f1803372d3e1444aa26a1a94dfffe426edeb5 100755 --- a/zh-cn/device-dev/subsystems/subsys-boot-syspara.md +++ b/zh-cn/device-dev/subsystems/subsys-boot-syspara.md @@ -3,7 +3,7 @@ ## 系统参数简介 -syspara系统为各系统服务提供简单易用的键值对访问接口,使得各个系统服务可以通过各自的系统参数来进行业务功能的配置。系统参数的访问和操作有以下几个基本原语 +syspara系统为各系统服务提供简单易用的键值对访问接口,使得各个系统服务可以通过各自的系统参数来进行业务功能的配置。系统参数的访问和操作有下图所示几个基本原语: **图1** 系统参数操作原语 @@ -13,12 +13,12 @@ syspara系统为各系统服务提供简单易用的键值对访问接口,使 | 功能 | 说明 | | -------- | -------- | -| get | 获取系统参数的值 | -| set | 设置系统参数的值 | -| wait | 同步等待系统参数的值变更 | -| watch | 异步观察系统参数的值变更 | +| get | 获取系统参数的值。 | +| set | 设置系统参数的值。 | +| wait | 同步等待系统参数的值变更。 | +| watch | 异步观察系统参数的值变更。 | -系统参数名称采用点分格式由多段组成,每一段由字母、数字、下划线组成,总长度不超过96字节;系统参数名称分为两类: +系统参数名称采用点分格式由多段组成,每一段由字母、数字、下划线组成,总长度不超过96字节。系统参数名称分为两类: **表2** 系统参数名称 @@ -33,7 +33,7 @@ syspara系统为各系统服务提供简单易用的键值对访问接口,使 | 类别 | 前缀 | 说明 | | -------- | -------- | -------- | -| 常量 | **const.** | 常量参数,一旦赋值后续不会再变更;值最大长度为4096字节(包括结束符)。 | +| 常量 | **const.** | 常量参数,一旦赋值后续不会再变更,值最大长度为4096字节(包括结束符)。 | | 可写 | 其它 | 可写参数,重启后丢失,值最大长度96字节(包括结束符)。 | | 可持久化 | **persist.** | 可写并可持久化保存参数,重启后不会丢失,值最大长度96字节(包括结束符)。 | @@ -83,12 +83,12 @@ Last line." | -------- | -------- | -------- | | 字符串 | const.product.name=OHOS-PRODUCT | 不支持多行字符串,不支持注释。 | | 数字 | const.os.version.api=26 | 数字不需要引号。 | -| 布尔 | const.telephony.enable=false | 布尔型的可以为0,1,false,true。 | +| 布尔 | const.telephony.enable=false | 布尔型的可以为0,1或false,true。 | ### 系统参数DAC访问控制定义文件 -当前系统参数的访问权限控制通过自主访问控制(**Discretionary Access Control**)方式管理,访问权限定义文件后缀名为**".para.dac"**,示例如下: +当前系统参数的访问权限控制通过自主访问控制(Discretionary Access Control)方式管理,访问权限定义文件后缀名为**".para.dac"**,示例如下: ``` @@ -97,7 +97,7 @@ const.product.="root:root:660" 如上所示,可以通过**参数路径**为相同前缀的所有系统参数定义一类访问权限信息;DAC信息通过":"分三段来描述,分别为参数的user,group以及UGO规则信息。 -UGO规则信息每一位的定义如下: +UGO规则信息每一位的定义如下图所示: **图2** UGO规则信息 @@ -132,7 +132,7 @@ ohos_prebuilt_etc("ohos.para.dac") { | 类别 | 路径 | 说明 | | -------- | -------- | -------- | -| 内核参数 | /proc/cmdline | 内核参数中ohospara.xxx=valXXX类型的参数都转换成ohos.boot.xxx=valXXX系统参数 | +| 内核参数 | /proc/cmdline | 内核参数中ohospara.xxx=valXXX类型的参数都转换成ohos.boot.xxx=valXXX系统参数。 | | OS固定值 | /system/etc/param/ohos_const/\*.para | OS固定系统参数值参数优先加载。 | | vendor参数值 | /vendor/etc/param/\*.para | 厂商参数值定义文件次优先级加载,可以覆盖system参数值定义。 | | system参数值 | /system/etc/param/\*.para | 最后加载system参数值定义文件,文件中的系统参数值如果已经存在,则忽略掉。 | @@ -140,7 +140,7 @@ ohos_prebuilt_etc("ohos.para.dac") { ## shell命令使用说明 -通过shell命令中可直接操作系统参数: +通过shell命令中可直接操作系统参数。系统参数shell命令如下表所示: **表6** 系统参数shell命令说明 @@ -148,7 +148,7 @@ ohos_prebuilt_etc("ohos.para.dac") { | 功能 | 说明 | | -------- | -------- | | param get [**key**] | 获取指定key名称的系统参数值;如果不指定任何name,则返回所有系统参数值。 | -| param set **key value** | 设置指定key名称的参数值为value | +| param set **key value** | 设置指定key名称的参数值为value。 | | param wait **keyvalue** | 同步等待指定key名称的系统参数值与value匹配。value可支持模糊匹配,如"\*"表示任何值,"val\*"表示只匹配前三个val字符。 | | param dump | 显示系统参数的统计信息。 | @@ -185,8 +185,8 @@ ohos_prebuilt_etc("ohos.para.dac") { | const char\* GetBuildHost(void) | 返回构建主机名。 | | const char\* GetBuildTime(void) | 返回构建时间。 | | const char\* GetBuildRootHash(void) | 返回当前版本hash。 | -| const char\* GetOsReleaseType(void) | 返回系统发布类型 | -| int GetDevUdid(char \*udid, int size) | 获取设备udid | +| const char\* GetOsReleaseType(void) | 返回系统发布类型。 | +| int GetDevUdid(char \*udid, int size) | 获取设备udid。 | ## 开发实例 diff --git a/zh-cn/device-dev/subsystems/subsys-build-standard-large.md b/zh-cn/device-dev/subsystems/subsys-build-standard-large.md index 3e0f7fbf58225fc72e484eb78480d20dc0c0c76f..91797ff869dc486112c7b52b031242b226771788 100644 --- a/zh-cn/device-dev/subsystems/subsys-build-standard-large.md +++ b/zh-cn/device-dev/subsystems/subsys-build-standard-large.md @@ -432,7 +432,7 @@ ohos_shared_library("module2") { "parts":{ "ace:ace_engine_standard":{}, "ace:napi":{}, - "account:os_account_standard":{}, + "account:os_account":{}, "distributeddatamgr:native_appdatamgr":{}, "distributeddatamgr:distributeddatamgr":{}, "distributeddatamgr:appdatamgr_jskits":{}, diff --git a/zh-cn/device-dev/subsystems/subsys-security-devicesecuritylevel.md b/zh-cn/device-dev/subsystems/subsys-security-devicesecuritylevel.md index 8b0a56360ced6cdc6fa6b17a88794a93853f0575..37f5e10124f928f06b770af1ff291329de90352c 100644 --- a/zh-cn/device-dev/subsystems/subsys-security-devicesecuritylevel.md +++ b/zh-cn/device-dev/subsystems/subsys-security-devicesecuritylevel.md @@ -94,7 +94,8 @@ OpenHarmony设备的默认安全等级为SL1,设备制造商可以根据设备 // 从设备安全等级信息中提取设备安全等级字段 ret = GetDeviceSecurityLevelValue(info, &level); if (ret == SUCCESS) { - // 查询成功。 + // 成功查询到相关等级。 + FreeDeviceSecurityInfo(info); return; } // 结束处理前,需要释放内存 @@ -126,6 +127,7 @@ void CheckDestDeviceSecurityLevel(const DeviceIdentify *device, RequestOption *o ret = GetDeviceSecurityLevelValue(info, &level); if (ret != SUCCESS) { // 提取信息失败, 此场景建议开发者根据实际情况进行重试 + FreeDeviceSecurityInfo(info); return; } // 成功获取到设备安全等级,确认当前操作允许的最低安全等级 @@ -151,6 +153,7 @@ void DeviceSecurityInfoCallback(const DeviceIdentify *identify, struct DeviceSec int32_t ret = GetDeviceSecurityLevelValue(info, &level); if (ret != SUCCESS) { // 获取信息失败。此场景建议开发者根据实际情况进行重试 + FreeDeviceSecurityInfo(info); return; } // 成功获取到设备安全等级,确认当前操作允许的最低安全等级 diff --git a/zh-cn/device-dev/subsystems/subsys-security.md b/zh-cn/device-dev/subsystems/subsys-security.md index cb053bdc38a9cb7ff41a6414dd903e021e8ef248..efd91c3a2459ce8d6e9f70ee50c48e1f9f8490e6 100644 --- a/zh-cn/device-dev/subsystems/subsys-security.md +++ b/zh-cn/device-dev/subsystems/subsys-security.md @@ -10,4 +10,4 @@ - **[IPC通信鉴权开发指导](subsys-security-communicationverify.md)** -- **[设备安全等级管理开发指南](subsys-security-dslm.md)** \ No newline at end of file +- **[设备安全等级管理开发指南](subsys-security-devicesecuritylevel.md)** \ No newline at end of file diff --git a/zh-cn/device-dev/website.md b/zh-cn/device-dev/website.md index 027328e7311c4b39f3d269290c5addb579ecdbd6..0fadc464d0591d3258404733ae751befc06b937d 100644 --- a/zh-cn/device-dev/website.md +++ b/zh-cn/device-dev/website.md @@ -22,9 +22,8 @@ - [烧录](quick-start/quickstart-ide-lite-steps-hi3516-burn.md) - [运行](quick-start/quickstart-ide-lite-steps-hi3516-running.md) - 附录 - - 开发板介绍 - - [Hi3861开发板介绍](quick-start/quickstart-ide-lite-introduction-hi3861.md) - - [Hi3516开发板介绍](quick-start/quickstart-ide-lite-introduction-hi3516.md) + - [Hi3861开发板介绍](quick-start/quickstart-ide-lite-introduction-hi3861.md) + - [Hi3516开发板介绍](quick-start/quickstart-ide-lite-introduction-hi3516.md) - 轻量和小型系统快速入门(安装包方式) - [轻量与小型系统入门概述](quick-start/quickstart-lite-overview.md) - [搭建轻量与小型系统环境](quick-start/quickstart-lite-env-setup.md) @@ -70,9 +69,8 @@ - [烧录](quick-start/quickstart-ide-standard-running-rk3568-burning.md) - [运行](quick-start/quickstart-ide-standard-running-rk3568-running.md) - 附录 - - 开发板介绍 - - [Hi3516开发板介绍](quick-start/quickstart-ide-standard-board-introduction-hi3516.md) - - [RK3568开发板介绍](quick-start/quickstart-ide-standard-board-introduction-rk3568.md) + - [Hi3516开发板介绍](quick-start/quickstart-ide-standard-board-introduction-hi3516.md) + - [RK3568开发板介绍](quick-start/quickstart-ide-standard-board-introduction-rk3568.md) - 标准系统快速入门(安装包方式) - [标准系统入门概述](quick-start/quickstart-standard-overview.md) - [搭建标准系统环境](quick-start/quickstart-standard-env-setup.md) @@ -95,6 +93,7 @@ - 开发板介绍 - [Hi3516开发板介绍](quick-start/quickstart-standard-board-introduction-hi3516.md) - [RK3568开发板介绍](quick-start/quickstart-standard-board-introduction-rk3568.md) + - [参考信息](quickstart-standard-reference.md) - [获取源码](get-code/sourcecode-acquire.md) - 兼容性与安全 @@ -343,37 +342,40 @@ - [配置管理](driver/driver-hdf-manage.md) - [HDF开发实例](driver/driver-hdf-sample.md) - 平台驱动开发 - - [ADC](driver/driver-platform-adc-develop.md) - - [GPIO](driver/driver-platform-gpio-develop.md) - - [HDMI](driver/driver-platform-hdmi-develop.md) - - [I2C](driver/driver-platform-i2c-develop.md) - - [I3C](driver/driver-platform-i3c-develop.md) - - [MIPI-CSI](driver/driver-platform-mipicsi-develop.md) - - [MIPI-DSI](driver/driver-platform-mipidsi-develop.md) - - [MMC](driver/driver-platform-mmc-develop.md) - - [PIN](driver/driver-platform-pin-develop.md) - - [PWM](driver/driver-platform-pwm-develop.md) - - [REGULATOR](driver/driver-platform-regulator-develop.md) - - [RTC](driver/driver-platform-rtc-develop.md) - - [SDIO](driver/driver-platform-sdio-develop.md) - - [SPI](driver/driver-platform-spi-develop.md) - - [UART](driver/driver-platform-uart-develop.md) - - [WatchDog](driver/driver-platform-watchdog-develop.md) + - [ADC](driver-platform-adc-develop.md) + - [DAC](driver-platform-dac-develop.md) + - [GPIO](driver-platform-gpio-develop.md) + - [HDMI](driver-platform-hdmi-develop.md) + - [I2C](driver-platform-i2c-develop.md) + - [I3C](driver-platform-i3c-develop.md) + - [MIPI CSI](driver-platform-mipicsi-develop.md) + - [MIPI DSI](driver-platform-mipidsi-develop.md) + - [MMC](driver-platform-mmc-develop.md) + - [PIN](driver-platform-pin-develop.md) + - [PWM](driver-platform-pwm-develop.md) + - [Regulator](driver-platform-regulator-develop.md) + - [RTC](driver-platform-rtc-develop.md) + - [SDIO](driver-platform-sdio-develop.md) + - [SPI](driver-platform-spi-develop.md) + - [UART](driver-platform-uart-develop.md) + - [WatchDog](driver-platform-watchdog-develop.md) - 平台驱动使用 - - [ADC](driver/driver-platform-adc-des.md) - - [GPIO](driver/driver-platform-gpio-des.md) - - [HDMI](driver/driver-platform-hdmi-des.md) - - [I2C](driver/driver-platform-i2c-des.md) - - [I3C](driver/driver-platform-i3c-des.md) - - [MIPI-CSI](driver/driver-platform-mipicsi-des.md) - - [MIPI-DSI](driver/driver-platform-mipidsi-des.md) - - [PWM](driver/driver-platform-pwm-des.md) - - [REGULATOR](driver/driver-platform-regulator-des.md) - - [RTC](driver/driver-platform-rtc-des.md) - - [SDIO](driver/driver-platform-sdio-des.md) - - [SPI](driver/driver-platform-spi-des.md) - - [UART](driver/driver-platform-uart-des.md) - - [WATCHDOG](driver/driver-platform-watchdog-des.md) + - [ADC](driver-platform-adc-des.md) + - [DAC](driver-platform-dac-des.md) + - [GPIO](driver-platform-gpio-des.md) + - [HDMI](driver-platform-hdmi-des.md) + - [I2C](driver-platform-i2c-des.md) + - [I3C](driver-platform-i3c-des.md) + - [MIPI CSI](driver-platform-mipicsi-des.md) + - [MIPI DSI](driver-platform-mipidsi-des.md) + - [PIN](driver-platform-pin-des.md) + - [PWM](driver-platform-pwm-des.md) + - [Regulator](driver-platform-regulator-des.md) + - [RTC](driver-platform-rtc-des.md) + - [SDIO](driver-platform-sdio-des.md) + - [SPI](driver-platform-spi-des.md) + - [UART](driver-platform-uart-des.md) + - [WatchDog](driver-platform-watchdog-des.md) - 外设驱动使用 - [LCD](driver/driver-peripherals-lcd-des.md) - [TOUCHSCREEN](driver/driver-peripherals-touch-des.md) @@ -382,6 +384,8 @@ - [AUDIO](driver/driver-peripherals-audio-des.md) - [USB](driver/driver-peripherals-usb-des.md) - [CAMERA](driver/driver-peripherals-camera-des.md) + - [Vibrator](driver-peripherals-vibrator-des.md) + - [Light](driver-peripherals-light-des.md) - 编译构建 - [轻量和小型系统编译构建指导](subsystems/subsys-build-mini-lite.md) - [标准系统编译构建指导](subsystems/subsys-build-standard-large.md) 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 e32a196366bab756e826da4c67a4a58181085c04..ea9cd3213831097db6aa04cb8a62584459368576 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" @@ -87,6 +87,7 @@ bm install -p /data/app/ohosapp.hap -r | ----------------------------- | ------------------------ | | bm uninstall -h | 显示uninstall支持的命令信息 | | bm uninstall -n | 通过指定包名卸载应用 | +| bm uninstall -n -k | 通过指定包名卸载应用时保留数据目录 | | bm uninstall -n -u | 通过指定包名和用户卸载应用 | | bm uninstall -n -m | 通过指定包名卸载应用的一个模块 | @@ -94,6 +95,8 @@ bm install -p /data/app/ohosapp.hap -r ```Bash # 卸载一个hap bm uninstall -n com.ohos.app +# 卸载一个hap,保留数据目录 +bm uninstall -n com.ohos.app -k # 卸载一个hap下面的ability bm uninstall -n com.ohos.app -m com.ohos.app.MainAbility ``` diff --git "a/zh-cn/readme/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237.md" index 51c3221948d9d20afaa633eadf9adc2e4aaa6fdc..534a6cf33ad74b0409273057680ef612ec422eba 100755 --- "a/zh-cn/readme/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237.md" +++ "b/zh-cn/readme/\345\256\211\345\205\250\345\255\220\347\263\273\347\273\237.md" @@ -59,7 +59,7 @@ OpenHarmony中应用和系统服务均运行在独立的沙箱中,进程空间 应用权限管理提供了权限申请机制,允许应用申请权限,这些权限由系统或者其他应用定义,权限申请通过后就能访问这个权限相关的系统或其他应用提供的敏感API; -应用权限管理也为用户提供了一些必须的功能,方便用户查看和管理权限授予情况。 +应用权限管理也为用户提供了一些必需的功能,方便用户查看和管理权限授予情况。 **应用完整性校验**