diff --git a/CODEOWNERS b/CODEOWNERS index 025c30e10317662d65ab6b1d45688bf87ef41817..a98eba13b7b574232201efd76d84579561a42ccd 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -85,14 +85,19 @@ zh-cn/device-dev/subsystems/subsys-security-sigverify.md @duangavin123_admin zh-cn/device-dev/subsystems/subsys-security-rightmanagement.md @duangavin123_admin zh-cn/device-dev/subsystems/subsys-security-communicationverify.md @duangavin123_admin zh-cn/device-dev/subsystems/subsys-security-devicesecuritylevel.md @duangavin123_admin -zh-cn/device-dev/subsystems/subsys-boot-overview.md @Austin23 -zh-cn/device-dev/subsystems/subsys-boot-init.md @Austin23 zh-cn/device-dev/subsystems/subsys-boot-appspawn.md @Austin23 -zh-cn/device-dev/subsystems/subsys-boot-appspawn-standard.md @Austin23 zh-cn/device-dev/subsystems/subsys-boot-bootstrap.md @Austin23 -zh-cn/device-dev/subsystems/subsys-boot-syspara.md @Austin23 zh-cn/device-dev/subsystems/subsys-boot-faqs.md @Austin23 +zh-cn/device-dev/subsystems/subsys-boot-init-cfg.md @Austin23 +zh-cn/device-dev/subsystems/subsys-boot-init-jobs.md @Austin23 +zh-cn/device-dev/subsystems/subsys-boot-init-plugin.md @Austin23 +zh-cn/device-dev/subsystems/subsys-boot-init-sandbox.md @Austin23 +zh-cn/device-dev/subsystems/subsys-boot-init-service.md @Austin23 +zh-cn/device-dev/subsystems/subsys-boot-init-sysparam.md @Austin23 +zh-cn/device-dev/subsystems/subsys-boot-init.md @Austin23 +zh-cn/device-dev/subsystems/subsys-boot-overview.md @Austin23 zh-cn/device-dev/subsystems/subsys-boot-ref.md @Austin23 +zh-cn/device-dev/subsystems/subsys-boot.md @Austin23 zh-cn/device-dev/subsystems/subsys-testguide-test.md @Austin23 zh-cn/device-dev/subsystems/subsys-dfx-overview.md @duangavin123_admin zh-cn/device-dev/subsystems/subsys-dfx-hilog-rich.md @duangavin123_admin diff --git a/en/OpenHarmony-Overview.md b/en/OpenHarmony-Overview.md index c9eff6c8fe752a73cc4b8a2837ffe2a8ee7c0f0f..6d25dfc5658b20f7005c59287d4475f3eb4e5071 100644 --- a/en/OpenHarmony-Overview.md +++ b/en/OpenHarmony-Overview.md @@ -1,202 +1,205 @@ # OpenHarmony Project -## Introduction +## Introduction -OpenHarmony is an open-source project incubated and operated by the OpenAtom Foundation. It is an open-source operating system with a framework and platform applicable to smart devices in all scenarios of a fully-connected world. It aims to promote the development of the Internet of Everything (IoE). +OpenHarmony is an open-source project incubated and operated by the OpenAtom Foundation. The purpose of this project is to build an open-source, distributed operating system (OS) framework for smart devices in all scenarios of a fully-connected world. -## Technical Architecture +## Technical Architecture -OpenHarmony is designed with a layered architecture, which from bottom to top, consists of the kernel layer, system service layer, framework layer, and application layer. System functions are expanded by levels, from system to subsystem, and further to module. In a multi-device deployment scenario, unnecessary modules can be excluded from the system as required. The following figure shows the technical architecture of OpenHarmony. +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 expanded by levels, from system to subsystem, and further to component. In a multi-device deployment scenario, unnecessary components can be excluded from the system as required. The following figure shows the technical architecture of OpenHarmony. ![](figures/1.png) **Kernel layer** -- Kernel subsystem: OpenHarmony uses a multi-kernel design \(Linux or LiteOS\) so that different kernels can be selected for devices with different resource limitations. The kernel abstraction layer \(KAL\) hides differences in kernel implementations and provides the upper layer with basic kernel capabilities, including process and thread management, memory management, file system, network management, and peripheral management. +- Kernel subsystem: OpenHarmony uses a multi-kernel design (Linux or LiteOS) so that different kernels can be selected for devices with different resource limitations. The kernel abstraction layer (KAL) hides differences in kernel implementations and provides the upper layer with basic kernel capabilities, including process and thread management, memory management, file system, network management, and peripheral management. -- Driver subsystem: Hardware Driver Foundation \(HDF\) lays the foundation for an open OpenHarmony hardware ecosystem. It allows for unified access from peripheral devices and provides foundation for driver development and management. +- Driver subsystem: Hardware Driver Foundation (HDF) lays the foundation for an open OpenHarmony hardware ecosystem. It allows for unified access from peripheral devices and provides foundation for driver development and management. **System service layer** -The system service layer provides a complete set of capabilities essential for OpenHarmony to offer services for apps through the framework layer. This layer consists of the following parts: +The system service layer provides a complete set of capabilities essential for OpenHarmony to offer services for applications through the framework layer. This layer consists of the following parts: -- Basic system capability subsystem set: Implements distributed app running, scheduling, and migration across OpenHarmony devices. This subsystem set provides the following basic capabilities: Distributed Soft Bus (DSoftBus), distributed data management, Distributed Scheduler, Utils, multimodal input, graphics, security, and AI. +- Basic system capability subsystem set: Implements distributed application running, scheduling, and migration across OpenHarmony devices. This subsystem set provides the following basic capabilities: Distributed Soft Bus (DSoftBus), distributed data management, Distributed Scheduler, Utils, multimodal input, graphics, security, and AI. -- Basic software service subsystem set: Provides OpenHarmony with common universal software services, including common event and notification, telephony, multimedia, and Design For X \(DFX\). +- Basic software service subsystem set: Provides OpenHarmony with common universal software services, including common event and notification, telephony, multimedia, and Design For X (DFX). -- Enhanced software service subsystem set: Provides OpenHarmony with differentiated enhanced software services, including those dedicated to smart TVs, wearables, IoT devices, and more. +- Enhanced software service subsystem set: Provides OpenHarmony with differentiated enhanced software services, including those dedicated to smart TVs, wearables, IoT devices, and more. -- Hardware service subsystem set: Provides OpenHarmony with hardware services, including location, IAM, as well as those dedicated to wearables and IoT devices. +- Hardware service subsystem set: Provides OpenHarmony with hardware services, including location, user IAM, as well as those dedicated to wearables and IoT devices. -The basic software service, enhanced software service, and hardware service subsystem sets can be modified by the subsystems, and each subsystem can be modified by various functions, depending on the deployment scenario for a particular device form. +The basic software service, enhanced software service, and hardware service subsystem sets can be tailored by subsystems, and each subsystem can be tailored by functions, depending on the deployment scenario for a particular device form. **Framework layer** -This layer provides with what you need to develop OpenHarmony apps: application framework and ability framework, specific to multiple languages \(like C, C++, and JS\), ArkUI framework, as well as multi-language APIs for hardware and software services. The APIs designed for different OpenHarmony devices can be modified based on various system components. +This layer provides with what you need to develop OpenHarmony applications: application framework and ability framework specific to multiple languages (like C, C++, and JS), JS-specific ArkUI framework, as well as multi-language APIs for hardware and software services. The APIs designed for different OpenHarmony devices vary according to the components in use. **Application layer** -This layer consists of system apps and third-party apps. Each OpenHarmony app is powered by one or more Feature Abilities \(FAs\) or Particle Abilities \(PAs\). An FA provides a UI for user interaction. A PA has no UI and provides background task processing as well as data access. Apps developed based on FAs and PAs provide specific service characteristics and enable cross-device scheduling and distribution, delighting users with consistent and efficient experience. +This layer consists of system applications and third-party applications. Each OpenHarmony application is powered by one or more Feature Abilities (FAs) or Particle Abilities (PAs). An FA provides a UI for user interaction. A PA has no UI and provides background task processing as well as data access. Applications developed based on FAs and PAs provide specific service characteristics and enable cross-device scheduling and distribution, delighting users with consistent and efficient experience. -## Technical Features +## Technical Features **Hardware collaboration and resource sharing** This feature is implemented through the following modules: -- DSoftBus +- DSoftBus - DSoftBus is a unified base for seamless interconnection among devices. It powers OpenHarmony with distributed communication capabilities to quickly discover and connect devices, and efficiently transmit data. + DSoftBus is a unified base for seamless interconnection among devices. It powers OpenHarmony with distributed communication capabilities to quickly discover and connect devices, and efficiently transmit data. -- Distributed data management - - DSoftBus manages apps and user data distributed across different devices. Under such management, user data is no longer bound to a single physical device, and service logic is decoupled from storage. As your apps are running across devices, their data is seamlessly transmitted from one device to another, creating a foundation for a user experience that is smooth and consistent. -- Distributed Scheduler - - The Distributed Scheduler is designed based on technical features such as DSoftBus, distributed data management, and distributed profile. It builds a unified distributed service management mechanism \(including service discovery, synchronization, registration, and invocation\), and supports remote startup, remote invocation, binding/unbinding, and migration of apps across devices. This way, your app can select the most suitable device to perform distributed tasks based on the capabilities, locations, running status, and resource usage of different devices, as well as user habits and intentions. +- Distributed data management + + Distributed data management leverages DSoftBus to manage application data and user data distributed on different devices. Under such management, user data is no longer bound to a single physical device, and service logic is decoupled from storage. As your applications are running across devices, their data is seamlessly transmitted from one device to another, creating a foundation for a user experience that is smooth and consistent. -- Device virtualization - - A distributed device virtualization platform enables cross-device resource convergence, device management, and data processing so that virtual peripherals can function as capability extensions of smartphones to form a super virtual terminal. + +- Distributed Scheduler + + Distributed Scheduler is designed based on technical features such as DSoftBus, distributed data management, and distributed profile. It builds a unified distributed service management mechanism (including service discovery, synchronization, registration, and invocation), and supports remote startup, remote invocation, binding/unbinding, and migration of applications across devices. This way, your application can select the most suitable device to perform distributed tasks based on the capabilities, locations, running status, and resource usage of different devices, as well as user habits and intentions. + + +- Device virtualization + + A distributed device virtualization platform enables cross-device resource convergence, device management, and data processing so that virtual peripherals can function as capability extensions of smartphones to form a Super Device. **One-time development for multi-device deployment** -OpenHarmony provides you with the user application, ability, and UI frameworks. With these frameworks, you can develop your apps once, and then flexibly deploy them across a broad range of different devices. +OpenHarmony provides you with the application, ability, and UI frameworks. With these frameworks, you can develop your applications once, and then flexibly deploy them across a broad range of different devices. One-time development for multi-device deployment -Consistent APIs ensure the operational compatibility of apps across devices. +Consistent APIs ensure the operational compatibility of applications across devices. -- Adaptation of device capabilities \(including CPU, memory, peripheral, and software resources\) can be previewed. -- Resources can be scheduled based on the compatibility between user apps and the software platform. +- Adaptation of device capabilities (including CPU, memory, peripheral, and software resources) can be previewed. +- Resources can be scheduled based on the compatibility between applications and the software platform. **A unified OS for flexible deployment** OpenHarmony enables hardware resources to be scaled with its component-based and small-scale designs. It can be deployed on demand for a diverse range of devices, including ARM, RISC-V, and x86 architectures, and providing RAM volumes ranging from hundreds of KiB to GiB. -## OS Types +## System Types -OpenHarmony supports the following types: +OpenHarmony supports the following system types: -- Mini system +- Mini system - A mini system runs on the devices whose memory is greater than or equal to 128 KiB and that are equipped with MCU processors such as Arm Cortex-M and 32-bit RISC-V. This system provides multiple lightweight network protocols and graphics frameworks, and a wide range of read/write components for the IoT bus. Typical products include connection modules, sensors, and wearables for smart home. + A mini system fits into devices that come with Micro Controller Units (MCUs), such as Arm Cortex-M and 32-bit RISC-V processors, and memory greater than or equal to 128 KiB. This system provides multiple lightweight network protocols, a lightweight graphics framework, and a wide range of read/write components with the IoT bus. Typical products include connection modules, sensors, and wearables for smart home. -- Small system +- Small system - A small system runs on the devices whose memory is greater than or equal to 1 MiB and that are equipped with application processors such as Arm Cortex-A. This system provides higher security capabilities, standard graphics frameworks, and video encoding and decoding capabilities. Typical products include smart home IP cameras, electronic cat eyes, routers, and event data recorders \(EDRs\) for smart travel. + A small system runs on devices whose memory is greater than or equal to 1 MiB and that are equipped with application processors such as Arm Cortex-A. This system provides higher security capabilities, standard graphics frameworks, and video encoding and decoding capabilities. Typical products include smart home IP cameras, electronic cat eyes, and routers, and event data recorders (EDRs) for easy travel. -- Standard system +- Standard system - A standard system runs on the devices whose memory is greater than or equal to 128 MiB and that are equipped with application processors such as Arm Cortex-A. This system provides a complete application framework supporting the enhanced interaction, 3D GPU, hardware composer, diverse components, and rich animations. This system applies to high-end refrigerator displays. + A standard system runs on devices whose memory is greater than or equal to 128 MiB and that are equipped with application processors such as Arm Cortex-A. This system provides a complete application framework supporting the enhanced interaction, 3D GPU, hardware composer, diverse components, and rich animations. This system applies to high-end refrigerator displays. -## Subsystems +## Subsystems You need to understand the following basic concepts related to OpenHarmony: -- Subsystem +- Subsystem - OpenHarmony is designed with a layered architecture, which from bottom to top consists of the kernel layer, system service layer, framework layer, and application layer. System functions are expanded by levels, from system to subsystem, and further to module. In a multi-device deployment scenario, unnecessary modules can be excluded from the system as required. A subsystem is a logical concept and is a flexible combination of functions. + 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 expanded by levels, from system to subsystem, and further to component. In a multi-device deployment scenario, unnecessary components can be excluded from the system as required. A subsystem, as a logical concept, consists of the least required components. -- Module +- Components - 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. + A component is a reusable software binary 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. -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). +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| + +| Subsystem | Description | Application Scope | | -------- | -------- | -------- | -| 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 | -| Distributed File System | 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 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:
- 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 | -| Common Event and 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, uninstall, 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 and Daily Build| +| 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| +| Distributed File System | 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 modules. It is an application framework that can be built on the LiteOS to develop OpenHarmony applications for 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 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 application 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 applications 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 applications on the device side, and query and update of the cloud account login status.| Standard system | +| Build | Provides a compilation and building framework based on Generate Ninja (GN) and Ninja. | All systems | +| Test | The test-driven development mode is used during the development process. You can develop new cases or modify existing cases to test new or enhanced system features. The test helps you develop high-quality code in the development phase.| All systems | +| Data Management | Provides local data management and distributed data management:
- Local application data management for lightweight preference databases and relational databases
- Distributed data service to provide applications with the capability to store data in the databases of different devices| Standard system | +| Programming Language Runtime| Provides the compilation and execution environment for programs developed with JavaScript or C/C++, basic libraries that support the runtime, and the runtime-associated APIs, compilers, and auxiliary tools.| All systems | +| Distributed Scheduler| Starts, registers, queries, and manages system services. | All systems | +| JS UI Framework | OpenHarmony JS UI framework supports web-development-like paradigm. | All systems | +| Multimedia | Provides easy-to-use APIs for developing multimedia components such as audio, video, and camera, and enables applications to use multimedia resources of the system.| All systems | +| Common Event and Notification | Provides the common event management capabilities that allow applications 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, uninstall, 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 components of OpenHarmony, which can be used by OpenHarmony subsystems and upper-layer applications.| 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 Home Screen, SystemUI, and Settings. It also provides specific examples for you to build standard-system applications, 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, application and system event logging APIs, the event log subscription service, and fault information generation and collection capabilities.| All systems | +| Globalization | If OpenHarmony devices and applications 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 application security capabilities to protect system and user data of OpenHarmony. Its functions include application integrity verification, application permission management, device authentication, and key management.| All systems | + +## Supported Development Boards + +Currently, the OpenHarmony community supports 17 types of development boards, which are listed in [Development Boards Supported](device-dev/dev-board-on-the-master.md). The following table describes three of them, which are the first three integrated into the OpenHarmony master). + +| System Type| Board Model| Chip Model| Function Description and Use Case| 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 | +| Standard system| Runhe HH-SCDAYU200| RK3568 | Function description:
Bolstered by the Rockchip RK3568, the HH-SCDAYU200 development board integrates the dual-core GPU and efficient 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, Wi-Fi, audio, video, and camera features, with a wide range of expansion ports to accommodate various video input and outputs. 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.
Use case:
[DAYU200 Use Case](device-dev/porting/porting-dayu200-on_standard-demo.md)| Entertainment, easy 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 | +| Small system| Hispark_Taurus | Hi3516DV300 | Function Description:
Hi3516D V300 is 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 high performance in terms of low bit rate, high image quality, intelligent processing and analysis, and low power consumption.| Smart device with screens, such as refrigerators with screens 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 | +| Mini system| Multi-modal V200Z-R | BES2600 | Function description:
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 Wi-Fi 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.
Use case:
[Multi-modal V200Z-R Use Case](device-dev/porting/porting-bes2600w-on-minisystem-display-demo.md)| Smart hardware, and smart devices 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 | -## Getting Started +## Getting Started - [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 -OpenHarmony project: [https://gitee.com/openharmony](https://gitee.com/openharmony) -OpenHarmony SIG: [https://gitee.com/openharmony-sig](https://gitee.com/openharmony-sig) +## Code Repository Addresses + +OpenHarmony project: [https://gitee.com/openharmony](https://gitee.com/openharmony) + +OpenHarmony SIGs: [https://gitee.com/openharmony-sig](https://gitee.com/openharmony-sig) -OpenHarmony third-party components: [https://gitee.com/openharmony-tpc](https://gitee.com/openharmony-tpc) +OpenHarmony third-party components: [https://gitee.com/openharmony-tpc](https://gitee.com/openharmony-tpc) -OpenHarmony archived projects: [https://gitee.com/openharmony-retired](https://gitee.com/openharmony-retired) +OpenHarmony archived projects: [https://gitee.com/openharmony-retired](https://gitee.com/openharmony-retired) -## OpenHarmony Documentation +## OpenHarmony Documentation -[Chinese version](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme.md) +[Chinese version](https://gitee.com/openharmony/docs/tree/master/zh-cn) -[English version](https://gitee.com/openharmony/docs/blob/master/en/readme.md) +[English version](https://gitee.com/openharmony/docs/tree/master/en) -## Source Code Downloading +## Source Code Downloading -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). +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 +## Hands-On Tutorials [Samples](https://gitee.com/openharmony/app_samples) [Codelabs](https://gitee.com/openharmony/codelabs) -## How to Participate +## How to Participate -For details about how to join in the OpenHarmony community, see [OpenHarmony Community](https://gitee.com/openharmony/community/blob/master/README-EN.md). +For details about how to join in the OpenHarmony community, see [OpenHarmony Community](https://gitee.com/openharmony/community/blob/master/README-EN.md) -For details about how to contribute, see [How to Contribute](contribute/how-to-contribute.md). +For details about how to contribute, see [How to contribute](contribute/how-to-contribute.md). -## License Agreement +## License Agreement 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](https://gitee.com/openharmony/docs/blob/master/en/contribute/third-party-open-source-software-and-license-notice.md). -## Contact Info +## Contact Info Website: diff --git a/en/application-dev/ability/figures/fa-package-info.png b/en/application-dev/ability/figures/fa-package-info.png deleted file mode 100644 index 86da707408da8fdb149ea62d92298fed605132ca..0000000000000000000000000000000000000000 Binary files a/en/application-dev/ability/figures/fa-package-info.png and /dev/null differ diff --git a/en/application-dev/dfx/hitracemeter-guidelines.md b/en/application-dev/dfx/hitracemeter-guidelines.md index e7e97631c240bb42358d3b0b630a92094f34bcfc..de4f037bab24fd90b7196b5cc89e56cb1b771a06 100644 --- a/en/application-dev/dfx/hitracemeter-guidelines.md +++ b/en/application-dev/dfx/hitracemeter-guidelines.md @@ -6,7 +6,7 @@ HiTraceMeter provides APIs for system performance tracing. You can call the APIs ## Available APIs -The performance tracing APIs are provided by the **hiTraceMeter** module. For details, see [API Reference]( ../reference/apis/js-apis-hitracemeter.md). +The performance tracing APIs are provided by the **hiTraceMeter** module. For details, see [API Reference](../reference/apis/js-apis-hitracemeter.md). **APIs for performance tracing** diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655128646.png b/en/application-dev/quick-start/figures/en-us_image_0000001655128646.png new file mode 100644 index 0000000000000000000000000000000000000000..048b8e07817272b759781df104c1dd4526685d61 Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655128646.png differ diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655128939.png b/en/application-dev/quick-start/figures/en-us_image_0000001655128939.png new file mode 100644 index 0000000000000000000000000000000000000000..606ce3a0eab0a39f166029182bcc2f70291740d6 Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655128939.png differ diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655128998.png b/en/application-dev/quick-start/figures/en-us_image_0000001655128998.png new file mode 100644 index 0000000000000000000000000000000000000000..d044d5d829ab1ad805f4ffcda19837f867b976fc Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655128998.png differ diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655129041.png b/en/application-dev/quick-start/figures/en-us_image_0000001655129041.png new file mode 100644 index 0000000000000000000000000000000000000000..2dd664a2b25751cc32bd81927b30036d5cc4f351 Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655129041.png differ diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655129232.png b/en/application-dev/quick-start/figures/en-us_image_0000001655129232.png new file mode 100644 index 0000000000000000000000000000000000000000..7d3222667d7bffe89a148dc3b08861a86c43713e Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655129232.png differ diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655129264.png b/en/application-dev/quick-start/figures/en-us_image_0000001655129264.png new file mode 100644 index 0000000000000000000000000000000000000000..c188c864c051f68984ecc0c4c64be83f0dd6e1e9 Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655129264.png differ diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655129333.png b/en/application-dev/quick-start/figures/en-us_image_0000001655129333.png new file mode 100644 index 0000000000000000000000000000000000000000..b42f2e3896d334d86e89b867cf3428782f88d600 Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655129333.png differ diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655129372.png b/en/application-dev/quick-start/figures/en-us_image_0000001655129372.png new file mode 100644 index 0000000000000000000000000000000000000000..8541c80810d3f3dfb7180fede34a51221dc56106 Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655129372.png differ diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655129398.png b/en/application-dev/quick-start/figures/en-us_image_0000001655129398.png new file mode 100644 index 0000000000000000000000000000000000000000..2dda1a5cfca8d75d70e40b8bc0d555faade04583 Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655129398.png differ diff --git a/en/application-dev/quick-start/full-sdk-switch-guide.md b/en/application-dev/quick-start/full-sdk-switch-guide.md new file mode 100644 index 0000000000000000000000000000000000000000..4c20e429bdef97ab0503614d01f1807e56eedb13 --- /dev/null +++ b/en/application-dev/quick-start/full-sdk-switch-guide.md @@ -0,0 +1,98 @@ +# Guide to Switching to Full SDK + +Both the public SDK and full SDK are toolkits for application development. + +The public SDK is intended for application developers and provided as standard in DevEco Studio. It does not contain system APIs – APIs required by system applications. + +The full SDK is intended for original equipment manufacturers (OEMs) and provided separately. It contains system APIs. + +The SDK of API version 8 provided in DevEco Studio is a public SDK. If your project depends on any system API, such as the **animator** component, **xcomponent** component, or APIs in **@ohos.application.abilityManager.d.ts**, **@ohos.application.formInfo.d.ts**, or **@ohos.bluetooth.d.ts**, switch to the full SDK by performing the following steps. + +## Downloading the Full SDK (of 3.1.1 Release in this example) + +Manually download the full SDK. For details, see the source code acquisition section in [OpenHarmony 3.1.1 Release](https://gitee.com/openharmony/docs/blob/master/en/release-notes/OpenHarmony-v3.1.1-release.md). + +![image-20220613161049897](figures/en-us_image_0000001655128646.png) + + + + +## Checking the Local SDK Location
In this example, an eTS project is used. For a JS project, replace **ets** with **js**. + +In DevEco Studio, choose **Tools** > **OpenHarmony SDK Manager** to check the location of the local SDK. + +![](figures/en-us_image_0000001655128939.png) + +![image-20220613160524053](figures/en-us_image_0000001655128998.png) + + +## Replacing the SDK + +1. Make sure the downloaded SDK is a full SDK. + + a. Verify that the name of the downloaded file contains **sdk-full**. + + ![image-20220613220702504](figures/en-us_image_0000001655129232.png) + + b. Verify that the SDK contains system APIs (such as APIs defined in **@ohos.application.abilityManager.d.ts**, **@ohos.application.formInfo.d.ts**, and **@ohos.bluetooth.d.ts**). + + Note: The criteria for identifying system APIs are subject to the released API documentation. + + + +2. Replace the SDK. The following uses full SDK 3.1.6.6 for Windows as an example. + + + + a. Decompress the downloaded full SDK file: `ets-windows-3.1.6.5-Release.zip` + + ![image-20220613165018184](figures/en-us_image_0000001655129264.png) + + b. Replace the SDK files. + + Back up the local SDK files. (Copy and rename the version number directory in the **ets** directory, or copy the entire **ets** directory to another local path.) + + Go to the obtained location of the local installed SDK and back up the files therein. + + ![image-20220613161352157](figures/en-us_image_0000001655129041.png) + + Note: The name of the backup version number directory must be different from the value of **version** field in the **oh-uni-package.json** file. In the example below, the name of the backup version number directory is **3.1.6.6_backup**. + + ![image-20220613165018184](figures/en-us_image_0000001655129398.png) + + The configuration in the **oh-uni-package.json** file is as follows: + + ``` + { + "apiVersion": "8", + "displayName": "Ets", + "meta": { + "metaVersion": "3.0.0" + }, + "path": "ets", + "releaseType": "Release", + "version": "3.1.6.6" + } + ``` + + **Delete all files in the original SDK (3.1.6.6) directory.** Failure to do so may result in some files being unable to be overwritten. + + + + Copy the full SDK to the location of the local SDK. + + Copy all files in the **ets** directory in the full SDK to the **ets\3.1.6.6** directory in the location of the local SDK. + + Change the value of **version** in the **oh-uni-package.json** file to the current SDK version number. + + + + In the **3.1.6.6\build-tools\ets-loader** directory, open the **cmd/powerShell** window and run the **npm install** command to download the **node_modules** dependency package. + + ![image-20220613171111405](figures/en-us_image_0000001655129333.png) + + + + c. Check for system APIs. + + ![image-20220613213038104](figures/en-us_image_0000001655129372.png) diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md index fb8f943cea9d605b242f3ecb85d587a997ad581e..6b5bbc8aa3d671c4cf0b01316db441d33c0f189f 100644 --- a/en/application-dev/reference/apis/Readme-EN.md +++ b/en/application-dev/reference/apis/Readme-EN.md @@ -32,6 +32,7 @@ - [@ohos.ability.errorCode](js-apis-ability-errorCode.md) - [@ohos.ability.wantConstant](js-apis-ability-wantConstant.md) - [@ohos.application.abilityDelegatorRegistry](js-apis-abilityDelegatorRegistry.md) + - [@ohos.application.abilityManager](js-apis-application-abilityManager.md) - [@ohos.application.appManager](js-apis-appmanager.md) - [@ohos.application.Configuration](js-apis-configuration.md) - [@ohos.application.ConfigurationConstant](js-apis-configurationconstant.md) @@ -43,6 +44,8 @@ - [@ohos.application.formProvider](js-apis-formprovider.md) - [@ohos.application.missionManager](js-apis-missionManager.md) - [@ohos.application.Want](js-apis-application-Want.md) + - [@ohos.continuation.continuationManager](js-apis-continuation-continuationExtraParams.md) + - [@ohos.continuation.continuationManager](js-apis-continuation-continuationManager.md) - [@ohos.wantAgent](js-apis-wantAgent.md) - application/[abilityDelegator](js-apis-application-abilityDelegator.md) - application/[abilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md) @@ -52,7 +55,7 @@ - application/[MissionSnapshot](js-apis-application-MissionSnapshot.md) - application/[ProcessRunningInfo](js-apis-processrunninginfo.md) - application/[shellCmdResult](js-apis-application-shellCmdResult.md) - + - continuation/[ContinuationResult](js-apis-continuation-continuationResult.md) - Common Event and Notification - [@ohos.commonEvent](js-apis-commonEvent.md) diff --git a/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md b/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md index e79d761f6a6792096d19b06cabab447af9ed8dac..098f4ebba840a13d1f37d6e14256fcc9695f2a8d 100644 --- a/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md +++ b/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md @@ -25,9 +25,9 @@ abilitymanager.getAbilityRunningInfos((err,data) => { | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| ability | ElementName | Yes| No| Information that matches an ability. | -| pid | number | Yes| No| Process ID.| -| uid | number | Yes| No| User ID. | -| processName | string | Yes| No| Process name. | -| startTime | number | Yes| No| Ability start time. | -| abilityState | [abilityManager.AbilityState](js-apis-abilityManager.md#abilityState) | Yes| No| Ability state. | +| ability | ElementName | Yes| No| Information that matches an ability. | +| pid | number | Yes| No| Process ID.| +| uid | number | Yes| No| User ID. | +| processName | string | Yes| No| Process name. | +| startTime | number | Yes| No| Ability start time. | +| abilityState | [abilityManager.AbilityState](js-apis-application-abilityManager.md#abilitystate) | Yes| No| Ability state. | diff --git a/en/application-dev/reference/apis/js-apis-accessibility.md b/en/application-dev/reference/apis/js-apis-accessibility.md index 17ef631d0f7207b676177a59d0903cc77dcd1045..f9d286cbd34296fa43596032fe89f2ecdd6e5d93 100644 --- a/en/application-dev/reference/apis/js-apis-accessibility.md +++ b/en/application-dev/reference/apis/js-apis-accessibility.md @@ -1,6 +1,9 @@ # Accessibility -> **NOTE**
+The **Accessibility** module implements the accessibility functions, including obtaining the accessibility application list, accessibility application enabled status, and captions configuration. + +> **NOTE** +> > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import @@ -13,162 +16,162 @@ import accessibility from '@ohos.accessibility'; Enumerates the states of an accessibility application. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core +**System capability**: SystemCapability.BarrierFree.Accessibility.Core - | Name | Description | - | -------- | -------- | - | enable | The accessibility application is enabled. | - | disable | The accessibility application is disabled. | - | install | The accessibility application has been installed. | +| Name| Description| +| -------- | -------- | +| enable | The accessibility application is enabled.| +| disable | The accessibility application is disabled.| +| install | The accessibility application has been installed.| ## AbilityType Enumerates the types of accessibility applications. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core +**System capability**: SystemCapability.BarrierFree.Accessibility.Core - | Name | Description | - | -------- | -------- | - | audible | The accessibility application provides audible feedback. | - | generic | The accessibility application provides generic feedback. | - | haptic | The accessibility application provides haptic feedback. | - | spoken | The accessibility application provides spoken feedback. | - | visual | The accessibility application provides visual feedback. | +| Name| Description| +| -------- | -------- | +| audible | The accessibility application provides audible feedback.| +| generic | The accessibility application provides generic feedback.| +| haptic | The accessibility application provides haptic feedback.| +| spoken | The accessibility application provides spoken feedback.| +| visual | The accessibility application provides visual feedback.| +| all9+ | All the preceding types.| ## AccessibilityAbilityInfo Provides information about an accessibility application. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core +**System capability**: SystemCapability.BarrierFree.Accessibility.Core ### Attributes - | Name | Type | Readable | Writable | Description | - | -------- | -------- | -------- | -------- | -------- | - | id | number | Yes | No | Ability ID. | - | name | string | Yes | No | Ability name. | - | bundleName | string | Yes | No | Bundle name. | - | abilityTypes | Array<[AbilityType](#abilitytype)> | Yes | No | Accessibility application type. | - | capabilities | Array<[Capability](#capability)> | Yes | No | Capabilities list of the accessibility application. | - | description | string | Yes | No | Description of the accessibility application. | - | eventTypes | Array<[EventType](#eventtype)> | Yes | No | List of events that the accessibility application focuses on. | +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| id | number | Yes| No| Ability ID.| +| name | string | Yes| No| Ability name.| +| bundleName | string | Yes| No| Bundle name.| +| targetBundleNames9+ | Array<string> | Yes| No| Name of the target bundle.| +| abilityTypes | Array<[AbilityType](#abilitytype)> | Yes| No| Accessibility application type.| +| capabilities | Array<[Capability](#capability)> | Yes| No| Capabilities list of the accessibility application.| +| description | string | Yes| No| Description of the accessibility application.| +| eventTypes | Array<[EventType](#eventtype)> | Yes| No| List of events that the accessibility application focuses on.| ## Action Describes the target action supported by an accessibility application. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core - - | Name | Description | - | -------- | -------- | - | click | Clicking. | - | longClick | Long pressing. | - | scrollForward | Scrolling forward. | - | scrollBackward | Scrolling backward. | - | focus | Obtaining focus. | - | clearFocus | Clearing focus. | - | clearSelection | Clearing selection. | - | accessibilityFocus | Obtaining the accessibility focus. | - | clearAccessibilityFocus | Clearing the accessibility focus. | - | cut | Cut. | - | copy | Copy. | - | paste | Paste. | - | select | Select. | - | setText | Setting the text. | - | delete | Delete. | - | setSelection | Setting the selection. | +**System capability**: SystemCapability.BarrierFree.Accessibility.Core + +| Name| Description| +| -------- | -------- | +| click | Clicking.| +| longClick | Long pressing.| +| scrollForward | Scrolling forward.| +| scrollBackward | Scrolling backward.| +| focus | Obtaining focus.| +| clearFocus | Clearing focus.| +| clearSelection | Clearing selection.| +| accessibilityFocus | Obtaining the accessibility focus.| +| clearAccessibilityFocus | Clearing the accessibility focus.| +| cut | Cut.| +| copy | Copy.| +| paste | Paste.| +| select | Select.| +| setText | Setting the text.| +| delete | Delete.| +| setSelection | Setting the selection.| ## Capability Enumerates the capabilities of an auxiliary application. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core +**System capability**: SystemCapability.BarrierFree.Accessibility.Core - | Name | Description | - | -------- | -------- | - | retrieve | Capability to retrieve the window content. | - | touchGuide | Capability of touch guide mode. | - | keyEventObserver | Capability to filter key events. | - | zoom | Capability to control the display zoom level. | - | gesture | Capability to perform gesture actions. | +| Name| Description| +| -------- | -------- | +| retrieve | Capability to retrieve the window content.| +| touchGuide | Capability of touch guide mode.| +| keyEventObserver | Capability to filter key events.| +| zoom | Capability to control the display zoom level.| +| gesture | Capability to perform gesture actions.| ## CaptionsFontEdgeType8+ -Enumerates the caption font edge type. +Enumerates the font edge types of captions. -**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing +**System capability**: SystemCapability.BarrierFree.Accessibility.Hearing - | Name | Description | - | -------- | -------- | - | none | No effect. | - | raised | Raised effect. | - | depressed | Depressed effect. | - | uniform | Uniform effect. | - | dropShadow | Drop shadow effect. | +| Name| Description| +| -------- | -------- | +| none | No effect.| +| raised | Raised effect.| +| depressed | Depressed effect.| +| uniform | Uniform effect.| +| dropShadow | Drop shadow effect.| ## CaptionsFontFamily8+ -Enumerates the caption font families. +Enumerates the font families of captions. -**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing +**System capability**: SystemCapability.BarrierFree.Accessibility.Hearing - | Name | Description | - | -------- | -------- | - | default | Default font family. | - | monospacedSerif | Monospaced Serif fonts, which use the same width for each character. | - | serif | Serif fonts. | - | monospacedSansSerif | Monospaced Sans Serif fonts, which use the same width for each character. | - | sansSerif | Sans Serif fonts. | - | casual | Casual fonts. | - | cursive | Cursive fonts. | - | smallCapitals | Small caps fonts. | +| Name| Description| +| -------- | -------- | +| default | Default font family.| +| monospacedSerif | Monospaced Serif fonts, which use the same width for each character.| +| serif | Serif fonts.| +| monospacedSansSerif | Monospaced Sans Serif fonts, which use the same width for each character.| +| sansSerif | Sans Serif fonts.| +| casual | Casual fonts.| +| cursive | Cursive fonts.| +| smallCapitals | Small caps fonts.| ## CaptionsStyle8+ -Describes the caption style. +Describes the style of captions. -**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing +**System capability**: SystemCapability.BarrierFree.Accessibility.Hearing - | Name | Type | Readable | Writable | Description | - | -------- | -------- | -------- | -------- | -------- | - | fontFamily | [CaptionsFontFamily](#captionsfontfamily8) | Yes | No | Font family of the captions. | - | fontScale | number | Yes | No | Font scale of the captions. | - | fontColor | number \ | string | Yes | No | Font color of the captions. | - | fontEdgeType | [CaptionsFontEdgeType](#captionsfontedgetype8) | Yes | No | Font edge type of the captions. | - | backgroundColor | number \ | string | Yes | No | Background color of the captions. | - | windowColor | number \ | string | Yes | No | Window color of the captions. | +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| fontFamily | [CaptionsFontFamily](#captionsfontfamily8) | Yes| No| Font family of captions.| +| fontScale | number | Yes| No| Font scale of captions.| +| fontColor | number \| string | Yes| No| Font color of captions.| +| fontEdgeType | [CaptionsFontEdgeType](#captionsfontedgetype8) | Yes| No| Font edge type of captions.| +| backgroundColor | number \| string | Yes| No| Background color of captions.| +| windowColor | number \| string | Yes| No| Window color of captions.| ## CaptionsManager8+ -Implements caption configuration management. +Implements configuration management for captions. -### Attributes +**System capability**: SystemCapability.BarrierFree.Accessibility.Hearing - | Name | Type | Readable | Writable | Description | - | -------- | -------- | -------- | -------- | -------- | - | enabled | boolean | Yes | No | Whether to enable caption configuration. | - | style | [CaptionsStyle](#captionsstyle8) | Yes | No | Caption style. | +### Attributes -### Methods +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| enabled | boolean | Yes| No| Whether to enable captions configuration.| +| style | [CaptionsStyle](#captionsstyle8) | Yes| No| Style of captions.| -In the following API examples, you must first use the [accessibility.getCaptionsManager()](#accessibilitygetcaptionsmanager8) method to obtain a **captionsManager** instance, and then call the methods using the obtained instance. +In the following API examples, you must first use the [accessibility.getCaptionsManager()](#accessibilitygetcaptionsmanager8) API to obtain a **captionsManager** instance, and then call the methods using the obtained instance. -#### on('enableChange') +### on('enableChange') on(type: 'enableChange', callback: Callback<boolean>): void; -Enables listening for enable status changes of caption configuration. - -**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing +Enables listening for enabled status changes of captions configuration. - **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | type | string | Yes | Type of the event to listen for, which is set to **enableChange** in this API. | - | callback | Callback<boolean> | Yes | Callback invoked when the enable status of caption configuration changes. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Type of the event to listen for, which is set to **enableChange** in this API.| + | callback | Callback<boolean> | Yes| Callback invoked when the enabled status of captions configuration changes.| -- Example +- **Example** ```typescript captionsManager.on('enableChange',(data) => { @@ -176,22 +179,20 @@ Enables listening for enable status changes of caption configuration. }) ``` -#### on('styleChange') +### on('styleChange') on(type: 'styleChange', callback: Callback<CaptionsStyle>): void; -Enables listening for caption style changes. - -**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing +Enables listening for captions style changes. - **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | type | string | Yes | Type of the event to listen for, which is set to **styleChange** in this API. | - | callback | Callback<[CaptionsStyle](#captionsstyle8)> | Yes | Callback invoked when the caption style changes. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Type of the event to listen for, which is set to **styleChange** in this API.| + | callback | Callback<[CaptionsStyle](#captionsstyle8)> | Yes| Callback invoked when the style of captions changes.| -- Example +- **Example** ```typescript captionsManager.on('styleChange',(data) => { @@ -199,43 +200,39 @@ Enables listening for caption style changes. }) ``` -#### off('enableChange') +### off('enableChange') off(type: 'enableChange', callback?: Callback<boolean>): void; -Disables listening for enable status changes of caption configuration. - -**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing +Disables listening for enabled status changes of captions configuration. - **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | type | string | Yes | Type of the event to listen for, which is set to **enableChange** in this API. | - | callback | Callback<boolean> | No | Callback invoked when the enable status of caption configuration changes. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Type of the event to listen for, which is set to **enableChange** in this API.| + | callback | Callback<boolean> | No| Callback invoked when the enabled status of captions configuration changes.| -- Example +- **Example** ```typescript captionsManager.off('enableChange') ``` -#### off('styleChange') +### off('styleChange') off(type: 'styleChange', callback?: Callback<CaptionsStyle>): void; -Disables listening for caption style changes.s is removed. - -**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing +Disables listening for captions style changes. - **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | type | string | Yes | Type of the event to listen for, which is set to **styleChange** in this API. | - | callback | Callback<[CaptionsStyle](#captionsstyle8)> | No | Callback invoked when the caption style changes. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Type of the event to listen for, which is set to **styleChange** in this API.| + | callback | Callback<[CaptionsStyle](#captionsstyle8)> | No| Callback invoked when the style of captions changes.| -- Example +- **Example** ```typescript captionsManager.off('styleChange') @@ -245,80 +242,92 @@ Disables listening for caption style changes.s is removed. Describes a GUI change event. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core +**System capability**: SystemCapability.BarrierFree.Accessibility.Core ### Attributes - | Name | Type | Readable | Writable | Description | - | -------- | -------- | -------- | -------- | -------- | - | type | [EventType](#eventtype) | Yes | Yes | Accessibility event type. | - | windowUpdateType | [WindowUpdateType](#windowupdatetype) | Yes | Yes | Window update type. | - | bundleName | string | Yes | Yes | Target application name. | - | componentType | string | Yes | Yes | Type of the event source component, for example, button or chart. | - | pageId | number | Yes | Yes | Page ID of the event source. | - | description | string | Yes | Yes | Event description. | - | triggerAction | [Action](#action) | Yes | Yes | Action that triggers the event. | - | textMoveUnit | [TextMoveUnit](#textmoveunit) | Yes | Yes | Text movement unit. | - | contents | Array<string> | Yes | Yes | Array of contents. | - | lastContent | string | Yes | Yes | Latest content. | - | beginIndex | number | Yes | Yes | Sequence number of the first item displayed on the page. | - | currentIndex | number | Yes | Yes | Sequence number of the current item. | - | endIndex | number | Yes | Yes | Sequence number of the last item displayed on the page. | - | itemCount | number | Yes | Yes | Total number of items. | +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| type | [EventType](#eventtype) | Yes| Yes| Accessibility event type.| +| windowUpdateType | [WindowUpdateType](#windowupdatetype) | Yes| Yes| Window update type.| +| bundleName | string | Yes| Yes| Target application name.| +| componentType | string | Yes| Yes| Type of the event source component, for example, button or chart.| +| pageId | number | Yes| Yes| Page ID of the event source.| +| description | string | Yes| Yes| Event description.| +| triggerAction | [Action](#action) | Yes| Yes| Action that triggers the event.| +| textMoveUnit | [TextMoveUnit](#textmoveunit) | Yes| Yes| Text movement unit.| +| contents | Array<string> | Yes| Yes| Array of contents.| +| lastContent | string | Yes| Yes| Latest content.| +| beginIndex | number | Yes| Yes| Sequence number of the first item displayed on the page.| +| currentIndex | number | Yes| Yes| Sequence number of the current item.| +| endIndex | number | Yes| Yes| Sequence number of the last item displayed on the page.| +| itemCount | number | Yes| Yes| Total number of items.| + +### constructor + +constructor(jsonObject) + +Implements a constructor. + +- **Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | jsonObject | string | Yes| JSON string required for creating an object.| + +- **Example** + + ```typescript + let eventInfo = new accessibility.EventInfo({"type":"click","bundleName":"com.example.MyApplication","triggerAction":"click"}) + ``` ## EventType Enumerates accessibility event types. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core - - | Name | Description | - | -------- | -------- | - | click | Event of clicking a component. | - | longClick | Event of long-pressing a component. | - | select | Event of selecting a component. | - | focus | Event indicating that the component obtains the focus. | - | textUpdate | Event indicating that the component text has been updated. | - | hoverEnter | Event indicating that the hover enters a component. | - | hoverExit | Event indicating that the hover exits a component. | - | scroll | Event of the scroll view. | - | textSelectionUpdate | Event indicating that the selected text has been updated. | - | accessibilityFocus | Event indicating that the accessibility focus has been obtained. | - | accessibilityFocusClear | Event indicating that the accessibility focus has been cleared. | +**System capability**: SystemCapability.BarrierFree.Accessibility.Core + +| Name| Description| +| -------- | -------- | +| click | Event of clicking a component.| +| longClick | Event of long-pressing a component.| +| select | Event of selecting a component.| +| focus | Event indicating that the component obtains the focus.| +| textUpdate | Event indicating that the component text has been updated.| +| hoverEnter | Event indicating that the hover enters a component.| +| hoverExit | Event indicating that the hover exits a component.| +| scroll | Event of the scroll view.| +| textSelectionUpdate | Event indicating that the selected text has been updated.| +| accessibilityFocus | Event indicating that the accessibility focus has been obtained.| +| accessibilityFocusClear | Event indicating that the accessibility focus has been cleared.| ## TextMoveUnit Enumerates the movement units for traversing the node text. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core +**System capability**: SystemCapability.BarrierFree.Accessibility.Core - | Name | Description | - | -------- | -------- | - | char | The movement unit for traversing the node text is by character. | - | word | The movement unit for traversing the node text is by word. | - | line | The movement unit for traversing the node text is by line. | - | page | The movement unit for traversing the node text is by page. | - | paragraph | The movement unit for traversing the node text is by paragraph. | +| Name| Description| +| -------- | -------- | +| char | The movement unit for traversing the node text is by character.| +| word | The movement unit for traversing the node text is by word.| +| line | The movement unit for traversing the node text is by line.| +| page | The movement unit for traversing the node text is by page.| +| paragraph | The movement unit for traversing the node text is by paragraph.| ## WindowUpdateType Enumerates window update types. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core - - | Name | Description | - | -------- | -------- | - | add | Window adding. | - | remove | Window deletion. | - | title | Window title change. | - | bounds | Window boundary change. | - | layer | Window layer change. | - | active | Window activity change. | - | focus | Window focus change. | - | accessibilityFocus | Window accessibility focus change. | - | parent | Parent window change. | - | children | Child window change. | - | pip | Picture-in-picture (PIP) mode change. | +**System capability**: SystemCapability.BarrierFree.Accessibility.Core + +| Name| Description| +| -------- | -------- | +| add | Window adding.| +| remove | Window deletion.| +| bounds | Window boundary change.| +| active | Window activity change.| +| focus | Window focus change.| ## accessibility.getAbilityLists @@ -326,22 +335,22 @@ getAbilityLists(abilityType: AbilityType, stateType: AbilityState): Promise<A Obtains the accessibility application list. This API uses a promise to return the result. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core +**System capability**: SystemCapability.BarrierFree.Accessibility.Core - **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | abilityType | [AbilityType](#abilitytype) | Yes | Accessibility application type. | - | stateType | [AbilityState](#abilitystate) | Yes | Accessibility application status. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | abilityType | [AbilityType](#abilitytype) | Yes| Accessibility application type.| + | stateType | [AbilityState](#abilitystate) | Yes| Accessibility application status.| -- Return value +- **Return value** - | Type | Description | - | -------- | -------- | - | Promise<Array<[AccessibilityAbilityInfo](#accessibilityabilityinfo)>> | Promise used to return the accessibility application list. | + | Type| Description| + | -------- | -------- | + | Promise<Array<[AccessibilityAbilityInfo](#accessibilityabilityinfo)>> | Promise used to return the accessibility application list.| -- Example +- **Example** ```typescript accessibility.getAbilityLists("spoken", "enable") @@ -369,17 +378,17 @@ getAbilityLists(abilityType: AbilityType, stateType: AbilityState,callback: Asyn Obtains the accessibility application list. This API uses an asynchronous callback to return the result. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core +**System capability**: SystemCapability.BarrierFree.Accessibility.Core - **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | abilityType | [AbilityType](#abilitytype) | Yes | Accessibility application type. | - | stateType | [AbilityState](#abilitystate) | Yes | Accessibility application status. | - | callback | AsyncCallback<Array<[AccessibilityAbilityInfo](#accessibilityabilityinfo)>> | Yes | Callback used to return the accessibility application list. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | abilityType | [AbilityType](#abilitytype) | Yes| Accessibility application type.| + | stateType | [AbilityState](#abilitystate) | Yes| Accessibility application status.| + | callback | AsyncCallback<Array<[AccessibilityAbilityInfo](#accessibilityabilityinfo)>> | Yes| Callback used to return the accessibility application list.| -- Example +- **Example** ```typescript accessibility.getAbilityLists("visual", "enable", (err, data) => { @@ -406,17 +415,17 @@ Obtains the accessibility application list. This API uses an asynchronous callba getCaptionsManager(): CaptionsManager -Obtains the accessibility caption configuration. +Obtains the captions configuration. -**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing +**System capability**: SystemCapability.BarrierFree.Accessibility.Hearing -- Return value +- **Return value** - | Type | Description | - | -------- | -------- | - | [CaptionsManager](#captionsmanager8) | Accessibility caption configuration. | + | Type| Description| + | -------- | -------- | + | [CaptionsManager](#captionsmanager8) | Captions configuration.| -- Example +- **Example** ```typescript captionsManager = accessibility.getCaptionsManager() @@ -430,12 +439,12 @@ Enables listening for the accessibility application or touch guide mode status c - **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | type | string | Yes | Type of the event to listen for.
- **accessibilityStateChange** means to listen for enable status changes of the accessibility application.
**System capability**: SystemCapability.Barrierfree.Accessibility.Core
- **touchGuideStateChange** means to listen for enable status changes of the touch guide mode.
**System capability**: SystemCapability.Barrierfree.Accessibility.Vision | - | callback | Callback<boolean> | Yes | Callback invoked when the enable status changes. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Type of the event to listen for.
- **'accessibilityStateChange'** means to listen for enabled status changes of the accessibility application.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
- **'touchGuideStateChange'** means to listen for enabled status changes of the touch guide mode.
**System capability**: SystemCapability.BarrierFree.Accessibility.Vision| + | callback | Callback<boolean> | Yes| Callback invoked when the enabled status of captions configuration changes.| -- Example +- **Example** ```typescript accessibility.on('accessibilityStateChange',(data) => { @@ -447,18 +456,16 @@ Enables listening for the accessibility application or touch guide mode status c off(type: 'accessibilityStateChange ' | 'touchGuideStateChange', callback?: Callback<boolean>): void -Disables listening for the accessibility application or touch guide mode status changes. - - +Disables listening for the accessibility application or touch guide mode status changes. - **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | type | string | No | Type of the event to listen for.
- **accessibilityStateChange** means to listen for enable status changes of the accessibility application.
**System capability**: SystemCapability.Barrierfree.Accessibility.Core
- **touchGuideStateChange** means to listen for enable status changes of the touch guide mode.
**System capability**: SystemCapability.Barrierfree.Accessibility.Vision | - | callback | Callback<boolean> | No | Callback invoked when the enable status changes. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | No| Type of the event to listen for.
- **'accessibilityStateChange'** means to listen for enabled status changes of the accessibility application.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
- **'touchGuideStateChange'** means to listen for enabled status changes of the touch guide mode.
**System capability**: SystemCapability.BarrierFree.Accessibility.Vision| + | callback | Callback<boolean> | No| Callback invoked when the enabled status changes.| -- Example +- **Example** ```typescript accessibility.off('accessibilityStateChange',(data) => { @@ -472,15 +479,15 @@ isOpenAccessibility(): Promise<boolean> Checks whether accessibility is enabled. This API uses a promise to return the result. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core +**System capability**: SystemCapability.BarrierFree.Accessibility.Core -- Return value +- **Return value** - | Type | Description | - | -------- | -------- | - | Promise<boolean> | Returns **true** if accessibility is enabled; returns **false** otherwise. | + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Returns **true** if accessibility is enabled; returns **false** otherwise.| -- Example +- **Example** ```typescript accessibility.isOpenAccessibility() @@ -497,15 +504,15 @@ isOpenAccessibility(callback: AsyncCallback<boolean>): void Checks whether accessibility is enabled. This API uses an asynchronous callback to return the result. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core +**System capability**: SystemCapability.BarrierFree.Accessibility.Core -- Parameters +- **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<boolean> | Yes | Callback used to return the result. Returns **true** if accessibility is enabled; returns **false** otherwise. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns **true** if accessibility is enabled; returns **false** otherwise.| -- Example +- **Example** ```typescript accessibility.isOpenAccessibility((err, data) => { @@ -523,15 +530,15 @@ isOpenTouchGuide(): Promise<boolean> Checks whether touch guide mode is enabled. This API uses a promise to return the result. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core +**System capability**: SystemCapability.BarrierFree.Accessibility.Vision -- Return value +- **Return value** - | Type | Description | - | -------- | -------- | - | Promise<boolean> | Returns **true** if touch guide mode is enabled; returns **false** otherwise. | + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Returns **true** if touch guide mode is enabled; returns **false** otherwise.| -- Example +- **Example** ```typescript accessibility.isOpenTouchGuide() @@ -548,15 +555,15 @@ isOpenTouchGuide(callback: AsyncCallback<boolean>): void Checks whether touch guide mode is enabled. This API uses an asynchronous callback to return the result. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core +**System capability**: SystemCapability.BarrierFree.Accessibility.Vision -- Parameters +- **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<boolean> | Yes | Callback used to return the result. Returns **true** if touch guide mode is enabled; returns **false** otherwise. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns **true** if touch guide mode is enabled; returns **false** otherwise.| -- Example +- **Example** ```typescript accessibility.isOpenTouchGuide((err, data) => { @@ -574,21 +581,21 @@ sendEvent(event: EventInfo): Promise<void> Sends an accessibility event. This API uses a promise to return the result. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core +**System capability**: SystemCapability.BarrierFree.Accessibility.Core - **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | event | [EventInfo](#eventinfo) | Yes | Accessibility event. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | event | [EventInfo](#eventinfo) | Yes| Accessibility event.| -- Return value +- **Return value** - | Type | Description | - | -------- | -------- | - | Promise<void> | Promise used to return the result. Returns data if the accessibility event is sent successfully; returns an error otherwise. | + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result. Returns data if the accessibility event is sent successfully; returns an error otherwise.| -- Example +- **Example** ```typescript accessibility.sendEvent(this.eventInfo) @@ -605,16 +612,16 @@ sendEvent(event: EventInfo, callback: AsyncCallback<void>): void Sends an accessibility event. This API uses an asynchronous callback to return the result. -**System capability**: SystemCapability.Barrierfree.Accessibility.Core +**System capability**: SystemCapability.BarrierFree.Accessibility.Core - **Parameters** - | Name | Type | Mandatory | Description | - | -------- | -------- | -------- | -------- | - | event | [EventInfo](#eventinfo) | Yes | Accessibility event. | - | callback | AsyncCallback<void> | Yes | Callback used to return the result. Returns data if the accessibility event is sent successfully; returns an error otherwise. | + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | event | [EventInfo](#eventinfo) | Yes| Accessibility event.| + | callback | AsyncCallback<void> | Yes| Callback used to return the result. Returns data if the accessibility event is sent successfully; returns an error otherwise.| -- Example +- **Example** ```typescript accessibility.sendEvent(this.eventInfo,(err, data) => { diff --git a/en/application-dev/reference/apis/js-apis-application-abilityManager.md b/en/application-dev/reference/apis/js-apis-application-abilityManager.md index 2a7827180ffe1c0a0d5aa022957eb90a0d6cb3f9..e1bf96bae511de4e1fb83d92df6ee05bdddbf990 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityManager.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityManager.md @@ -7,7 +7,7 @@ The **AbilityManager** module provides APIs for obtaining, adding, and modifying > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The APIs of this module are system APIs and cannot be called by third-party applications. -# Modules to Import +## Modules to Import ```js import AbilityManager from '@ohos.application.abilityManager' @@ -19,6 +19,8 @@ Enumerates the ability states. **System capability**: SystemCapability.Ability.AbilityRuntime.Core +**System API**: This is a system API and cannot be called by third-party applications. + | Name| Value| Description| | -------- | -------- | -------- | | INITIAL | 0 | The ability is in the initial state.| diff --git a/en/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md b/en/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md new file mode 100644 index 0000000000000000000000000000000000000000..755557fba6455122d78e1bc4c8f09c12e305521a --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md @@ -0,0 +1,22 @@ +# ContinuationExtraParams + +The **ContinuationExtraParams** module provides the extra parameters required by the device manager in the continuation management entry. + +> **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. + +## ContinuationExtraParams + +Describes the extra parameters required by the device selection module in the continuation management entry. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| deviceType | Array\ | Yes| Yes| Device type.| +| targetBundle | string | Yes| Yes| Target bundle name.| +| description | string | Yes| Yes| Device filtering description.| +| filter | any | Yes| Yes| Device filtering parameter.| +| continuationMode | [ContinuationMode](js-apis-continuation-continuationManager.md#continuationmode) | Yes| Yes| Continuation mode.| +| authInfo | { [key: string]: any } | Yes| Yes| Authentication information.| diff --git a/en/application-dev/reference/apis/js-apis-continuation-continuationManager.md b/en/application-dev/reference/apis/js-apis-continuation-continuationManager.md new file mode 100644 index 0000000000000000000000000000000000000000..007d35d1408e2381aca841dd64cb9ce6a078b16a --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-continuation-continuationManager.md @@ -0,0 +1,496 @@ +# continuationManager + +The **continuationManager** module provides the continuation management entry. You can use the APIs of this module to connect to and cancel the continuation management service, subscribe to and unsubscribe from device connection events, start the device selection module, and update the device connection state. + +Currently, this module provides incomplete functions, and its APIs are mainly used to start the device selection module. **The continuation capability is not available for application development.** + +> **NOTE** +> +> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Modules to Import + +```js +import continuationManager from '@ohos.continuation.continuationManager' +``` + +## continuationManager.register + +register(callback: AsyncCallback\): void; + +Registers the continuation management service and obtains a token. This API does not involve any filter parameters and uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback\ | Yes| Callback used to return the token generated after the continuation management service is connected.| + +**Example** + + ```js + let token = -1; + continuationManager.register((err, data) => { + if (err.code != 0) { + console.error('register failed, cause: ' + JSON.stringify(err)); + return; + } + console.info('register finished, ' + JSON.stringify(data)); + token = data; + }); + ``` + +## continuationManager.register + +register(options: ContinuationExtraParams, callback: AsyncCallback\): void; + +Registers the continuation management service and obtains a token. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | options | [ContinuationExtraParams](js-apis-continuation-continuationExtraParams.md) | Yes| Extra parameters used to filter the list of available devices.| + | callback | AsyncCallback\ | Yes| Callback used to return the token generated after the continuation management service is connected.| + +**Example** + + ```js + let token = -1; + let continuationExtraParams = { + deviceType: ["00E"] + }; + continuationManager.register(continuationExtraParams, (err, data) => { + if (err.code != 0) { + console.error('register failed, cause: ' + JSON.stringify(err)); + return; + } + console.info('register finished, ' + JSON.stringify(data)); + token = data; + }); + ``` + +## continuationManager.register + +register(options?: ContinuationExtraParams): Promise\; + +Registers the continuation management service and obtains a token. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | options | [ContinuationExtraParams](js-apis-continuation-continuationExtraParams.md) | No| Extra parameters used to filter the list of available devices. This parameter can be null.| + +**Return value** + +| Type | Description | +| ------------------------- | ------------------ | +| Promise\ | Promise used to return the token generated after the continuation management service is connected.| + +**Example** + + ```js + let token = -1; + let continuationExtraParams = { + deviceType: ["00E"] + }; + continuationManager.register(continuationExtraParams) + .then((data) => { + console.info('register finished, ' + JSON.stringify(data)); + token = data; + }) + .catch((err) => { + console.error('register failed, cause: ' + JSON.stringify(err)); + }); + ``` + +## continuationManager.on("deviceConnect")(deprecated) +> This API is deprecated since API version 9. You are advised to use [on](#continuationmanagerondeviceconnect) instead. + +on(type: "deviceConnect", callback: Callback\): void; + +Subscribes to device connection events. This API uses an asynchronous callback to return the result. + +## continuationManager.on("deviceDisconnect")(deprecated) +> This API is deprecated since API version 9. You are advised to use [on](#continuationmanagerondevicedisconnect) instead. + +on(type: "deviceDisconnect", callback: Callback\): void; + +Subscribes to device disconnection events. This API uses an asynchronous callback to return the result. + +## continuationManager.off("deviceConnect")(deprecated) +> This API is deprecated since API version 9. You are advised to use [off](#continuationmanageroffdeviceconnect) instead. + +off(type: "deviceConnect", callback?: Callback\): void; + +Unsubscribes from device connection events. This API uses an asynchronous callback to return the result. + +## continuationManager.off("deviceDisconnect")(deprecated) +> This API is deprecated since API version 9. You are advised to use [off](#continuationmanageroffdevicedisconnect) instead. + +off(type: "deviceDisconnect", callback?: Callback\): void; + +Unsubscribes from device disconnection events. This API uses an asynchronous callback to return the result. + +## continuationManager.on("deviceConnect")9+ + +on(type: "deviceConnect", token: number, callback: Callback\>): void; + +Subscribes to device connection events. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type. The value is fixed at **deviceConnect**.| + | token | number | Yes| Token obtained after the registration of the continuation management service.| + | callback | Callback\> | Yes| Callback invoked when a device is selected from the device list provided by the device selection module. This callback returns the device ID, type, and name.| + +**Example** + + ```js + let token = 1; + continuationManager.on("deviceConnect", token, (data) => { + console.info('onDeviceConnect len: ' + data.length); + for (let i = 0; i < data.length; i++) { + console.info('onDeviceConnect deviceId: ' + JSON.stringify(data[i].id)); + console.info('onDeviceConnect deviceType: ' + JSON.stringify(data[i].type)); + console.info('onDeviceConnect deviceName: ' + JSON.stringify(data[i].name)); + } + }); + ``` + +## continuationManager.on("deviceDisconnect")9+ + +on(type: "deviceDisconnect", token: number, callback: Callback\>): void; + +Subscribes to device disconnection events. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type. The value is fixed at **deviceDisconnect**.| + | token | number | Yes| Token obtained after the registration of the continuation management service.| + | callback | Callback\> | Yes| Callback invoked when a device is disconnected in the device selection module. This callback returns the device ID.| + +**Example** + + ```js + let token = 1; + continuationManager.on("deviceDisconnect", token, (data) => { + console.info('onDeviceDisconnect len: ' + data.length); + for (let i = 0; i < data.length; i++) { + console.info('onDeviceDisconnect deviceId: ' + JSON.stringify(data[i])); + } + console.info('onDeviceDisconnect finished.'); + }); + ``` + +## continuationManager.off("deviceConnect")9+ + +off(type: "deviceConnect", token: number): void; + +Unsubscribes from device connection events. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type. The value is fixed at **deviceConnect**.| + | token | number | Yes| Token obtained after the registration of the continuation management service.| + +**Example** + + ```js + let token = 1; + continuationManager.off("deviceConnect", token); + ``` + +## continuationManager.off("deviceDisconnect")9+ + +off(type: "deviceDisconnect", token: number): void; + +Unsubscribes from device disconnection events. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Event type. The value is fixed at **deviceDisconnect**.| + | token | number | Yes| Token obtained after the registration of the continuation management service.| + +**Example** + + ```js + let token = 1; + continuationManager.off("deviceDisconnect", token); + ``` + +## continuationManager.startDeviceManager + +startDeviceManager(token: number, callback: AsyncCallback\): void; + +Starts the device selection module to show the list of available devices on the network. This API does not involve any filter parameters and uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | token | number | Yes| Token obtained after the registration of the continuation management service.| + | callback | AsyncCallback\ | Yes| Callback used to return the result.| + +**Example** + + ```js + let token = 1; + continuationManager.startDeviceManager(token, (err, data) => { + if (err.code != 0) { + console.error('startDeviceManager failed, cause: ' + JSON.stringify(err)); + return; + } + console.info('startDeviceManager finished, ' + JSON.stringify(data)); + }); + ``` + +## continuationManager.startDeviceManager + +startDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback\): void; + +Starts the device selection module to show the list of available devices on the network. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | token | number | Yes| Token obtained after the registration of the continuation management service.| + | options | [ContinuationExtraParams](js-apis-continuation-continuationExtraParams.md) | Yes| Extra parameters used to filter the list of available devices.| + | callback | AsyncCallback\ | Yes| Callback used to return the result.| + +**Example** + + ```js + let token = 1; + let continuationExtraParams = { + deviceType: ["00E"] + }; + continuationManager.startDeviceManager(token, continuationExtraParams, (err, data) => { + if (err.code != 0) { + console.error('startDeviceManager failed, cause: ' + JSON.stringify(err)); + return; + } + console.info('startDeviceManager finished, ' + JSON.stringify(data)); + }); + ``` + +## continuationManager.startDeviceManager + +startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\; + +Starts the device selection module to show the list of available devices on the network. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | token | number | Yes| Token obtained after the registration of the continuation management service.| + | options | [ContinuationExtraParams](js-apis-continuation-continuationExtraParams.md) | No| Extra parameters used to filter the list of available devices. This parameter can be null.| + +**Return value** + +| Type | Description | +| ------------------------- | ------------------ | +| Promise\ | Promise used to return the result.| + +**Example** + + ```js + let token = 1; + let continuationExtraParams = { + deviceType: ["00E"] + }; + continuationManager.startDeviceManager(token, continuationExtraParams) + .then((data) => { + console.info('startDeviceManager finished, ' + JSON.stringify(data)); + }) + .catch((err) => { + console.error('startDeviceManager failed, cause: ' + JSON.stringify(err)); + }); + ``` + +## continuationManager.updateConnectStatus + +updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback\): void; + +Instructs the device selection module to update the device connection state. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | token | number | Yes| Token obtained after the registration of the continuation management service.| + | deviceId | string | Yes| Device ID.| + | status | [DeviceConnectState](#deviceconnectstate) | Yes| Device connection state.| + | callback | AsyncCallback\ | Yes| Callback used to return the result.| + +**Example** + + ```js + let token = 1; + let deviceId: string = "test deviceId"; + continuationManager.updateConnectStatus(token, deviceId, continuationManager.DeviceConnectState.CONNECTED, (err, data) => { + if (err.code != 0) { + console.error('updateConnectStatus failed, cause: ' + JSON.stringify(err)); + return; + } + console.info('updateConnectStatus finished, ' + JSON.stringify(data)); + }); + ``` + +## continuationManager.updateConnectStatus + +updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState): Promise\; + +Instructs the device selection module to update the device connection state. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | token | number | Yes| Token obtained after the registration of the continuation management service.| + | deviceId | string | Yes| Device ID.| + | status | [DeviceConnectState](#deviceconnectstate) | Yes| Device connection state.| + +**Return value** + +| Type | Description | +| ------------------------- | ------------------ | +| Promise\ | Promise used to return the result.| + +**Example** + + ```js + let token = 1; + let deviceId: string = "test deviceId"; + continuationManager.updateConnectStatus(token, deviceId, continuationManager.DeviceConnectState.CONNECTED) + .then((data) => { + console.info('updateConnectStatus finished, ' + JSON.stringify(data)); + }) + .catch((err) => { + console.error('updateConnectStatus failed, cause: ' + JSON.stringify(err)); + }); + ``` + +## continuationManager.unregister + +unregister(token: number, callback: AsyncCallback\): void; + +Deregisters the continuation management service. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | token | number | Yes| Token obtained after the registration of the continuation management service.| + | callback | AsyncCallback\ | Yes| Callback used to return the result.| + +**Example** + + ```js + let token = 1; + continuationManager.unregister(token, (err, data) => { + if (err.code != 0) { + console.error('unregister failed, cause: ' + JSON.stringify(err)); + return; + } + console.info('unregister finished, ' + JSON.stringify(data)); + }); + ``` + +## continuationManager.unregister + +unregister(token: number): Promise\; + +Deregisters the continuation management service. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | token | number | Yes| Token obtained after the registration of the continuation management service.| + +**Return value** + +| Type | Description | +| ------------------------- | ------------------ | +| Promise\ | Promise used to return the result.| + +**Example** + + ```js + let token = 1; + continuationManager.unregister(token) + .then((data) => { + console.info('unregister finished, ' + JSON.stringify(data)); + }) + .catch((err) => { + console.error('unregister failed, cause: ' + JSON.stringify(err)); + }); + ``` + +## DeviceConnectState + +Enumerates the device connection states. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Value| Description| + | -------- | -------- | -------- | -------- | + | IDLE | number | 0 | The device is in the initial state.| + | CONNECTING | number | 1 | The device is being connected.| + | CONNECTED | number | 2 | The device is connected.| + | DISCONNECTING | number | 3 | The device is being disconnected.| + +## ContinuationMode + +Enumerates the continuation modes provided by the device selection module. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +**Parameters** + + | Name| Type| Value| Description| + | -------- | -------- | -------- | -------- | + | COLLABORATION_SINGLE | number | 0 | Single-choice mode.| + | COLLABORATION_MULTIPLE | number | 1 | Multi-choice mode.| diff --git a/en/application-dev/reference/apis/js-apis-continuation-continuationResult.md b/en/application-dev/reference/apis/js-apis-continuation-continuationResult.md new file mode 100644 index 0000000000000000000000000000000000000000..bdebb727ff7b5c6b41868f37bf5ecdb0ea333d10 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-continuation-continuationResult.md @@ -0,0 +1,17 @@ +# ContinuationResult + +> **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. + +## ContinuationResult + +Describes the device information returned by the continuation management entry. + +**System capability**: SystemCapability.Ability.DistributedAbilityManager + +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| id | string | Yes| Yes| Device ID.| +| type | string | Yes| Yes| Device type.| +| name | string | Yes| Yes| Device name.| diff --git a/en/application-dev/reference/apis/js-apis-convertxml.md b/en/application-dev/reference/apis/js-apis-convertxml.md index 3fd4e4e52ca7a82b33dd6a13aa7f425ab2aea9be..43e096b951e7ea4d97ed9e0d40dc0481f34a0290 100644 --- a/en/application-dev/reference/apis/js-apis-convertxml.md +++ b/en/application-dev/reference/apis/js-apis-convertxml.md @@ -1,6 +1,9 @@ # XML-to-JavaScript Conversion -> **NOTE**
+The **convertxml** module provides APIs for converting XML text into JavaScript objects. + +> **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. @@ -47,10 +50,10 @@ let xml = ''; let conv = new convertxml.ConvertXML(); let options = {trim : false, declarationKey:"_declaration", - instructionKey : "_instruction", attributesKey : "_attributes", - textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype", - commentKey : "_comment", parentKey : "_parent", typeKey : "_type", - nameKey : "_name", elementsKey : "_elements"} + instructionKey : "_instruction", attributesKey : "_attributes", + textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype", + commentKey : "_comment", parentKey : "_parent", typeKey : "_type", + nameKey : "_name", elementsKey : "_elements"} let result = JSON.stringify(conv.convert(xml, options)); console.log(result) ``` diff --git a/en/application-dev/reference/apis/js-apis-data-ValuesBucket.md b/en/application-dev/reference/apis/js-apis-data-ValuesBucket.md index b0666612257857244fdffc8462cfd9719883412a..dc239c35cbe017f7c5edc0a9fd8ff1bd74b3c366 100644 --- a/en/application-dev/reference/apis/js-apis-data-ValuesBucket.md +++ b/en/application-dev/reference/apis/js-apis-data-ValuesBucket.md @@ -1,8 +1,8 @@ # Value Bucket -The **ValueBucket** holds data in key-value (KV) pairs. You can use it to insert data into a database. +The **ValueBucket** module holds data in key-value (KV) pairs. You can use it to insert data into a database. ->**Note** +>**NOTE** > >The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -20,7 +20,7 @@ Enumerates the value types allowed by the database. **System capability**: SystemCapability.DistributedDataManager.DataShare.Core -| Name | Description | +| Type | Description | | ------- | -------------------- | | number | The value is a number. | | string | The value is a string.| @@ -28,10 +28,10 @@ Enumerates the value types allowed by the database. ## ValuesBucket -Holds a set of KV pairs. +Defines the types of the key and value in a KV pair. **System capability**: SystemCapability.DistributedDataManager.DataShare.Core -| Name | Type | Mandatory| Description | -| ------------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | -| [key: string] | [ValueType](#valuetype)\| Uint8Array \| null | Yes | KV pairs in a **ValuesBucket**. The key is of the string type. The value can be a number, string, Boolean value, Unit8Array, or **null**.| +| Key Type | Value Type | +| ------------- | --------------------------------------------- | +| string | [ValueType](#valuetype)\| Uint8Array \| null | diff --git a/en/application-dev/reference/apis/js-apis-data-ability.md b/en/application-dev/reference/apis/js-apis-data-ability.md index a1c0aba0f59aa5831cfa2e54cbad92302b8724c8..3860be1f4cd4fae2b432c7286ae5aca1c2b44868 100644 --- a/en/application-dev/reference/apis/js-apis-data-ability.md +++ b/en/application-dev/reference/apis/js-apis-data-ability.md @@ -789,7 +789,7 @@ Enumerates the value types. **System capability**: SystemCapability.DistributedDataManager.DataShare.Core -| Name | Description | +| Type | Description | | ------- | -------------------- | | number | The value is a number. | | string | The value is a string. | diff --git a/en/application-dev/reference/apis/js-apis-data-preferences.md b/en/application-dev/reference/apis/js-apis-data-preferences.md index 63371ed42b8eb940caa8072ffda6aa17d78658c5..560696c1ca48cb404aa0a29e95f8c3c1a1841198 100644 --- a/en/application-dev/reference/apis/js-apis-data-preferences.md +++ b/en/application-dev/reference/apis/js-apis-data-preferences.md @@ -681,7 +681,7 @@ Enumerates the value types. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core -| Name | Description | +| Type | Description | | -------------- | ------------------------------ | | number | The value is a number. | | string | The value is a string. | diff --git a/en/application-dev/reference/apis/js-apis-data-rdb.md b/en/application-dev/reference/apis/js-apis-data-rdb.md index 65bec3ec53825f544a6bbda1618eda19d7abb708..38c07d6247487e037e9158a00e5c2f752621b44e 100644 --- a/en/application-dev/reference/apis/js-apis-data-rdb.md +++ b/en/application-dev/reference/apis/js-apis-data-rdb.md @@ -781,13 +781,6 @@ Sets the **RdbPredicates** to filter out duplicate records. ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "Rose").distinct("NAME") -let promise = rdbStore.query(predicates, ["NAME"]) -promise.then((resultSet) => { - console.log("ResultSet column names: " + resultSet.columnNames) - console.log("ResultSet column count: " + resultSet.columnCount) -}).catch((err) => { - console.log("Query err.") -}) ``` @@ -1133,7 +1126,7 @@ rdbStore.update("EMPLOYEE", valueBucket, predicates, function (err, ret) { ``` ### update9+ -update(table: string, values: ValuesBucket, predicates: DataSharePredicates):Promise<number> +update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates):Promise<number> Updates data in the RDB store based on the specified **DataSharePredicates** object. This API uses a promise to return the result. @@ -1215,7 +1208,7 @@ Deletes data from the RDB store based on the specified **RdbPredicates** object. **Return value** | Type| Description| | -------- | -------- | -| Promise<number> | Promise used to return the number of rows updated.| +| Promise<number> | Promise used to return the number of rows updated.| **Example** ```js @@ -1231,7 +1224,7 @@ promise.then((rows) => { ### delete9+ -delete(table: string, predicates: DataSharePredicates, callback: AsyncCallback<number>):void +delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>):void Deletes data from the RDB store based on the specified **DataSharePredicates** object. This API uses an asynchronous callback to return the result. @@ -1275,7 +1268,7 @@ Deletes data from the RDB store based on the specified **DataSharePredicates** o **Return value** | Type| Description| | -------- | -------- | -| Promise<number> | Promise used to return the number of rows updated.| +| Promise<number> | Promise used to return the number of rows updated.| **Example** ```js @@ -1354,7 +1347,7 @@ Queries data in the RDB store based on specified conditions. This API uses a pro ### query9+ -query(predicates: DataSharePredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void +query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void Queries data in the RDB store based on specified conditions. This API uses an asynchronous callback to return the result. @@ -1363,6 +1356,7 @@ Queries data in the RDB store based on specified conditions. This API uses an as **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | +| table | string | Yes| Name of the target table.| | predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes| Query conditions specified by the **DataSharePredicates** object.| | columns | Array<string> | Yes| Columns to query. If this parameter is not specified, the query applies to all columns.| | callback | AsyncCallback<[ResultSet](js-apis-data-resultset.md)> | Yes| Callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.| @@ -1384,7 +1378,7 @@ rdbStore.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], ### query9+ -query(predicates: DataSharePredicates, columns?: Array<string>):Promise<ResultSet> +query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns?: Array<string>):Promise<ResultSet> Queries data in the RDB store based on specified conditions. This API uses a promise to return the result. @@ -1393,6 +1387,7 @@ Queries data in the RDB store based on specified conditions. This API uses a pro **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | +| table | string | Yes| Name of the target table.| | predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes| Query conditions specified by the **DataSharePredicates** object.| | columns | Array<string> | No| Columns to query. If this parameter is not specified, the query applies to all columns.| @@ -1591,7 +1586,7 @@ rdbStore.commit() ### rollBack8+ -rollBack():void; +rollBack():void Rolls back the SQL statements that have been executed. @@ -1997,7 +1992,7 @@ Defines the data types allowed. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core -| Name| Description| +| Type| Description| | -------- | -------- | | number | Number.| | string | String.| @@ -2006,14 +2001,13 @@ Defines the data types allowed. ## ValuesBucket -Defines a bucket to store key-value pairs. +Defines the types of the key and value in a KV pair. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| [key: string] | [ValueType](#valuetype)\| Uint8Array \| null | Yes| Defines a bucket to store key-value pairs.| - +| Key Type| Value Type| +| -------- | -------- | +| string | [ValueType](#valuetype)\| Uint8Array \| null | ## SyncMode8+ diff --git a/en/application-dev/reference/apis/js-apis-data-storage.md b/en/application-dev/reference/apis/js-apis-data-storage.md index 47a961f7cceb3c20de583387d9ed54d5494e5ac4..45465710a587c51fea60e7c59f2b804c80888043 100644 --- a/en/application-dev/reference/apis/js-apis-data-storage.md +++ b/en/application-dev/reference/apis/js-apis-data-storage.md @@ -793,7 +793,7 @@ Enumerates the value types. **System capability**: SystemCapability.DistributedDataManager.Preferences.Core -| Name | Description | +| Type | Description | | ------- | -------------------- | | number | The value is a number. | | string | The value is a string. | diff --git a/en/application-dev/reference/apis/js-apis-environment.md b/en/application-dev/reference/apis/js-apis-environment.md index 942e514367c923db4d7aa270218e39ae82f65aa0..d023cdc8403d028ff250d3ea7afa82858d6ad5b8 100644 --- a/en/application-dev/reference/apis/js-apis-environment.md +++ b/en/application-dev/reference/apis/js-apis-environment.md @@ -1,12 +1,12 @@ # Environment +This module provides JS APIs for obtaining the root directories of the storage and public files. + > **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. -This module provides JS APIs for obtaining the root directories of the storage and public files. - ## Modules to Import ```js diff --git a/en/application-dev/reference/apis/js-apis-geolocation.md b/en/application-dev/reference/apis/js-apis-geolocation.md index d08cc7aafb9e16ecd89533e4a772c18372d23da5..f15805a326e19b0a579d1da1ae0e44e9937fef6f 100644 --- a/en/application-dev/reference/apis/js-apis-geolocation.md +++ b/en/application-dev/reference/apis/js-apis-geolocation.md @@ -24,7 +24,7 @@ Registers a listener for location changes with a location request initiated. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value **locationChange** indicates a location change event.| | request | LocationRequest | Yes| Location request.| @@ -54,7 +54,7 @@ Unregisters the listener for location changes with the corresponding location re **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value **locationChange** indicates a location change event.| | callback | Callback<[Location](#location)> | No| Callback used to return the location change event.| @@ -84,7 +84,7 @@ Registers a listener for location service status change events. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value **locationServiceState** indicates a location service status change event.| | callback | Callback<boolean> | Yes| Callback used to return the location service status change event.| @@ -112,7 +112,7 @@ Unregisters the listener for location service status change events. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value **locationServiceState** indicates a location service status change event.| | callback | Callback<boolean> | No| Callback used to return the location service status change event.| @@ -141,7 +141,7 @@ Registers a listener for cached GNSS location reports. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value **cachedGnssLocationsReporting** indicates reporting of cached GNSS locations.| | request | CachedGnssLocationsRequest | Yes| Request for reporting cached GNSS location.| @@ -171,7 +171,7 @@ Unregisters the listener for cached GNSS location reports. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value **cachedGnssLocationsReporting** indicates reporting of cached GNSS locations.| | callback | Callback<boolean> | No| Callback used to return cached GNSS locations.| @@ -201,7 +201,7 @@ Registers a listener for GNSS satellite status change events. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value **gnssStatusChange** indicates a GNSS satellite status change.| | callback | Callback<SatelliteStatusInfo> | Yes| Callback used to return GNSS satellite status changes.| @@ -229,7 +229,7 @@ Unregisters the listener for GNSS satellite status change events. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value **gnssStatusChange** indicates a GNSS satellite status change.| | callback | Callback<SatelliteStatusInfo> | No| Callback used to return GNSS satellite status changes.| @@ -257,7 +257,7 @@ Registers a listener for GNSS NMEA message change events. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value **nmeaMessageChange** indicates a GNSS NMEA message change.| | callback | Callback<string> | Yes| Callback used to return GNSS NMEA message changes.| @@ -285,7 +285,7 @@ Unregisters the listener for GNSS NMEA message change events. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value **nmeaMessageChange** indicates a GNSS NMEA message change.| | callback | Callback<string> | No| Callback used to return GNSS NMEA message changes.| @@ -314,7 +314,7 @@ Registers a listener for status change events of the specified geofence. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value **fenceStatusChange** indicates a geofence status change.| | request | GeofenceRequest | Yes| Geofencing request.| @@ -359,7 +359,7 @@ Unregisters the listener for status change events of the specified geofence. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value **fenceStatusChange** indicates a geofence status change.| | request | GeofenceRequest | Yes| Geofencing request.| @@ -402,7 +402,7 @@ Subscribe to country code information reporting events. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value is "countrycodechange", which means subscribing to the submission of country code information. | | callback | Callback<CountryCode> | Yes | Callback is used to receive the country code information report. | @@ -428,7 +428,7 @@ Unsubscribe from the country code to report events. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value is "countrycodechange", which means unsubscribing to the submission of country code information. | | callback | Callback<CountryCode> | Yes | Callback is used to receive the country code information report. | @@ -458,7 +458,7 @@ Obtains the current location. This API uses an asynchronous callback to return t **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | request | [CurrentLocationRequest](#currentlocationrequest) | No| Location request.| | callback | AsyncCallback<[Location](#location)> | Yes| Callback used to return the current location.| @@ -493,13 +493,13 @@ Obtains the current location. This API uses a promise to return the result. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | request | [CurrentLocationRequest](#currentlocationrequest) | No| Location request.| **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<[Location](#location)> | Promise used to return the current location.| @@ -526,7 +526,7 @@ Obtains the previous location. This API uses an asynchronous callback to return **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | callback | AsyncCallback<[Location](#location)> | Yes| Callback used to return the previous location.| @@ -557,7 +557,7 @@ Obtains the previous location. This API uses a promise to return the result. **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<[Location](#location)> | Promise used to return the previous location.| @@ -584,7 +584,7 @@ Checks whether the location service is enabled. This API uses an asynchronous ca **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.| @@ -614,7 +614,7 @@ Checks whether the location service is enabled. This API uses a promise to retur **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<boolean> | Promise used to return the location service status.| @@ -640,7 +640,7 @@ Requests to enable the location service. This API uses an asynchronous callback **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.| @@ -670,7 +670,7 @@ Requests to enable the location service. This API uses a promise to return the r **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<boolean> | Promise used to return the location service status.| @@ -697,7 +697,7 @@ Enables the location service. This API uses an asynchronous callback to return t **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.| @@ -729,7 +729,7 @@ Enables the location service. This API uses a promise to return the result. **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<boolean> | Promise used to return the location service status.| @@ -755,7 +755,7 @@ Disables the location service. This API uses an asynchronous callback to return **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | callback | AsyncCallback<boolean> | Yes| Callback used to return the location service status.| @@ -787,7 +787,7 @@ Disables the location service. This API uses a promise to return the result. **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<boolean> | Promise used to return the location service status.| @@ -811,7 +811,7 @@ Checks whether the (reverse) geocoding service is available. This API uses an as **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | callback | AsyncCallback<boolean> | Yes| Callback used to return the (reverse) geocoding service status.| @@ -841,7 +841,7 @@ Checks whether the (reverse) geocoding service is available. This API uses a pro **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<boolean> | Promise used to return the (reverse) geocoding service status.| @@ -866,7 +866,7 @@ Converts coordinates into geographic description through reverse geocoding. This **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | request | [ReverseGeoCodeRequest](#reversegeocoderequest) | Yes| Reverse geocoding request.| | callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | Yes| Callback used to return the reverse geocoding result.| @@ -898,13 +898,13 @@ Converts coordinates into geographic description through reverse geocoding. This **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | request | [ReverseGeoCodeRequest](#reversegeocoderequest) | Yes| Reverse geocoding request.| **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<Array<[GeoAddress](#geoaddress)>> | Promise used to return the reverse geocoding result.| @@ -930,7 +930,7 @@ Converts geographic description into coordinates through geocoding. This API use **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | request | [GeoCodeRequest](#geocoderequest) | Yes| Geocoding request.| | callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | Yes| Callback used to return the geocoding result.| @@ -962,13 +962,13 @@ Converts geographic description into coordinates through geocoding. This API use **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | request | [GeoCodeRequest](#geocoderequest) | Yes| Geocoding request.| **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<Array<[GeoAddress](#geoaddress)>> | Callback used to return the geocoding result.| @@ -994,7 +994,7 @@ Obtains the number of cached GNSS locations. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | callback | AsyncCallback<number> | Yes| Callback used to return the number of cached GNSS locations. | @@ -1024,7 +1024,7 @@ Obtains the number of cached GNSS locations. **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<number> | Promise used to return the number of cached GNSS locations.| @@ -1049,7 +1049,7 @@ Obtains all cached GNSS locations and clears the GNSS cache queue. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | callback | AsyncCallback<boolean> | Yes| Callback used to return the operation result.| @@ -1079,7 +1079,7 @@ Obtains all cached GNSS locations and clears the GNSS cache queue. **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<boolean> | Promise used to return the operation result.| @@ -1104,7 +1104,7 @@ Sends an extended command to the location subsystem. This API can only be called **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | command | LocationCommand | Yes| Extended command (string) to be sent.| | callback | AsyncCallback<boolean> | Yes| Callback used to return the operation result.| @@ -1136,13 +1136,13 @@ Sends an extended command to the location subsystem. This API can only be called **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | command | LocationCommand | Yes| Extended command (string) to be sent.| **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<boolean> | Callback used to return the operation result.| @@ -1170,7 +1170,7 @@ Checks whether a user agrees with the privacy statement of the location service. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.| | callback | AsyncCallback<boolean> | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.| @@ -1203,13 +1203,13 @@ Checks whether a user agrees with the privacy statement of the location service. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.| **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<boolean> | Callback used to return the result, which indicates whether the user agrees with the privacy statement.| @@ -1236,7 +1236,7 @@ Sets the user confirmation status for the privacy statement of the location serv **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.| | isConfirmed | boolean | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.| @@ -1270,14 +1270,14 @@ Sets the user confirmation status for the privacy statement of the location serv **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | LocationPrivacyType | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when enabling the location service.| | isConfirmed | boolean | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.| **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<boolean> | Callback used to return the operation result.| @@ -1300,7 +1300,7 @@ Query the current country code. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | callback | AsyncCallback<CountryCode> | Yes | Callback is used to receive the country code. | @@ -1332,7 +1332,7 @@ None **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<CountryCode> | return country code. | @@ -1361,7 +1361,7 @@ Enable the position simulation function of a scene, and only one scene can be en **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | scenario | LocationRequestScenario | No | Indicates under what scenario the position simulation function is enabled. | | callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | @@ -1392,14 +1392,14 @@ Enable the position simulation function of a scene, and only one scene can be en **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | scenario | LocationRequestScenario | No | Indicates which scene's position simulation function is enabled. If this parameter is not carried, it means that the position simulation function of all scenes is enabled. | **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | @@ -1433,7 +1433,7 @@ To disable the position simulation function. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | scenario | LocationRequestScenario | No | Indicates to disable the position simulation function of a scene. If this parameter is not carried, it means to disable the position simulation function of all scenes. | | callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | @@ -1465,13 +1465,13 @@ To disable the position simulation function. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | scenario | LocationRequestScenario | No | Indicates to disable the position simulation function of a scene. If this parameter is not carried, it means to disable the position simulation function of all scenes. | **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr, otherwise it will return an error message | @@ -1505,7 +1505,7 @@ Set the simulated location information, and then report the simulated location a **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | config | LocationMockConfig | Yes | Indicates the configuration parameters of location simulation, including the time interval of simulation location reporting and the array of simulation locations. | | callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | @@ -1543,13 +1543,13 @@ Set the simulated location information, and then report the simulated location a **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | config | LocationMockConfig | Yes | Indicates the configuration parameters of location simulation, including the time interval of simulation location reporting and the array of simulation locations. | **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | @@ -1591,7 +1591,7 @@ Enable reverse geocoding simulation function. **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | @@ -1625,7 +1625,7 @@ None **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | @@ -1658,7 +1658,7 @@ Disable reverse geocoding simulation function. **Parameters**: - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message | @@ -1692,7 +1692,7 @@ None **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | @@ -1725,7 +1725,7 @@ Set the configuration information of the reverse geocoding simulation function, **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | mockInfos | Array<ReverseGeocodingMockInfo> | Yes | An array of configuration parameters indicating the inverse geocoding simulation function. The configuration parameters of the inverse geocoding simulation function include a location and a place name. | | callback | AsyncCallback<void> | Yes | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | @@ -1734,11 +1734,11 @@ Set the configuration information of the reverse geocoding simulation function, ```js var mockInfos = [ - {"location": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}}, ]; geolocation.setReverseGeocodingMockInfo(mockInfos, (err, data) => { if (err) { @@ -1763,13 +1763,13 @@ Set the configuration information of the reverse geocoding simulation function, **Parameters** - | Name| Type| Mandatory| Description| + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | mockInfos | Array<ReverseGeocodingMockInfo> | Yes | An array of configuration parameters indicating the inverse geocoding simulation function. The configuration parameters of the inverse geocoding simulation function include a location and a place name. | **Return value** - | Name| Description| + | Name| Description| | -------- | -------- | | Promise<void> | It is used to receive the execution result. If the execution is successful, it will return nullptr. Otherwise, it will return an error message. | @@ -1777,11 +1777,11 @@ Set the configuration information of the reverse geocoding simulation function, ```js var mockInfos = [ - {"location": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}}, ]; geolocation.setReverseGeocodingMockInfo(mockInfos) .then((result) => { diff --git a/en/application-dev/reference/apis/js-apis-screen-lock.md b/en/application-dev/reference/apis/js-apis-screen-lock.md index d75b957512e60e55aacfac1fdce2fdf063eb9c56..832d9754db5e41a11d38b020e77673ee5fe4d346 100644 --- a/en/application-dev/reference/apis/js-apis-screen-lock.md +++ b/en/application-dev/reference/apis/js-apis-screen-lock.md @@ -1,8 +1,10 @@ # Screen Lock Management +The **screenlock** module is a system module in OpenHarmony. It provides APIs for screen lock applications to subscribe to screen lock status changes as well as callbacks for them to receive the results. It also provides APIs for third-party applications to unlock the screen, obtain the screen locked status, and check whether a lock screen password has been set. + > **NOTE** > -> The initial APIs of this module are supported since API version … Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import @@ -73,6 +75,7 @@ Checks whether a device is in secure mode. This API uses an asynchronous callbac **System capability**: SystemCapability.MiscServices.ScreenLock + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | @@ -125,6 +128,7 @@ Unlocks the screen. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.MiscServices.ScreenLock + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | @@ -174,10 +178,12 @@ Subscribes to screen lock status changes. **System capability**: SystemCapability.MiscServices.ScreenLock +**System API**: This is a system API and cannot be called by third-party applications. + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| type | string | Yes| Event type.
- **'beginWakeUp'**: Wakeup starts.
- **'endWakeUp'**: Wakeup ends.
- **'beginScreenOn'**: Screen turn-on starts.
- **'endScreenOn'**: Screen turn-on ends.
- **'beginScreenOff'**: Screen turn-off starts.
- **'endScreenOff'**: Screen turn-off ends.
- **'unlockScreen'**: The screen is unlocked.
- **'beginExitAnimation'**: Animation starts to exit. | +| type | string | Yes| Event type.
- **"beginWakeUp"**: Wakeup starts.
- **"endWakeUp"**: Wakeup ends.
- **"beginScreenOn"**: Screen turn-on starts.
- **"endScreenOn"**: Screen turn-on ends.
- **"beginScreenOff"**: Screen turn-off starts.
- **"endScreenOff"**: Screen turn-off ends.
- **"unlockScreen"**: The screen is unlocked.
- **"beginExitAnimation"**: Animation starts to exit.| | callback | Callback\ | Yes| Callback used to return the result.| **Example** @@ -196,10 +202,12 @@ Subscribes to screen lock status changes. **System capability**: SystemCapability.MiscServices.ScreenLock +**System API**: This is a system API and cannot be called by third-party applications. + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| type | string | Yes| Event type.
- **'beginSleep'**: The screen enters sleep mode.
- **'endSleep'**: The screen exits sleep mode.
- **'changeUser'**: The user is switched.| +| type | string | Yes| Event type.
- **"beginSleep"**: The screen enters sleep mode.
- **"endSleep"**: The screen exits sleep mode.
- **"changeUser"**: The user is switched.| | callback | Callback\ | Yes| Callback used to return the result. | **Example** @@ -217,11 +225,13 @@ Subscribes to screen lock status changes. **System capability**: SystemCapability.MiscServices.ScreenLock +**System API**: This is a system API and cannot be called by third-party applications. + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| type | string | Yes| Event type.
- **'screenlockEnabled'**: Screen lock is enabled.| -| callback | Callback\ | Yes| Callback used to return the result. | +| type | string | Yes| Event type.
- **"screenlockEnabled"**: Screen lock is enabled.| +| callback | Callback\ | Yes| Callback used to return the result.| **Example** @@ -240,10 +250,12 @@ Unsubscribes from screen lock status changes. **System capability**: SystemCapability.MiscServices.ScreenLock +**System API**: This is a system API and cannot be called by third-party applications. + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| type | string | Yes| Event type.
- **'beginWakeUp'**: Wakeup starts.
- **'endWakeUp'**: Wakeup ends.
- **'beginScreenOn'**: Screen turn-on starts.
- **'endScreenOn'**: Screen turn-on ends.
- **'beginScreenOff'**: Screen turn-off starts.
- **'endScreenOff'**: Screen turn-off ends.
- **'unlockScreen'**: The screen is unlocked.
- **'beginExitAnimation'**: Animation starts to exit.
- **'screenlockEnabled'**: Screen lock is enabled.
- **'beginSleep'**: The screen enters sleep mode.
- **'endSleep'**: The screen exits sleep mode.
- **'changeUser'**: The user is switched.| +| type | string | Yes| Event type.
- **"beginWakeUp"**: Wakeup starts.
- **"endWakeUp"**: Wakeup ends.
- **"beginScreenOn"**: Screen turn-on starts.
- **"endScreenOn"**: Screen turn-on ends.
- **"beginScreenOff"**: Screen turn-off starts.
- **"endScreenOff"**: Screen turn-off ends.
- **"unlockScreen"**: The screen is unlocked.
- **"beginExitAnimation"**: Animation starts to exit.
- **"screenlockEnabled"**: Screen lock is enabled.
- **"beginSleep"**: The screen enters sleep mode.
- **"endSleep"**: The screen exits sleep mode.
- **"changeUser"**: The user is switched.| | callback | Callback\ | Yes| Callback used to return the result.| **Example** @@ -262,11 +274,13 @@ Sends an event to the screen lock service. This API uses an asynchronous callbac **System capability**: SystemCapability.MiscServices.ScreenLock +**System API**: This is a system API and cannot be called by third-party applications. + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| event | String | Yes| Event type.
- **'unlockScreenResult'**: Screen unlock result.
- **'screenDrawDone'**: Screen drawing is complete.| -| parameter | number | Yes| Screen unlock status.
- **0**: The unlock is successful.
- **0**: The unlock failed.
- **2**: The unlock was canceled.| +| event | String | Yes| Event type.
- **"unlockScreenResult"**: Screen unlock result.
- **"screenDrawDone"**: Screen drawing is complete.| +| parameter | number | Yes| Screen unlock status.
- **0**: The unlock is successful.
- **1**: The unlock failed.
- **2**: The unlock was canceled.| | callback | AsyncCallback\ | Yes| Callback used to return the result.| **Example** @@ -279,18 +293,19 @@ Sends an event to the screen lock service. This API uses an asynchronous callbac ## screenlock.sendScreenLockEvent9+ -sendScreenLockEvent(event: String, parameter: number): Promise +sendScreenLockEvent(event: String, parameter: number): Promise\ Sends an event to the screen lock service. This API uses a promise to return the result. **System capability**: SystemCapability.MiscServices.ScreenLock -**Parameters** +**System API**: This is a system API and cannot be called by third-party applications. +**Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| event | String | Yes| Event type.
- **'unlockScreenResult'**: Screen unlock result.
- **'screenDrawDone'**: Screen drawing is complete.| -| parameter | number | Yes| Screen unlock status.
- **0**: The unlock is successful.
- **0**: The unlock failed.
- **2**: The unlock was canceled.| +| event | String | Yes| Event type.
- **"unlockScreenResult"**: Screen unlock result.
- **"screenDrawDone"**: Screen drawing is complete.| +| parameter | number | Yes| Screen unlock status.
- **0**: The unlock is successful.
- **1**: The unlock failed.
- **2**: The unlock was canceled.| **Return value** | Type| Description| @@ -300,7 +315,7 @@ Sends an event to the screen lock service. This API uses a promise to return the **Example** ```js - screenlock.sendScreenLockEvent('unlockScreenResult', 0).then((err, result) => { + screenlock.sendScreenLockEvent('unlockScreenResult', 0).then((result) => { console.log('sending result:' + result); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-uiappearance.md b/en/application-dev/reference/apis/js-apis-uiappearance.md index 981e16381df774aa0bfdc7d869f3c7081887883b..3bac964627675b3475e273551d06b146636b410d 100644 --- a/en/application-dev/reference/apis/js-apis-uiappearance.md +++ b/en/application-dev/reference/apis/js-apis-uiappearance.md @@ -5,6 +5,7 @@ The **uiAppearance** module provides basic capabilities for managing the system > **NOTE** > > The APIs of this module are supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version. +> > The APIs provided by this module are system APIs. @@ -20,6 +21,8 @@ import uiAppearance from '@ohos.uiAppearance' Enumerates the color modes. +**System capability**: SystemCapability.ArkUI.UiAppearance + | Name| Value| Description| | -- | -- | -- | | ALWAYS_DARK | 0 | The system is always in dark mode. | @@ -32,12 +35,11 @@ setDarkMode(mode: DarkMode, callback: AsyncCallback\): void Sets the system color mode. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.UPDATE_CONFIGRATION +**Permission required**: ohos.permission.UPDATE_CONFIGURATION -**System capability**: SystemCapability.ArkUI.ArkUI.Full +**System capability**: SystemCapability.ArkUI.UiAppearance **Parameters** - | Name| Type| Mandatory| Description| | -- | -- | -- | -- | | mode | [DarkMode](#darkmode) | Yes| Color mode to set.| @@ -57,15 +59,21 @@ setDarkMode(mode: DarkMode): Promise\; Sets the system color mode. This API uses a promise to return the result. -**Required permissions**: ohos.permission.UPDATE_CONFIGRATION +**Permission required**: ohos.permission.UPDATE_CONFIGURATION -**System capability**: SystemCapability.ArkUI.ArkUI.Full +**System capability**: SystemCapability.ArkUI.UiAppearance **Parameters** | Name| Type| Mandatory| Description| | -- | -- | -- | -- | | mode | [DarkMode](#darkmode) | Yes| Color mode to set.| +**Return value** + +| Type | Description | +| ------ | ------------------------------ | +| Promise\ | Promise that returns no value.| + **Example** ```ts uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { @@ -82,12 +90,11 @@ getDarkMode(): DarkMode; Obtains the system color mode. -**Required permissions**: ohos.permission.UPDATE_CONFIGRATION +**Permission required**: ohos.permission.UPDATE_CONFIGURATION -**System capability**: SystemCapability.ArkUI.ArkUI.Full +**System capability**: SystemCapability.ArkUI.UiAppearance **Return value** - | Type| Description| | -- | -- | |[DarkMode](#darkmode) | Color mode obtained.| diff --git a/en/application-dev/reference/apis/js-apis-wallpaper.md b/en/application-dev/reference/apis/js-apis-wallpaper.md index 75dda908af3e32140bf7c94b92ff73117be0ad7e..15fd2c4fcdeb681b4ace2dc49d521f54e08014f5 100644 --- a/en/application-dev/reference/apis/js-apis-wallpaper.md +++ b/en/application-dev/reference/apis/js-apis-wallpaper.md @@ -1,7 +1,9 @@ # Wallpaper -> **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. +> **NOTE** +> +> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import @@ -465,7 +467,7 @@ Sets a specified source as the wallpaper of a specified type. This API uses an a }).catch((error) => { console.error(`failed to createPixelMap because: ` + JSON.stringify(error)); }); - ``` +``` ## wallpaper.setWallpaper @@ -520,7 +522,7 @@ Sets a specified source as the wallpaper of a specified type. This API uses a pr }).catch((error) => { console.error(`failed to createPixelMap because: ` + JSON.stringify(error)); }); - ``` +``` ## wallpaper.getFile8+ @@ -528,7 +530,7 @@ getFile(wallpaperType: WallpaperType, callback: AsyncCallback<number>): vo Obtains the wallpaper of the specified type. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.SET_WALLPAPER and ohos.permission.READ_USER_STORAGE +**Required permissions**: ohos.permission.GET_WALLPAPER and ohos.permission.READ_USER_STORAGE **System capability**: SystemCapability.MiscServices.Wallpaper @@ -557,7 +559,7 @@ getFile(wallpaperType: WallpaperType): Promise<number> Obtains the wallpaper of the specified type. This API uses a promise to return the result. -**Required permissions**: ohos.permission.SET_WALLPAPER and ohos.permission.READ_USER_STORAGE +**Required permissions**: ohos.permission.GET_WALLPAPER and ohos.permission.READ_USER_STORAGE **System capability**: SystemCapability.MiscServices.Wallpaper @@ -636,7 +638,7 @@ Obtains the pixel image for the wallpaper of the specified type. This API uses a **Example** ```js - wallpaper.getPixelMap(WALLPAPER_SYSTEM).then((data) => { + wallpaper.getPixelMap(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => { console.info('wallpaperXTS ===> testGetPixelMapPromiseSystem data : ' + data); console.info('wallpaperXTS ===> testGetPixelMapPromiseSystem data : ' + JSON.stringify(data)); }).catch((err) => { @@ -695,9 +697,9 @@ Unsubscribes from the wallpaper color change event. wallpaper.on('colorChange', listener); // Unsubscribe from the listener. wallpaper.off('colorChange', listener); -//Unsubscribe from all subscriptions of the colorChange type. +// Unsubscribe from all subscriptions of the colorChange type. wallpaper.off('colorChange'); -``` + ``` ## RgbaColor diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md b/en/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md index 435ab557cbe82515bf73b9a5a613c08f14dafae3..3aea124c118a3387fda7f601ee740b95dd2097a5 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md @@ -1,4 +1,4 @@ -# ImageAnimator +ImageAnimator The **\** component enables images to be played frame by frame. The list of images to be played can be configured, and the duration of each image can be configured. @@ -23,47 +23,47 @@ ImageAnimator() ## Attributes -| Name | Type | Default Value | Mandatory | Description | -| -------- | -------- | -------- | -------- | -------- | -| images | Array<{
src:string,
width?:Length,
height?:Length,
top?:Length,
left?:Length,
duration?:number
}> | [] | Yes | Image frame information. The information of each frame includes the image path, image size, image position, and image playback duration. The detailed description is as follows:
**src**: image path. The image format can be SVG, PNG, or JPG.
**width**: image width.
**height**: image height.
**top**: vertical coordinate of the image relative to the upper left corner of the component.
**left**: horizontal coordinate of the image relative to the upper left corner of the component.
**duration**: playback duration of the image, in ms. | -| state | AnimationStatus | AnimationStatus.Initial | No | Playback status of the animation. The default status is **Initial**. | -| duration | number | 1000 | No | Playback duration, in ms. The default duration is 1000 ms. When the duration is **0**, no image is played. The value change takes effect only at the beginning of the next cycle. When a separate duration is set in images, the setting of this attribute is invalid. | -| reverse | boolean | false | No | Playback sequence. The value **false** indicates that images are played from the first one to the last one, and **true** indicates that images are played from the last one to the first one. | -| fixedSize | boolean | true | No | Whether the image size is the same as the component size. **true**: The image size is the same as the component size. In this case, the width, height, top, and left attributes of the image are invalid. **false**: The width, height, top, and left attributes of each image must be set separately. | -| preDecode | number | 0 | No | Whether to enable pre-decoding. The default value **0** indicates that pre-decoding is disabled. If this attribute is set to **2**, two images following the currently playing frame will be cached in advance to improve performance. | -| fillMode | FillMode | FillMode.Forwards | No | Status before and after the animation starts. For details about the options, see **FillMode**. | -| iterations | number | 1 | No | By default, the animation is played once. The value **-1** indicates that the animation is played for an unlimited number of times. | +| Name | Type | Default Value | Mandatory | Description | +| ---------- | ---------------------------------------- | ----------------------- | --------- | ---------------------------------------- | +| images | Array<{
src:string,
width?:Length,
height?:Length,
top?:Length,
left?:Length,
duration?:number
}> | [] | Yes | Image frame information. The information of each frame includes the image path, image size, image position, and image playback duration. The detailed description is as follows:
**src**: image path. The image format can be SVG, PNG, or JPG.
**width**: image width.
**height**: image height.
**top**: vertical coordinate of the image relative to the upper left corner of the component.
**left**: horizontal coordinate of the image relative to the upper left corner of the component.
**duration**: playback duration of the image, in ms. | +| state | AnimationStatus | AnimationStatus.Initial | No | Playback status of the animation. The default status is **Initial**. | +| duration | number | 1000 | No | Playback duration, in ms. The default duration is 1000 ms. When the duration is **0**, no image is played. The value change takes effect only at the beginning of the next cycle. When a separate duration is set in images, the setting of this attribute is invalid. | +| reverse | boolean | false | No | Playback sequence. The value **false** indicates that images are played from the first one to the last one, and **true** indicates that images are played from the last one to the first one. | +| fixedSize | boolean | true | No | Whether the image size is the same as the component size. **true**: The image size is the same as the component size. In this case, the width, height, top, and left attributes of the image are invalid. **false**: The width, height, top, and left attributes of each image must be set separately. | +| preDecode | number | 0 | No | Whether to enable pre-decoding. The default value **0** indicates that pre-decoding is disabled. If this attribute is set to **2**, two images following the currently playing frame will be cached in advance to improve performance. | +| fillMode | FillMode | FillMode.Forwards | No | Status before and after the animation starts. For details about the options, see **FillMode**. | +| iterations | number | 1 | No | By default, the animation is played once. The value **-1** indicates that the animation is played for an unlimited number of times. | - ImageFrameInfo - | Name| Type| Default Value| Mandatory| Description| - | -------- | -------- | -------- | -------- | -------- | - | src | string \| [Resource](.../ui/ts-types.md#resource-type)9+| "" | Yes| Image path. The image format can be .svg, .png, or .jpg.| - | width | [Length](.../ui/ts-types.md#length-type)| 0 | No| Image width.| - | height | [Length](.../ui/ts-types.md#length-type)| 0 | No| Image height.| - | top | [Length](.../ui/ts-types.md#length-type)| 0 | No| Vertical coordinate of the image relative to the upper left corner of the component.| - | left | [Length](.../ui/ts-types.md#length-type)| 0 | No| Horizontal coordinate of the image relative to the upper left corner of the component.| - | duration | number | 0 | No| Playback duration of each image frame, in milliseconds.| + | Name | Type | Default Value | Mandatory | Description | + | -------- | ---------------------------------------- | ------------- | --------- | ---------------------------------------- | + | src | string \| [Resource](../../ui/ts-types.md)9+ | "" | Yes | Image path. The image format can be .svg, .png, or .jpg. | + | width | [Length](../../ui/ts-types.md) | 0 | No | Image width. | + | height | [Length](../../ui/ts-types.md) | 0 | No | Image height. | + | top | [Length](../../ui/ts-types.md) | 0 | No | Vertical coordinate of the image relative to the upper left corner of the component. | + | left | [Length](../../ui/ts-types.md) | 0 | No | Horizontal coordinate of the image relative to the upper left corner of the component. | + | duration | number | 0 | No | Playback duration of each image frame, in milliseconds. | - AnimationStatus enums - | Name | Description | - | -------- | -------- | + | Name | Description | + | ------- | -------------------------------------- | | Initial | The animation is in the initial state. | - | Running | The animation is being played. | - | Paused | The animation is paused. | - | Stopped | The animation is stopped. | + | Running | The animation is being played. | + | Paused | The animation is paused. | + | Stopped | The animation is stopped. | - FillMode enums - | Name | Description | - | -------- | -------- | - | None | After the playback is complete, the animation restores to the initial state. | + | Name | Description | + | -------- | ---------------------------------------- | + | None | After the playback is complete, the animation restores to the initial state. | | Forwards | After the playback is complete, the animation remains in the end state. | ## Events -| Name | Description | -| -------- | -------- | -| onStart() => void | Triggered when the animation starts to play. | -| onPause() => void | Triggered when the animation playback is paused. | +| Name | Description | +| --------------------- | ---------------------------------------- | +| onStart() => void | Triggered when the animation starts to play. | +| onPause() => void | Triggered when the animation playback is paused. | | onRepeat() => void | Triggered when the animation playback is repeated. | | onCancel() => void | Triggered when the animation playback is canceled. | | onFinish() => void | Triggered when the animation playback is complete. | diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-text.md b/en/application-dev/reference/arkui-ts/ts-basic-components-text.md index 2758e99f0cdba7ed1a7722cd10a4ed6c68438466..a98e84fffd5816a22445daa66833cb47d0dbae88 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-text.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-text.md @@ -1,15 +1,15 @@ # Text -> **NOTE**
-> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. - - The **\** component is used to display a piece of textual information. +> **NOTE** +> +> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. + ## Required Permissions -N/A +None ## Child Components @@ -32,8 +32,8 @@ Text(content?: string) | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | | textAlign | TextAlign | TextAlign.Start | Text alignment mode of multiple lines of text.| -| textOverflow | {overflow: TextOverflow} | {overflow: TextOverflow.Clip} | Display mode when the text is too long.
**NOTE**
Text is truncated at the transition between words. To truncate text in the middle of a word, add **\u200B** between characters. | -| maxLines | number | Infinity | Maximum number of lines in the text.| +| textOverflow | {overflow: TextOverflow} | {overflow: TextOverflow.Clip} | Display mode when the text is too long.
**NOTE**

Text is truncated at the transition between words. To truncate text in the middle of a word, add **\u200B** between characters.
This attribute must be used with `maxLines` to take effect.| +| maxLines | number | Infinity | Maximum number of lines in the text.
**NOTE**

By default, text is automatically folded. If this parameter is specified, the text does not exceed the specified number of lines. If there is extra text, you can use `textOverflow` to specify the truncation mode.| | lineHeight | Length | - | Text line height. If the value is less than or equal to **0**, the line height is not limited and the font size is adaptive. If the value of the number type, the unit fp is used.| | decoration | {
type: TextDecorationType,
color?: Color
} | {
type: TextDecorationType.None,
color: Color.Black
} | Style and color of the text decorative line.| | baselineOffset | Length | - | Offset of the text baseline.| @@ -78,7 +78,7 @@ Text(content?: string) | LocalDevice | Intra-device copy and paste is allowed.| | CrossDevice | Cross-device copy and paste is allowed.| -> **NOTE**
+> **NOTE**
> If the **\** component contains both the text and the **\** child component, only the content in **\** is displayed. diff --git a/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md b/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md index 082bfb57ec7ecd2d964c3e9cab1a75715d02c58a..d625528c2c4f1cd857ae04585201d5507bb70ff8 100644 --- a/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md +++ b/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md @@ -20,14 +20,14 @@ CanvasRenderingContext2D(setting: RenderingContextSetting) ### RenderingContextSettings -RenderingContextSettings(antialias?: bool) +RenderingContextSettings(antialias?: boolean) Configures the settings of a **CanvasRenderingContext2D** object, including whether to enable antialiasing. - Parameters | Name | Type | Mandatory | Default Value | Description | | --------- | ---- | --------- | ------------- | -------------------------------- | - | antialias | bool | No | false | Whether antialiasing is enabled. | + | antialias | boolean | No | false | Whether antialiasing is enabled. | ## Attributes diff --git a/en/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md b/en/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md index cc6e43dbc45b9c35dcda68aee838d64de2c60802..c520530cb00102c4d30eaf36d1f25b27c5bb968b 100644 --- a/en/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md +++ b/en/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md @@ -1,17 +1,17 @@ # ImageBitmap -> **NOTE**
+> **NOTE** +> > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. -**CanvasImageData** stores pixel data rendered on a canvas. +An **ImageBitmap** object stores pixel data rendered on a canvas. ## Attributes -| Name | Type | Description | +| Name | Type | Description | | -------- | -------- | -------- | | width | number | Actual width of the rectangle on the canvas, in pixels. | | height | number | Actual height of the rectangle on the canvas, in pixels. | -| data | <Uint8ClampedArray> | A one-dimensional array of color values. The values range from 0 to 255. | diff --git a/en/application-dev/reference/arkui-ts/ts-container-refresh.md b/en/application-dev/reference/arkui-ts/ts-container-refresh.md index 2392680bc520832629d8763fb9eee5e28b946bf7..92aa736e68b028b7c188e12005badf7e967ab8ba 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-refresh.md +++ b/en/application-dev/reference/arkui-ts/ts-container-refresh.md @@ -1,9 +1,10 @@ # Refresh -> **NOTE**
-> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. + The **\** component is a container that provides the pull-to-refresh feature. -The **** component is used to refresh a page through a pull-down gesture. +> **NOTE** +> +> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. ## Required Permissions @@ -19,11 +20,11 @@ Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number | stri - Parameters - | Name | Value Type | Mandatory | Default Value | Description | + | Name| Value Type| Mandatory| Default Value| Description| | -------- | -------- | -------- | -------- | -------- | - | refreshing | boolean | Yes| - | Whether the current component is being refreshed. | - | offset | Length | No| 16 | Distance to the top of the parent component from the **** component that comes to rest after a successful pull-down gesture. | - | friction | number | No| 62 | Coefficient of friction, which indicates the **** component's sensitivity to the pull-down gesture. The value ranges from 0 to 100.
- **0**: The **** component is not sensitive to the pull-down gesture.
- **100**: The **** component is highly sensitive to the pull-down gesture.
- Value greater than **100**: The **** component is much more sensitive to the pull-down gesture. | + | refreshing | boolean | Yes| - | Whether the current component is being refreshed.| + | offset | Length | No| 16 | Distance to the top of the parent component from the **** component that comes to rest after a successful pull-down gesture.| + | friction | number \| string | No| 62 | Coefficient of friction, which indicates the **** component's sensitivity to the pull-down gesture. The value ranges from 0 to 100.
- **0** indicates that the **\** component is not sensitive to the pull-down gesture.
- **100** indicates that the **\** component is highly sensitive to the pull-down gesture.
- A larger value indicates a more sensitive response of the **\** component to the pull-down gesture.| @@ -32,23 +33,24 @@ Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number | stri | Name| Description| | -------- | -------- | -| onStateChange(callback: (state: RefreshStatus) => void)| Triggered when the refresh status changes.
**state** indicates the refresh status. | -| onRefreshing(callback: () => void)| Triggered when the component enters the refresh state. | +| onStateChange(callback: (state: RefreshStatus) => void)| Triggered when the refresh status changes.
**state**: refresh status.| +| onRefreshing(callback: () => void)| Triggered when the component enters the refresh state.| - RefreshStatus enums - | Name | Description | + | Name| Description| | -------- | -------- | - | Inactive | The component is not pulled down. This is the default value. | - | Drag | The component is being pulled down, but the pulled distance is shorter than the minimum length required to trigger the refresh. | - | OverDrag | The component is being pulled down, and the pulled distance exceeds the minimum length required to trigger the refresh. | - | Refresh | The pull-down ends, and the component rebounds to the minimum length required to trigger the refresh and enters the refresh state. | - | Done | The refresh is complete, and the component returns to the initial state (top). | + | Inactive | The component is not pulled down. This is the default value.| + | Drag | The component is being pulled down, but the pulled distance is shorter than the minimum length required to trigger the refresh.| + | OverDrag | The component is being pulled down, and the pulled distance exceeds the minimum length required to trigger the refresh.| + | Refresh | The pull-down ends, and the component rebounds to the minimum length required to trigger the refresh and enters the refresh state.| + | Done | The refresh is complete, and the component returns to the initial state (top).| ## Example -``` +```ts +// xxx.ets @Entry @Component struct RefreshExample { diff --git a/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md b/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md index 67d034e063b70c2447d488356a8b75094e516426..410181d6801fb0a478419b90f7c5e3659ab5715a 100644 --- a/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md +++ b/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md @@ -1,12 +1,12 @@ # Motion Path Animation +You can apply a motion path animation to a component, by setting the motion path of the component in a translation animation. > **NOTE** > > This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. -The attributes below can be used to set the motion path of the component in a translation animation. ## Attributes @@ -19,7 +19,8 @@ The attributes below can be used to set the motion path of the component in a tr ## Example -``` +```ts +// xxx.ets @Entry @Component struct MotionPathExample { diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md index 4e27ab2eb1aaf983c0128787925377339d67ad3e..d049ce9afe2f55887fd50d445ae950f14850f200 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md @@ -1,8 +1,10 @@ # Component ID +**id** identifies a component uniquely within an application. This module provides APIs for obtaining the attributes of or sending events to the component with the specified ID. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. +> **NOTE** +> +> The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. ## Required Permissions @@ -12,93 +14,250 @@ None ## Attributes - | Name | Type | Default Value | Description | +| Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| id | string | '' | Unique ID of the component. The uniqueness is ensured by the user. | +| id | string | '' | Unique ID you assigned to the component.| ## APIs -### getInspectorByKey +### getInspectorByKey9+ getInspectorByKey(id: string): string Obtains all attributes of the component with the specified ID, excluding the information about child components. - Parameters - | Name | Type | Mandatory | Default Value | Description | + | Name| Type| Mandatory| Default Value| Description| | -------- | -------- | -------- | -------- | -------- | - | id | string | Yes | - | ID of the component whose attributes are to be obtained. | + | id | string | Yes| - | ID of the component whose attributes are to be obtained.| - Return value - | Type | Description | + | Type| Description| | -------- | -------- | - | string | JSON string of the component attribute list. | + | string | JSON string of the component attribute list.| +### getInspectorTree9+ -### sendEventByKey +getInspectorTree(): string + +Obtains the component tree and component attributes. + +- Return value + + | Type | Description | + | ------ | ---------------------------------- | + | string | JSON string of the component tree and component attribute list.| + +### sendEventByKey9+ sendEventByKey(id: string, action: number, params: string): boolean Sends an event to the component with the specified ID. - Parameters - | Name | Type | Mandatory | Default Value | Description | + | Name| Type| Mandatory| Default Value| Description| | -------- | -------- | -------- | -------- | -------- | - | id | string | Yes | - | ID of the component for which the event is to be sent. | - | action | number | Yes | - | Type of the event to be sent. The options are as follows:
- Click event: 10.
- LongClick: 11. | - | params | string | Yes | - | Event parameters. If there is no parameter, pass an empty string **""**. | + | id | string | Yes| - | ID of the component to which the event is to be sent.| + | action | number | Yes| - | Type of the event to be sent. The options are as follows:
- **10**: click event.
- **11**: long-click event.| + | params | string | Yes| - | Event parameters. If there is no parameter, pass an empty string **""**.| - Return value - | Type | Description | + | Type| Description| | -------- | -------- | - | boolean | Returns **false** if the component with the specified ID cannot be found; returns **true** otherwise. | + | boolean | Returns **true** if the component with the specified ID is found; returns **false** otherwise.| + +### sendTouchEvent9+ + +sendTouchEvent(event: TouchObject): boolean + +Sends a touch event. + +- Parameters + + | Name | Type | Mandatory| Default Value| Description | + | ----- | ----------- | ---- | ------ | ------------------------------------------------------------ | + | event | TouchObject | Yes | - | Location where a touch event is triggered. For details, see [TouchEvent](ts-universal-events-touch.md#touchevent).| + +- Return value + + | Type | Description | + | ------- | ------------------------------------------- | + | boolean | Returns **true** if the event is sent successfully; returns **false** otherwise.| + +### sendKeyEvent9+ + +sendKeyEvent(event: KeyEvent): boolean + +Sends a key event. + +- Parameters + + | Name | Type | Mandatory| Default Value| Description | + | ----- | -------- | ---- | ------ | ------------------------------------------------------------ | + | event | KeyEvent | Yes | - | Key event. For details, see [KeyEvent](ts-universal-events-key.md#keyevent).| + +- Return value + + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the event is sent successfully; returns **false** otherwise.| + +### sendMouseEvent9+ + +sendMouseEvent(event: MouseEvent): boolean + +Sends a mouse event. + +- Parameters + + | Name | Type | Mandatory| Default Value| Description | + | ----- | ---------- | ---- | ------ | ------------------------------------------------------------ | + | event | MouseEvent | Yes | - | Mouse event. For details, see [MouseEvent](ts-universal-mouse-key.md#mouseevent).| + +- Return value + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the event is sent successfully; returns **false** otherwise.| ## Example - -``` +```ts +// xxx.ets +class Utils { + static rect_left; + static rect_top; + static rect_right; + static rect_bottom; + static rect_value; + + static getComponentRect(key) { + let strJson = getInspectorByKey(key); + let obj = JSON.parse(strJson); + console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)); + let rectInfo = JSON.parse('[' + obj.$rect + ']') + console.info("[getInspectorByKey] rectInfo is: " + rectInfo); + this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] + this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] + this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] + this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1] + return this.rect_value = { + "left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom + } + } +} + @Entry @Component struct IdExample { + @State text: string = '' + build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button() { - Text('click') - .fontSize(25) - .fontWeight(FontWeight.Bold) - } - .type(ButtonType.Capsule) - .margin({ - top: 20 - }).onClick(() => { + Text('onKeyTab').fontSize(25).fontWeight(FontWeight.Bold) + }.margin({ top: 20 }).backgroundColor('#0D9FFB') + .onKeyEvent(() => { + this.text = "onKeyTab" + }) + + Button() { + Text('click to start').fontSize(25).fontWeight(FontWeight.Bold) + }.margin({ top: 20 }) + .onClick(() => { console.info(getInspectorByKey("click")) console.info(getInspectorTree()) + this.text = "Button 'click to start' is clicked" setTimeout(() => { - sendEventByKey("longclick", 11, "") + sendEventByKey("longClick", 11, "") }, 2000) }).id('click') Button() { - Text('longclick') - .fontSize(25) - .fontWeight(FontWeight.Bold) - } - .type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') + Text('longClick').fontSize(25).fontWeight(FontWeight.Bold) + }.margin({ top: 20 }).backgroundColor('#0D9FFB') .gesture( - LongPressGesture().onActionEnd(() => { - console.info('long clicked') - })) - .id('longclick') + LongPressGesture().onActionEnd(() => { + console.info('long clicked') + this.text = "Button 'longClick' is longclicked" + setTimeout(() => { + let rect = Utils.getComponentRect('onTouch') + let touchPoint: TouchObject = { + id: 1, + x: rect.left + (rect.right - rect.left) / 2, + y: rect.top + (rect.bottom - rect.top) / 2, + type: TouchType.Down, + screenX: rect.left + (rect.right - rect.left) / 2, + screenY: rect.left + (rect.right - rect.left) / 2, + } + sendTouchEvent(touchPoint) + touchPoint.type = TouchType.Up + sendTouchEvent(touchPoint) + }, 2000) + })).id('longClick') + + Button() { + Text('onTouch').fontSize(25).fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule).margin({ top: 20 }) + .onClick(() => { + console.info('onTouch is clicked') + this.text = "Button 'onTouch' is clicked" + setTimeout(() => { + let rect = Utils.getComponentRect('onMouse') + let mouseEvent: MouseEvent = { + button: MouseButton.Left, + action: MouseAction.Press, + x: rect.left + (rect.right - rect.left) / 2, + y: rect.top + (rect.bottom - rect.top) / 2, + screenX: rect.left + (rect.right - rect.left) / 2, + screenY: rect.top + (rect.bottom - rect.top) / 2, + timestamp: 1, + target: { + area: { + width: 1, + height: 1, + position: { + x: 1, + y: 1 + }, + globalPosition: { + x: 1, + y: 1 + } + } + }, + source: SourceType.Mouse + } + sendMouseEvent(mouseEvent) + }, 2000) + }).id('onTouch') + + Button() { + Text('onMouse').fontSize(25).fontWeight(FontWeight.Bold) + }.margin({ top: 20 }).backgroundColor('#0D9FFB') + .onMouse(() => { + console.info('onMouse') + this.text = "Button 'onMouse' in onMouse" + setTimeout(() => { + let keyEvent: KeyEvent = { + type: KeyType.Down, + keyCode: 2049, + keyText: 'tab', + keySource: 4, + deviceId: 0, + metaKey: 0, + timestamp: 0 + } + sendKeyEvent(keyEvent) + }, 2000) + }).id('onMouse') + + Text(this.text).fontSize(25).padding(15) } - .width('100%') - .height('100%') + .width('100%').height('100%') } } ``` diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md index 9d801b2503cc4225907879d5eba7596c120db3b6..5be81d94fdc351f56722eb6a106ca5c0157b658e 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md @@ -1,8 +1,10 @@ # Popup Control +The popup attribute defines the popup displayed when a component is clicked. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +> **NOTE** +> +> This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. ## Required Permissions @@ -13,48 +15,52 @@ None ## Attributes -| Name | Type | Default Value | Description | +| Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| bindPopup | show: boolean,
popup: PopupOptions \| CustomPopupOptions | - | Settings of the popup bound to a component.
**show**: whether to display the popup on the creation page by default. The default value is **false**.
**popup**: parameters of the current popup. | +| bindPopup | show: boolean,
popup: PopupOptions \| CustomPopupOptions | - | Settings of the popup bound to a component.
**show**: whether to display the popup on the creation page by default. The default value is **false**.
**popup**: parameters of the popup.| -- PopupOptions attributes - | Name | Type | Mandatory | Default Value | Description | +- PopupOptions + | Name| Type| Mandatory| Default Value| Description| | -------- | -------- | -------- | -------- | -------- | - | message | string | Yes | - | Content of the popup message. | - | placementOnTop | boolean | No | false | Whether to display the popup above the component. The default value is **false**. | - | primaryButton | {
value: string,
action: () => void
} | No | - | First button.
**value**: text of the primary button in the popup.
**action**: callback function for clicking the primary button. | - | secondaryButton | {
value: string,
action: () => void
} | No | - | Second button.
**value**: text of the secondary button in the popup.
**action**: callback function for clicking the secondary button. | - | onStateChange | (isVisible: boolean) => void | No | - | Callback for the popup status change event. The parameter **isVisible** indicates the visibility of the popup. | + | message | string | Yes| - | Content of the popup message.| + | placementOnTop | boolean | No| false | Whether to display the popup above the component. The default value is **false**.| + | primaryButton | {
value: string,
action: () => void
} | No| - | Primary button.
**value**: text of the primary button in the popup.
**action**: callback for clicking the primary button.| + | secondaryButton | {
value: string,
action: () => void
} | No| - | Secondary button.
**value**: text of the secondary button in the popup.
**action**: callback for clicking the secondary button.| + | onStateChange | (isVisible: boolean) => void | No| - | Callback for the popup status change event. The parameter **isVisible** indicates whether the popup is visible.| - CustomPopupOptions8+ - | Name | Type | Mandatory | Default Value | Description | + | Name| Type| Mandatory| Default Value| Description| | -------- | -------- | -------- | -------- | -------- | - | builder | () => any | Yes | - | Builder of the tooltip content. | - | placement | Placement | No | Placement.Bottom | Preferred position of the tooltip component. If the set position is insufficient for holding the component, it will be automatically adjusted. | - | maskColor | [Color](../../ui/ts-types.md) | No | - | Color of the tooltip mask. | - | popupColor | [Color](../../ui/ts-types.md) | No | - | Color of the tooltip. | - | enableArrow | boolean | No | true | Whether to display arrows. Arrows are displayed only for tooltips in the up and down directions. | - | autoCancel | boolean | No | true | Whether to automatically close the tooltip when an operation is performed on the page. | - | onStateChange | (isVisible: boolean) => void | No | - | Callback for the popup status change event. The parameter **isVisible** indicates the visibility of the popup. | + | builder | () => any | Yes| - | Builder of the popup content.| + | placement | Placement | No| Placement.Bottom | Preferred position of the popup. If the set position is insufficient for holding the popup, it will be automatically adjusted.| + | maskColor | [ResourceColor](../../ui/ts-types.md) | No| - | Color of the popup mask.| + | popupColor | [ResourceColor](../../ui/ts-types.md) | No| - | Color of the popup.| + | enableArrow | boolean | No| true | Whether to display an arrow.
Since API version 9, if the location set for the arrow is not large enough, the arrow will not be displayed. For example, if **placement** is set to **Left** and the popup height is less than the arrow width (32 vp), the arrow will not be displayed.| + | autoCancel | boolean | No| true | Whether to automatically close the popup when an operation is performed on the page.| + | onStateChange | (isVisible: boolean) => void | No| - | Callback for the popup status change event. The parameter **isVisible** indicates whether the popup is visible.| - Placement8+ enums - | Name | Description | + | Name| Description| | -------- | -------- | - | Left | The tooltip is on the left of the component. | - | Right | The tooltip is on the right of the component. | - | Top | The tooltip is on the top of the component. | - | Bottom | The tooltip is at the bottom of the component. | - | TopLeft | The tooltip is in the upper left corner of the component. | - | TopRight | The tooltip is in the upper right corner of the component. | - | BottomLeft | The tooltip is in the lower left corner of the component. | - | BottomRight | The tooltip is in the lower right corner of the component. | + | Left | The popup is on the left of the component, vertically aligned with the component on the left.| + | Right | The popup is on the right of the component, vertically aligned with the component on the right.| + | Top | The popup is at the top of the component, horizontally aligned with the component at the top.| + | Bottom | The popup is at the bottom of the component, horizontally aligned with the component at the bottom.| + | TopLeft | The popup is at the top of the component and, since API version 9, aligned with the left of the component.| + | TopRight | The popup is at the top of the component and, since API version 9, aligned with the right of the component.| + | BottomLeft | The popup is at the bottom of the component and, since API version 9, aligned with the left of the component.| + | BottomRight | The popup is at the bottom of the component and, since API version 9, aligned with the right of the component.| + | LeftTop9+ | The popup is on the left of the component and aligned with the top of the component.| + | LeftBottom9+ | The popup is on the left of the component and aligned with the bottom of the component.| + | RightTop9+ | The popup is on the right of the component and aligned with the top of the component.| + | RightBottom9+ | The popup is on the right of the component and aligned with the bottom of the component.| ## Example - -``` +```ts +// xxx.ets @Entry @Component struct PopupExample { @@ -65,7 +71,7 @@ struct PopupExample { @Builder popupBuilder() { Row({ space: 2 }) { Image('/resource/ic_public_thumbsup.svg').width(24).height(24).margin({ left: -5 }) - Text('Custom Popup').fontSize(12) + Text('Custom Popup').fontSize(10) }.width(100).height(50).backgroundColor(Color.White) } diff --git a/en/application-dev/ui/figures/en-us_image_tab.gif b/en/application-dev/ui/figures/en-us_image_tab.gif new file mode 100644 index 0000000000000000000000000000000000000000..fde104516f23c4dcc56b3c9f54334d7ee40925a6 Binary files /dev/null and b/en/application-dev/ui/figures/en-us_image_tab.gif differ diff --git a/en/application-dev/ui/ts-component-based-builder.md b/en/application-dev/ui/ts-component-based-builder.md index a07b244ffdc2bd9105102058e6881b14289fdf34..d626bde6074c5e3db373a00f3a78bf6e554cf46f 100644 --- a/en/application-dev/ui/ts-component-based-builder.md +++ b/en/application-dev/ui/ts-component-based-builder.md @@ -4,16 +4,17 @@ The **@Builder** decorated method is used to define the declarative UI description of a component and quickly generate multiple layouts in a custom component. The functionality and syntax of the **@Builder** decorator are the same as those of the [build Function](ts-function-build.md). -``` +```ts +// xxx.ets @Entry @Component struct CompA { - size : number = 100; + size1 : number = 100; @Builder SquareText(label: string) { Text(label) - .width(1 * this.size) - .height(1 * this.size) + .width(1 * this.size1) + .height(1 * this.size1) } @Builder RowOfSquareTexts(label1: string, label2: string) { @@ -21,8 +22,8 @@ struct CompA { this.SquareText(label1) this.SquareText(label2) } - .width(2 * this.size) - .height(1 * this.size) + .width(2 * this.size1) + .height(1 * this.size1) } build() { @@ -32,12 +33,12 @@ struct CompA { this.SquareText("B") // or as long as tsc is used } - .width(2 * this.size) - .height(1 * this.size) + .width(2 * this.size1) + .height(1 * this.size1) this.RowOfSquareTexts("C", "D") } - .width(2 * this.size) - .height(2 * this.size) + .width(2 * this.size1) + .height(2 * this.size1) } } ``` @@ -51,7 +52,8 @@ In certain circumstances, you may need to add a specific function, such as a cli ### Component Initialization Through Parameters When initializing a custom component through parameters, assign a **@Builder** decorated method to the **@BuilderParam** decorated attribute — **content**, and call the value of **content** in the custom component. If no parameter is passed when assigning a value to the **@BuilderParam** decorated attribute (for example, `content: this.specificParam`), define the type of the attribute as a function without a return value (for example, `@BuilderParam content: () => void`). If any parameter is passed when assigning a value to the **@BuilderParam** decorated attribute (for example, `callContent: this.specificParam1("111")`), define the type of the attribute as `any` (for example,`@BuilderParam callContent: any;`). -``` +```ts +// xxx.ets @Component struct CustomContainer { header: string = ""; @@ -100,7 +102,8 @@ struct CustomContainerUser { In a custom component, use the **@BuilderParam** decorated attribute to receive a trailing closure. When the custom component is initialized, the component name is followed by a pair of braces ({}) to form a trailing closure (`CustomComponent(){}`). You can consider a trailing closure as a container and add content to it. For example, you can add a component (`{Column(){Text("content")}`) to a trailing closure. The syntax of the closure is the same as that of [build](../ui/ts-function-build.md). In this scenario, the custom component has one and only one **@BuilderParam** decorated attribute. Example: Add a **\** component and a click event to the closure, and call the **specificParam** method decorated by **@Builder** in the new **\** component. After the **\** component is clicked, the value of the component's `header` attribute will change to `changeHeader`. In addition, when the component is initialized, the content of the trailing closure will be assigned to the `closer` attribute decorated by **@BuilderParam**. -``` +```ts +// xxx.ets @Component struct CustomContainer { header: string = ""; diff --git a/en/application-dev/ui/ts-custom-component-initialization.md b/en/application-dev/ui/ts-custom-component-initialization.md index 2dcb83e536762e8ca424a346c1132bcc2380fefd..9c68e81b41aeac32ff00f545a70df3f69c64fcd4 100644 --- a/en/application-dev/ui/ts-custom-component-initialization.md +++ b/en/application-dev/ui/ts-custom-component-initialization.md @@ -6,14 +6,14 @@ The member variables of a component can be initialized in either of the followin - Local initialization. For example: - ``` + ```ts @State counter: Counter = new Counter() ``` - Initialization using constructor parameters. For example: - ``` - MyComponent(counter: $myCounter) + ```ts + MyComponent({counter: $myCounter}) ``` @@ -73,43 +73,57 @@ As indicated by the preceding table: ## Example -``` +```ts +// xxx.ets +class ClassA { + public a:number + constructor(a: number) { + this.a = a + } +} @Entry @Component struct Parent { - @State parentState: ClassA = new ClassA() - build() { - Row() { - CompA({aState: new ClassA, aLink: $parentState}) // valid - CompA({aLink: $parentState}) // valid - CompA() // invalid, @Link aLink remains uninitialized - CompA({aLink: new ClassA}) // invalid, @Link aLink must be a reference ($) to either @State or @Link variable - } + @State parentState: ClassA = new ClassA(1) + + build() { + Column() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + CompA({ aState: new ClassA(2), aLink: $parentState }) + } + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + CompA({ aLink: $parentState }) + } + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + CompA({ aState: new ClassA(3), aLink: $parentState }) + } } + } } @Component struct CompA { - @State aState: boolean = false // must initialize locally - @Link aLink: ClassA // must not initialize locally - - build() { - Row() { - CompB({bLink: $aLink, // valid init a @Link with reference of another @Link, - bProp: this.aState}) // valid init a @Prop with value of a @State - CompB({aLink: $aState, // invalid: type mismatch expected ref to ClassA, provided reference to boolean - bProp: false}) // valid init a @Prop by constants value - } + @State aState: any = false + @Link aLink: ClassA + + build() { + Column() { + CompB({ bLink: $aLink, bProp: this.aState }) + CompB({ bLink: $aState, bProp: false }) } + } } @Component struct CompB { - @Link bLink: ClassA = new ClassA() // invalid, must not initialize locally - @Prop bProp: boolean = false // invalid must not initialize locally - - build() { - ... - } + @Link bLink: ClassA + @Prop bProp: boolean + + build() { + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Text(JSON.stringify(this.bLink.a)).fontSize(30) + Text(JSON.stringify(this.bProp)).fontSize(30).fontColor(Color.Red) + }.margin(10) + } } ``` diff --git a/en/application-dev/ui/ui-ts-creating-simple-page.md b/en/application-dev/ui/ui-ts-creating-simple-page.md index 4e9ee4b92152eade3066c4a79cb328cf8b998a57..6c934f4c56b2c66f59d746fc1752e4acf24131bf 100644 --- a/en/application-dev/ui/ui-ts-creating-simple-page.md +++ b/en/application-dev/ui/ui-ts-creating-simple-page.md @@ -7,7 +7,8 @@ In this section, we will develop an infographic food details page, by building c ## Building the Stack Layout 1. Create a food name. - Delete the code of the build method in the project template, create a <Stack> component, and place the **\** component in the braces of the **\** component so that the <Text> component becomes a child component of the <Stack> component. A **\** component consists of one or more child components. The latter child component overwrites the former one. + + Delete the code of the **build** method in the project template, create a **\** component, and place the **\** component in the braces of the **\** component. When the **\** component contains multiple child components, the latter child component overwrites the former one. ``` @Entry @@ -23,10 +24,11 @@ In this section, we will develop an infographic food details page, by building c } ``` - ![en-us_image_0000001222967780](figures/en-us_image_0000001222967780.png) +![en-us_image_0000001222967780](figures/en-us_image_0000001222967780.png) 2. Display food pictures. - Create an **\** component and specify a URL for it. The **\** and **\** components are mandatory. To display the **\** component above the **\** component, you need to declare the **\** component first. Image resources are stored in the **rawfile** folder in **resources**. When referencing the resources in the **rawfile** folder, use the `"$rawfile('filename')"` format, where filename indicates the relative path of the file in the **rawfile** folder. Currently, `$rawfile` only allows the **\** component to reference image resources. + + Create an **\** component and specify a URL for it. The **\** and **\** components are mandatory. To display the **\** component above the **\** component, you need to declare the **\** component first. Image resources are stored in the **rawfile** folder in **resources**. When referencing the resources in the **rawfile** folder, use the `"$rawfile('filename')"` format, where **filename** indicates the relative path of the file in the **rawfile** folder. Currently, `$rawfile` only allows the **\** component to reference image resources. ``` @Entry @@ -46,9 +48,10 @@ In this section, we will develop an infographic food details page, by building c ![en-us_image_0000001267887861](figures/en-us_image_0000001267887861.png) 3. Access images through resources. - In addition to specifying the image path, you can also use the media resource symbol $r to reference resources based on the resource qualifier rules in the resources folder. Right-click the resources folder, choose **New** > **Resource Directory**, and set **Resource Type** to **Media (image resource)**. Place Tomato.png in the media folder. - You can then can reference the application resource in the ` "$r('app.type.name')"` format, that is, `$r('app.media.Tomato')`. + In addition to specifying the image path, you can also use the media resource symbol `$r` to reference resources in the **resources** folder based on the resource qualifier rules. Right-click the **resources** folder, choose **New** > **Resource Directory**, and set **Resource Type** to **Media (image resource)**. + + Place **Tomato.png** in the **media** folder. You can then can reference the application resource in the `$r('app.type.name')` format, that is, `$r('app.media.Tomato')`. ``` @@ -68,30 +71,31 @@ In this section, we will develop an infographic food details page, by building c } ``` -4. Set the width and height of the image, and set the objectFit attribute of the image to ImageFit.Contain, which means to keep the aspect ratio of the image to ensure that the image is completely displayed within the boundary.If the image fills the entire screen, the possible causes are as follows: +4. Set the width and height of the image, and set the **objectFit** attribute of the image to **ImageFit.Contain**, which means to keep the aspect ratio of the image to ensure that the image is completely displayed within the boundary. If the image fills the entire screen, the possible causes are as follows: + 1. The width and height of the image are not set. 2. The default attribute of **objectFit** of the image is **ImageFit.Cover**, that is, the image is zoomed in or zoomed out to fill the entire display boundary with the aspect ratio locked. - - ``` - @Entry - @Component - struct MyComponent { - build() { - Stack() { - Image($r('app.media.Tomato')) - .objectFit(ImageFit.Contain) - .height(357) - Text('Tomato') - .fontSize(26) - .fontWeight(500) + + ``` + @Entry + @Component + struct MyComponent { + build() { + Stack() { + Image($r('app.media.Tomato')) + .objectFit(ImageFit.Contain) + .height(357) + Text('Tomato') + .fontSize(26) + .fontWeight(500) + } } } - } - ``` + ``` ![en-us_image_0000001223127732](figures/en-us_image_0000001223127732.png) ​ -5. Set the food image and name layout. Set the alignment mode of the stack to bottom alignment. By default, the stack is center aligned. Set **alignContent** to **Alignment.BottomStart**. Similar to **FontWeight**, **Alignment** is a built-in enumeration type provided by the framework. +5. Set the food image and name layout. Set **alignContent** to **Alignment.BottomStart**. Similar to **FontWeight**, **Alignment** is a built-in enumeration type provided by the framework. ``` @Entry @@ -112,9 +116,9 @@ In this section, we will develop an infographic food details page, by building c ![en-us_image_0000001267647873](figures/en-us_image_0000001267647873.png) -6. You can change the background color of the food image by setting the background color of the stack. You can set the background color in either of the following ways: - 1. By using the built-in enumeration value of Color provided by the framework. For example, **backgroundColor(Color.Red)** indicates that the background color is set to red. - 2. By using the parameter of the string type. The supported color formats are rgb, rgba, and HEX. For example, you can set the background color to blue by setting **backgroundColor(??\#0000FF??)** and set the background color to white by setting **backgroundColor(??rgb(255, 255, 255)??)**. +6. You can change the background color of the food image by setting the background color of the **\** component in either of the following ways: + 1. Using the built-in **Color** enums provided by the framework. For example, **backgroundColor(Color.Red)** indicates that the background color is set to red. + 2. Using the string-type parameter. The supported color formats are rgb, rgba, and HEX. For example, you can set the background color to blue by setting **backgroundColor(??\#0000FF??)** and set the background color to white by setting **backgroundColor(??rgb(255, 255, 255)??)**. ``` @@ -163,7 +167,7 @@ In this section, we will develop an infographic food details page, by building c ![en-us_image_0000001222967776](figures/en-us_image_0000001222967776.png) -8. Adjust the structure between components and semanticize component names. Create the FoodDetail page entry component, create a column in **FoodDetail**, and set the alignment to **alignItems(HorizontalAlign.Center)**. Change the name of the **MyComponent** component to **FoodImageDisplay**, which is a child component of the **FoodDetail** component. +8. Adjust the structure between components and semanticize component names. Create the **FoodDetail** page entry component, create a column in **FoodDetail**, and set the alignment to **alignItems(HorizontalAlign.Center)**. Change the name of the **MyComponent** component to **FoodImageDisplay**, which is a child component of the **FoodDetail** component. A column is a container component whose child components are vertically arranged. It is a linear layout in essence. Therefore, only the alignment in the cross axis direction can be set. @@ -202,7 +206,7 @@ In this section, we will develop an infographic food details page, by building c You can use the Flex layout to build a food composition table. In this way you do not need to worry about the width and height calculation. The size of different cells can be flexibly set based on the proportion. -1. Create a **ContentTable** component as a child component of the FoodDetail component. +1. Create a **ContentTable** component as a child component of the **FoodDetail** component. ``` @Component @@ -239,13 +243,13 @@ You can use the Flex layout to build a food composition table. In this way you d } ``` -2. Create a Flex component to display two food composition categories in the tomato: Calories and Nutrition. +2. Create a Flex component to display two food composition categories in the tomato: **Calories** and **Nutrition**. -Calories contains information about calories. Nutrition contains information about protein, fat, carbohydrates, and vitamin C. + **Calories** contains information about calories. **Nutrition** contains information about protein, fat, carbohydrates, and vitamin C. -Create the Calories class. Create a Flex component and set its height to 280, and the top, right, and left margins to 30. The Flex component contains three Text child components, which represent the category name (Calories), content name (Calories), and contain value (17 kcal), respectively. By default, child components in the Flex component are arranged horizontally. + Create the **Calories** class. Create a Flex component and set its height to 280, and the top, right, and left margins to 30. The Flex component contains three **\** child components, which represent the category name (**Calories**), content name (**Calories**), and contain value (**17 kcal**), respectively. By default, child components in the Flex component are arranged horizontally. - In the following example, code of FoodImageDisplay is omitted, and only code of ContentTable is provided. + In the following example, code of **FoodImageDisplay** is omitted, and only code of **ContentTable** is provided. ``` @@ -281,14 +285,14 @@ Create the Calories class. Create a Flex component and set its height to 280, an ![en-us_image_0000001267767869](figures/en-us_image_0000001267767869.png) -3. Adjust the layout and set the proportion (layoutWeight) of each part. Set the proportion of the category name to **1**, and the total proportion of content name and content value to **2**. The content name and content value are in a same Flex, and the content name occupies all remaining space flexGrow(1). +3. Adjust the layout and set the proportion (**layoutWeight**) of each part. Set the proportion of the category name to **1**, and the total proportion of content name and content value to **2**. The content name and content value are in a same Flex, and the content name occupies all remaining space **flexGrow(1)**. ``` @Component struct FoodImageDisplay { build() { Stack({ alignContent: Alignment.BottomStart }) { - Image($m('Tomato.png')) + Image($r('app.media.Tomato')) .objectFit(ImageFit.Contain) .height(357) Text('Tomato') @@ -337,7 +341,7 @@ Create the Calories class. Create a Flex component and set its height to 280, an ![en-us_image_0000001267607901](figures/en-us_image_0000001267607901.png) -4. Create the **Nutrient** class in a similar process. Nutrition consists of four parts: Protein, Fat, Carbohydrates, and VitaminC. The names of the last three parts are omitted in the table and represented by spaces. +4. Create the **Nutrient** class in a similar process. **Nutrition** consists of four parts: **Protein**, **Fat**, **Carbohydrates**, and **VitaminC**. The names of the last three parts are omitted in the table and represented by spaces. Set **FlexDirection.Column**, **FlexAlign.SpaceBetween**, and **ItemAlign.Start**. @@ -442,7 +446,7 @@ Create the Calories class. Create a Flex component and set its height to 280, an Currently, all food groups are declared, resulting in code duplication and redundancy. You can use @Builder to build a custom method and abstract the same UI structure declaration. The @Builder decorated method and the build method for the @Component decorated component are used to declare some UI rendering structures and comply with the same eTS syntax. You can define one or more methods decorated by @Builder, but a component decorated by @Component can have only one build method. - Declare the IngredientItem method decorated by @Builder in ContentTable to declare the UI descriptions for the category name, content name, and content value. + Declare the **IngredientItem** method decorated by @Builder in **ContentTable** to declare the UI descriptions for the category name, content name, and content value. ``` @@ -455,9 +459,6 @@ Create the Calories class. Create a Flex component and set its height to 280, an .fontWeight(FontWeight.Bold) .layoutWeight(1) Flex({ alignItems: ItemAlign.Center }) { - Circle({width: 6, height: 6}) - .margin({right: 12}) - .fill(colorValue) Text(name) .fontSize(17.4) .flexGrow(1) @@ -470,7 +471,7 @@ Create the Calories class. Create a Flex component and set its height to 280, an } ``` -When the ` IngredientItem` API is called in the build method of ContentTable, ` this ` needs to be used to invoke the method in the scope of the component to distinguish the global method call. + When the `IngredientItem` API is called in the **build** method of **ContentTable**, `this` needs to be used to invoke the method in the scope of the component to distinguish the global method call. ``` @@ -491,7 +492,7 @@ When the ` IngredientItem` API is called in the build method of ContentTable, } ``` -The overall code of the ContentTable component is as follows: + The overall code of the **ContentTable** component is as follows: ``` diff --git a/en/application-dev/website.md b/en/application-dev/website.md index 85bc8dd8fae8c635306ea62f821f3688b16c3403..0726f2d6fc16127147536e0a1c260db5a7a1c06d 100644 --- a/en/application-dev/website.md +++ b/en/application-dev/website.md @@ -334,7 +334,7 @@ - [Layout Constraints](reference/arkui-ts/ts-universal-attributes-layout-constraints.md) - [Flex Layout](reference/arkui-ts/ts-universal-attributes-flex-layout.md) - [Border](reference/arkui-ts/ts-universal-attributes-border.md) - - [ͼƬ߿](reference/arkui-ts/ts-universal-attributes-border-image.md) + - [Border Image](reference/arkui-ts/ts-universal-attributes-border-image.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) diff --git a/en/device-dev/driver/driver-platform-mmc-develop.md b/en/device-dev/driver/driver-platform-mmc-develop.md index 10445936ef0e8f53cc95968c40f1c9dd2aae29c7..b222b2081ea95ca1c17fe48e4d1e9413ff44f139 100644 --- a/en/device-dev/driver/driver-platform-mmc-develop.md +++ b/en/device-dev/driver/driver-platform-mmc-develop.md @@ -3,7 +3,7 @@ ## Overview -In the Hardware Driver Foundation (HDF), the MultiMedia Card (MMC) uses the independent service mode for API adaptation. In this mode, each device independently publishes a service to process external access requests. When receiving an access request, the HDF DeviceManager extracts parameters from the request to call the internal APIs of the target device. In the independent service mode, the HDF DeviceManager provides service management capabilities. However, you need to configure a node for each device, which increases memory usage. +In the Hardware Driver Foundation (HDF), the MultiMedia Card (MMC) uses the independent service mode for API adaptation. In this mode, each device independently publishes a service to process external access requests. When receiving an access request, the HDF DeviceManager extracts parameters from the request to call the internal APIs of the target device. In the independent service mode, the HDF DeviceManager provides service management capabilities. However, you need to configure a node for each device, which increases memory usage. **Figure 1** Independent service mode @@ -14,7 +14,7 @@ In the Hardware Driver Foundation (HDF), the MultiMedia Card (MMC) uses the inde **MmcCntlrOps**: - + ``` struct MmcCntlrOps { int32_t (*request)(struct MmcCntlr *cntlr, struct MmcCmd *cmd); @@ -37,23 +37,23 @@ struct MmcCntlrOps { **Table 1** Description of callback functions in MmcCntlrOps -| Function| Input Parameter| Return Value| Description| +| Function| Input Parameter| Return Value| Description| | -------- | -------- | -------- | -------- | -| doRequest | **cntlr**: structure pointer to the MMC controller at the core layer.
**cmd**: structure pointer to the command to execute.| HDF_STATUS| Processes the request.| -| setClock | **cntlr**: structure pointer to the MMC controller at the core layer.
**clock**: clock frequency to set.| HDF_STATUS| Sets the clock frequency.| -| setPowerMode | **cntlr**: structure pointer to the MMC controller at the core layer.
**mode**: power consumption mode, which is an enumerated value.| HDF_STATUS| Sets the power consumption mode.| -| setBusWidth | **cntlr**: structure pointer to the MMC controller at the core layer.
**width**: bus width, which is an enumerated value.| HDF_STATUS| Sets the bus width.| -| setBusTiming | **cntlr**: structure pointer to the MMC controller at the core layer.
**timing**: bus timing, which is an enumerated value.| HDF_STATUS| Sets the bus timing.| -| setSdioIrq | **cntlr**: structure pointer to the MMC controller at the core layer.
**enable**: whether to enable Secure Digital Input Output (SDIO) interrupts.| HDF_STATUS| Enables or disables SDIO interrupts.| -| hardwareReset | **cntlr**: structure pointer to the MMC controller at the core layer.| HDF_STATUS| Resets hardware.| -| systemInit | **cntlr**: structure pointer to the MMC controller at the core layer.| HDF_STATUS| Performs system initialization.| -| setEnhanceSrobe | **cntlr**: structure pointer to the MMC controller at the core layer.
**enable**: whether to enable the enhanced strobe feature.| HDF_STATUS| Sets the enhanced strobe feature.| -| switchVoltage | **cntlr**: structure pointer to the MMC controller at the core layer.
**volt**: voltage to set, which can be 3.3 V, 1.8 V, or 1.2 V.| HDF_STATUS| Sets the voltage.| -| devReadOnly | **cntlr**: structure pointer to the MMC controller at the core layer.| Boolean value| Checks whether the device is read-only.| -| cardPluged | **cntlr**: structure pointer to the MMC controller at the core layer.| Boolean value| Checks whether the device is removed.| -| devBusy | **cntlr**: structure pointer to the MMC controller at the core layer.| Boolean value| Checks whether the device is being used.| -| tune | **cntlr**: structure pointer to the MMC controller at the core layer.
**cmdCode**: command code of the uint32_t type.| HDF_STATUS| Tunes the oscillator circuit frequency. | -| rescanSdioDev | **cntlr**: structure pointer to the MMC controller at the core layer.| HDF_STATUS| Scans and adds an SDIO device.| +| doRequest | **cntlr**: structure pointer to the MMC controller at the core layer.
**cmd**: structure pointer to the command to execute.| HDF_STATUS| Processes the request.| +| setClock | **cntlr**: structure pointer to the MMC controller at the core layer.
**clock**: clock frequency to set.| HDF_STATUS| Sets the clock frequency.| +| setPowerMode | **cntlr**: structure pointer to the MMC controller at the core layer.
**mode**: power consumption mode, which is an enumerated value.| HDF_STATUS| Sets the power consumption mode.| +| setBusWidth | **cntlr**: structure pointer to the MMC controller at the core layer.
**width**: bus width, which is an enumerated value.| HDF_STATUS| Sets the bus width.| +| setBusTiming | **cntlr**: structure pointer to the MMC controller at the core layer.
**timing**: bus timing, which is an enumerated value.| HDF_STATUS| Sets the bus timing.| +| setSdioIrq | **cntlr**: structure pointer to the MMC controller at the core layer.
**enable**: whether to enable Secure Digital Input Output (SDIO) interrupts.| HDF_STATUS| Enables or disables SDIO interrupts.| +| hardwareReset | **cntlr**: structure pointer to the MMC controller at the core layer.| HDF_STATUS| Resets hardware.| +| systemInit | **cntlr**: structure pointer to the MMC controller at the core layer.| HDF_STATUS| Performs system initialization.| +| setEnhanceSrobe | **cntlr**: structure pointer to the MMC controller at the core layer.
**enable**: whether to enable the enhanced strobe feature.| HDF_STATUS| Sets the enhanced strobe feature.| +| switchVoltage | **cntlr**: structure pointer to the MMC controller at the core layer.
**volt**: voltage to set, which can be 3.3 V, 1.8 V, or 1.2 V.| HDF_STATUS| Sets the voltage.| +| devReadOnly | **cntlr**: structure pointer to the MMC controller at the core layer.| Boolean value| Checks whether the device is read-only.| +| cardPluged | **cntlr**: structure pointer to the MMC controller at the core layer.| Boolean value| Checks whether the device is removed.| +| devBusy | **cntlr**: structure pointer to the MMC controller at the core layer.| Boolean value| Checks whether the device is being used.| +| tune | **cntlr**: structure pointer to the MMC controller at the core layer.
**cmdCode**: command code of the uint32_t type.| HDF_STATUS| Tunes the oscillator circuit frequency.| +| rescanSdioDev | **cntlr**: structure pointer to the MMC controller at the core layer.| HDF_STATUS| Scans and adds an SDIO device.| ## How to Develop @@ -75,7 +75,6 @@ The MMC module adaptation involves the following steps: > For details about the functions in **MmcCntlrOps**, see [Available APIs](#available-apis). 4. Debug the driver. - (Optional) For new drivers, verify the basic functions, for example, check the information returned after the **MmcCntlrOps** instance is attached and whether the device starts successfully. @@ -88,7 +87,7 @@ The following uses **himci.c** as an example to present the information required Generally, the HDF calls the **Bind** function and then the **Init** function to load a driver. If **Init** fails to be called, the HDF calls **Release** to release driver resources and exit. MMC driver entry example: - + ``` struct HdfDriverEntry g_mmcDriverEntry = { .moduleVersion = 1, @@ -106,7 +105,7 @@ The following uses **himci.c** as an example to present the information required - **device_info.hcs** configuration example - + ``` root { device_info { @@ -147,7 +146,7 @@ The following uses **himci.c** as an example to present the information required - **mmc_config.hcs** configuration example - + ``` root { platform { @@ -196,15 +195,15 @@ The following uses **himci.c** as an example to present the information required } } } - } - ``` - + } + ``` + 3. Initialize the **MmcCntlr** object at the core layer, including defining a custom structure (to pass parameters and data) and implementing the **HdfDriverEntry** member functions (**Bind**, **Init**, and **Release**) to instantiate **MmcCntlrOps** in **MmcCntlr** (so that the underlying driver functions can be called). - Defining a custom structure To the driver, the custom structure holds parameters and data. The **DeviceResourceIface** method provided by the HDF reads the values in the **mmc_config.hcs** file to initialize the members in the custom structure and passes important parameters to the **MmcCntlr** object at the core layer. - + ``` struct HimciHost { struct MmcCntlr *mmc;// (Mandatory) Core layer structure @@ -257,7 +256,7 @@ The following uses **himci.c** as an example to present the information required - Instantiating **MmcCntlrOps** in **MmcCntlr** (other members are initialized by **Bind**) - + ``` static struct MmcCntlrOps g_himciHostOps = { .request = HimciDoRequest, @@ -300,7 +299,7 @@ The following uses **himci.c** as an example to present the information required Initializes the custom structure **HimciHost** object and **MmcCntlr**, and calls the **MmcCntlrAdd** function at the core layer. **MmcCntlr**, **HimciHost**, and **HdfDeviceObject** assign values with each other so that other functions can be converted successfully. - + ``` static int32_t HimciMmcBind(struct HdfDeviceObject *obj) { @@ -347,7 +346,7 @@ The following uses **himci.c** as an example to present the information required Implements **ProcMciInit**. - + ``` static int32_t HimciMmcInit(struct HdfDeviceObject *obj) { @@ -377,7 +376,7 @@ The following uses **himci.c** as an example to present the information required Releases the memory and deletes the controller. This function assigns values to the **Release** function in the driver entry structure. If the HDF fails to call the **Init** function to initialize the driver, the **Release** function can be called to release driver resources. All forced conversion operations for obtaining the corresponding object can be successful only when the **Init** function has the value assignment operations. - + ``` static void HimciMmcRelease(struct HdfDeviceObject *obj) { diff --git a/en/device-dev/driver/driver-platform-watchdog-des.md b/en/device-dev/driver/driver-platform-watchdog-des.md index deb85133a3dde4f11cfb03762f4f4fd9d656d51b..aa00d54869576d625e05eead5cbe237a81d560e8 100644 --- a/en/device-dev/driver/driver-platform-watchdog-des.md +++ b/en/device-dev/driver/driver-platform-watchdog-des.md @@ -1,124 +1,60 @@ -# Watchdog - -## Overview - -A watchdog, also called a watchdog timer, is a hardware timing device. If an error occurs in the main program of the system and fails to reset the watchdog timer, the watchdog timer sends a reset signal to restore the system to a normal state. - -## Available APIs - -**Table 1** Watchdog APIs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Capability

-

Function

-

Description

-

Open/Close

-

WatchdogOpen

-

Opens a watchdog.

-

WatchdogClose

-

Closes a watchdog.

-

Start/Stop

-

WatchdogStart

-

Starts a watchdog.

-

WatchdogStop

-

Stops a watchdog.

-

Timeout duration

-

WatchdogSetTimeout

-

Sets the watchdog timeout duration.

-

WatchdogGetTimeout

-

Obtains the watchdog timeout duration.

-

Status

-

WatchdogGetStatus

-

Obtains the watchdog status.

-

Feeding

-

WatchdogFeed

-

Feeds a watchdog, or resets a watchdog timer.

-
- ->![](../public_sys-resources/icon-note.gif) **NOTE**
->All watchdog functions provided in this document can be called only in kernel mode. - -## Usage Guidelines - -### How to Use - -The figure below illustrates how to use the APIs. - -**Figure 1** Using watchdog driver APIs -![](figures/using-watchdog-process.png "process-of-using-a-watchdog") - -### Opening a Watchdog - -Use **WatchdogOpen** to open a watchdog. A system may have multiple watchdogs. You can open the specified watchdog by using the ID. - -int32\_t WatchdogOpen\(int16\_t wdtId\); - -**Table 2** Description of WatchdogOpen - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

wdtId

-

Watchdog ID.

-

Return Value

-

Description

-

NULL

-

Failed to open the watchdog.

-

DevHandle pointer

-

Pointer to the watchdog handle.

-
+# Watchdog + + +## **Overview** + +A watchdog, also called a watchdog timer, is a hardware timing device used to facilitate automatic correction of temporary hardware faults or recover from system malfunctions. If an error occurs in the main program of the system and the watchdog timer is not cleared in time, the watchdog timer sends a reset signal to restore the system to the normal state. + + +## Available APIs + +**Table 1** Watchdog APIs + +| API| Description| +| -------- | -------- | +| WatchdogOpen | Opens a watchdog.| +| WatchdogClose | Closes a watchdog.| +| WatchdogStart | Starts a watchdog.| +| WatchdogStop | Stops a watchdog.| +| WatchdogSetTimeout | Sets the watchdog timeout duration.| +| WatchdogGetTimeout | Obtains the watchdog timeout duration.| +| WatchdogGetStatus | Obtains the watchdog status.| +| WatchdogFeed | Feeds a watchdog or resets a watchdog timer.| + +> ![](../public_sys-resources/icon-note.gif) **NOTE** +> +> All watchdog APIs provided in this document can be called only in kernel mode. + + +## Usage Guidelines + + +### How to Use + +The figure below shows how to use the watchdog APIs. + +Figure 1 Using watchdog APIs + +![image](figures/using-watchdog-process.png) + + +### Opening a Watchdog + +Use **WatchdogOpen()** to open a watchdog. A system may have multiple watchdogs. You need to specify the ID of the watchdog to open. + +``` +DevHandle WatchdogOpen(int16_t wdtId); +``` + +**Table 2** Description of WatchdogOpen + +| **Parameter**| **Description**| +| -------- | -------- | +| wdtId | Watchdog ID.| +| **Return Value**| **Description**| +| NULL | The operation failed.| +| **DevHandle** pointer| The operation is successful. The pointer to the watchdog device handle is returned.| + ``` DevHandle handle = NULL; @@ -129,46 +65,23 @@ if (handle == NULL) { } ``` -### Obtaining the Watchdog Status - -int32\_t WatchdogGetStatus\(DevHandle handle, int32\_t \*status\); - -**Table 3** Description of WatchdogGetStatus - - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

Watchdog handle.

-

status

-

Pointer to the watchdog status.

-

Return Value

-

Description

-

0

-

The watchdog status is obtained.

-

Negative value

-

Failed to obtain the watchdog status.

-
+ +### Obtaining the Watchdog Status + +``` +int32_t WatchdogGetStatus(DevHandle handle, int32_t *status); +``` + +**Table 3** Description of WatchdogGetStatus + +| **Parameter**| **Description**| +| -------- | -------- | +| handle | Watchdog device handle.| +| status | Pointer to the watchdog status obtained.| +| **Return Value**| **Description**| +| 0 | The operation is successful.| +| Negative value| The operation failed.| + ``` int32_t ret; @@ -181,51 +94,28 @@ if (ret != 0) { } ``` -### Setting the Timeout Duration - -int32\_t WatchdogSetTimeout\(PalHandle \*handle, uint32\_t seconds\); - -**Table 4** Description of WatchdogSetTimeout - - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

Watchdog handle.

-

seconds

-

Timeout duration, in seconds.

-

Return Value

-

Description

-

0

-

The setting is successful.

-

Negative value

-

Setting failed.

-
+ +### Setting the Timeout Duration + +``` +int32_t WatchdogSetTimeout(DevHandle *handle, uint32_t seconds); +``` + +**Table 4** Description of WatchdogSetTimeout + +| **Parameter**| **Description**| +| -------- | -------- | +| handle | Pointer to the watchdog device handle.| +| seconds | Timeout duration to set, in seconds.| +| **Return Value**| **Description**| +| 0 | The operation is successful.| +| Negative value| The operation failed.| + ``` int32_t ret; uint32_t timeOut = 60; -/* Set the timeout duration, in seconds. */ +/* Set the timeout duration to 60 seconds. */ ret = WatchdogSetTimeout(handle, timeOut); if (ret != 0) { HDF_LOGE("WatchdogSetTimeout: failed, ret %d\n", ret); @@ -233,46 +123,23 @@ if (ret != 0) { } ``` -### Obtaining the Timeout Duration - -int32\_t WatchdogGetTimeout\(PalHandle \*handle, uint32\_t \*seconds\); - -**Table 5** Description of WatchdogGetTimeout - - - - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

Watchdog handle.

-

seconds

-

Pointer to the timeout duration, in seconds.

-

Return Value

-

Description

-

0

-

The watchdog status is obtained.

-

Negative value

-

Failed to obtain the watchdog status.

-
+ +### Obtaining the Timeout Duration + +``` +int32_t WatchdogGetTimeout(DevHandle *handle, uint32_t *seconds); +``` + +**Table 5** Description of WatchdogGetTimeout + +| **Parameter**| **Description**| +| -------- | -------- | +| handle | Pointer to the watchdog device handle.| +| seconds | Pointer to the timeout duration, in seconds.| +| **Return Value**| **Description**| +| 0 | The operation is successful.| +| Negative value| The operation failed.| + ``` int32_t ret; @@ -285,41 +152,22 @@ if (ret != 0) { } ``` -### Starting a Watchdog - -int32\_t WatchdogStart\(DevHandle handle\); - -**Table 6** Description of WatchdogStart - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

Watchdog handle.

-

Return Value

-

Description

-

0

-

The watchdog is started.

-

Negative value

-

Failed to start the watchdog.

-
+ +### Starting a Watchdog + +``` +int32_t WatchdogStart(DevHandle handle); +``` + +**Table 6** Description of WatchdogStart + +| **Parameter**| **Description**| +| -------- | -------- | +| handle | Watchdog device handle.| +| **Return Value**| **Description**| +| 0 | The operation is successful.| +| Negative value| The operation failed.| + ``` int32_t ret; @@ -331,41 +179,22 @@ if (ret != 0) { } ``` -### Feeding a Watchdog - -int32\_t WatchdogFeed\(DevHandle handle\); - -**Table 7** Description of WatchdogFeed - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

Watchdog handle.

-

Return Value

-

Description

-

0

-

The watchdog is fed.

-

Negative value

-

Failed to feed the watchdog.

-
+ +### Feeding a Watchdog + +``` +int32_t WatchdogFeed(DevHandle handle); +``` + +**Table 7** Description of WatchdogFeed + +| **Parameter**| **Description**| +| -------- | -------- | +| handle | Watchdog device handle.| +| **Return Value**| **Description**| +| 0 | The operation is successful.| +| Negative value| The operation failed.| + ``` int32_t ret; @@ -377,41 +206,22 @@ if (ret != 0) { } ``` -### Stopping a Watchdog - -int32\_t WatchdogStop\(DevHandle handle\); - -**Table 8** Description of WatchdogStop - - - - - - - - - - - - - - - - - - - -

Parameter

-

Description

-

handle

-

Watchdog handle.

-

Return Value

-

Description

-

0

-

The watchdog is stopped.

-

Negative value

-

Stopping the watchdog failed.

-
+ +### Stopping a Watchdog + +``` +int32_t WatchdogStop(DevHandle handle); +``` + +**Table 8** Description of WatchdogStop + +| **Parameter**| **Description**| +| -------- | -------- | +| handle | Watchdog device handle.| +| **Return Value**| **Description**| +| 0 | The operation is successful.| +| Negative value| The operation failed.| + ``` int32_t ret; @@ -423,44 +233,38 @@ if (ret != 0) { } ``` -### Closing a Watchdog -If the watchdog is no longer required, call **WatchdogClose** to close the watchdog handle. +### Closing a Watchdog -void WatchdogClose\(DevHandle handle\); +If a watchdog is no longer required, call **WatchdogClose()** to close it. -**Table 9** Description of WatchdogClose +``` +void WatchdogClose(DevHandle handle); +``` + +**Table 9** Description of WatchdogClose + +| **Parameter**| **Description**| +| -------- | -------- | +| handle | Watchdog device handle.| - - - - - - - - - -

Parameter

-

Description

-

handle

-

Watchdog handle.

-
``` /* Close the watchdog. */ ret = WatchdogClose(handle); ``` -## Usage Example -This example provides a complete process for using a watchdog. +## Example -In this example, open a watchdog, set the timeout duration, and start the watchdog. +The following example provides the complete development process. -- Feed the watchdog periodically to ensure that the system is not reset due to timer expiry. -- Stop feeding the watchdog and check whether the system is reset after the timer expires. +1. Open a watchdog, set the timeout duration, and start the watchdog. -Example: +2. Feed the watchdog periodically to ensure that the system is not reset due to timer expiry. +3. Stop feeding the watchdog and check whether the system is reset after the timer expires. + +Sample code: ``` #include "watchdog_if.h" @@ -481,7 +285,7 @@ static int32_t TestCaseWatchdog(void) /* Open watchdog 0. */ handle = WatchdogOpen(0); if (handle == NULL) { - HDF_LOGE("Open watchdog fail!"); + HDF_LOGE("Open watchdog failed!"); return -1; } @@ -493,7 +297,7 @@ static int32_t TestCaseWatchdog(void) return ret; } - /* Obtain the configured timeout duration. */ + /* Obtain the timeout duration. */ ret = WatchdogGetTimeout(handle, &timeout); if (ret != HDF_SUCCESS) { HDF_LOGE("%s: get timeout fail! ret:%d\n", __func__, ret); @@ -505,14 +309,14 @@ static int32_t TestCaseWatchdog(void) /* Start the watchdog. The timer starts. */ ret = WatchdogStart(handle); if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: satrt fail! ret:%d\n", __func__, ret); + HDF_LOGE("%s: start fail! ret:%d\n", __func__, ret); WatchdogClose(handle); return ret; } - /* Feed the watchdog every 1s. */ + /* Feed the watchdog every other second. */ for (i = 0; i < WATCHDOG_TEST_FEED_TIME; i++) { - HDF_LOGE("%s: feeding watchdog %d times... \n", __func__, i); + HDF_LOGI("%s: feeding watchdog %d times... \n", __func__, i); ret = WatchdogFeed(handle); if (ret != HDF_SUCCESS) { HDF_LOGE("%s: feed dog fail! ret:%d\n", __func__, ret); @@ -522,17 +326,17 @@ static int32_t TestCaseWatchdog(void) OsalSleep(1); } /* Because the interval for feeding the watchdog is shorter than the timeout duration, the system does not reset, and logs can be printed normally. */ - HDF_LOGE("%s: no reset ... feeding test OK!!!\n", __func__); + HDF_LOGI("%s: no reset ... feeding test OK!!!\n", __func__); - /* Enable the timer to expire by stopping feeding the watchdog. */ + /* Stop feeding the watchdog to make the timer expire. */ for (i = 0; i < WATCHDOG_TEST_FEED_TIME; i++) { - HDF_LOGE("%s: watiting dog buck %d times... \n", __func__, i); + HDF_LOGI("%s: waiting dog buck %d times... \n", __func__, i); OsalSleep(1); } - /* The system resets when the timer expires. If the code is correct, the log below is not displayed. */ - HDF_LOGE("%s: dog has't buck!!! \n", __func__, i); + /* The system resets when the timer expires. Theoretically, this log is not displayed. */ + HDF_LOGI("%s: dog hasn't back!!! \n", __func__, i); WatchdogClose(handle); return -1; } -``` \ No newline at end of file +``` diff --git a/en/device-dev/driver/driver-platform-watchdog-develop.md b/en/device-dev/driver/driver-platform-watchdog-develop.md index 13898cfeaafd8803834c5b62f819e56ecfde96e7..d153a4ae1788127dd08a0cf8c084c3cecc1b73fd 100644 --- a/en/device-dev/driver/driver-platform-watchdog-develop.md +++ b/en/device-dev/driver/driver-platform-watchdog-develop.md @@ -1,16 +1,21 @@ -# Watchdog +# Watchdog -## Overview +## **Overview** -In the Hardware Driver Foundation \(HDF\), the Watchdog \(also called Watchdog timer\) module uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to handle external access requests. After receiving an access request from an API, the device manager extracts the parameters in the request to call the internal method of the target device. In the independent service mode, the service management capabilities of the HDF Device Manager can be directly used. However, you need to configure a device node for each device, which increases the memory usage. +A watchdog, also called a watchdog timer, is a hardware timing device used to facilitate automatic correction of temporary hardware faults or recover from system malfunctions. -**Figure 1** Independent service mode -![](figures/independent-service-mode.png "independent-service-mode-15") +In the Hardware Driver Foundation (HDF), the watchdog uses the independent service mode for API adaptation. In this mode, each device independently publishes a service to process external access requests. When receiving an access request, the HDF DeviceManager extracts parameters from the request to call the internal APIs of the target device. In the independent service mode, the HDF DeviceManager provides service management capabilities. However, you need to configure a node for each device, which increases memory usage. -## Available APIs + **Figure 1** Independent service mode + + ![image](figures/independent-service-mode.png "Watchdog independent service mode") + + +## **Available APIs** + +**WatchdogMethod**: -WatchdogMethod ``` struct WatchdogMethod { @@ -25,334 +30,250 @@ struct WatchdogMethod { }; ``` -**Table 1** Callbacks for the members in the WatchdogMethod structure - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Callback

-

Input Parameter

-

Output Parameter

-

Return Value

-

Description

-

getStatus

-

wdt: structure pointer to the Watchdog controller at the core layer.

-

status: int32_t pointer indicating the watchdog status (started or stopped).

-

HDF_STATUS

-

Obtains the watchdog status.

-

start

-

wdt: structure pointer to the Watchdog controller at the core layer.

-

-

HDF_STATUS

-

Starts a watchdog.

-

stop

-

wdt: structure pointer to the Watchdog controller at the core layer.

-

-

HDF_STATUS

-

Stops a watchdog.

-

setTimeout

-

wdt: structure pointer to the Watchdog controller at the core layer.

-

seconds: input time value, which is of the uint32_t type.

-

-

HDF_STATUS

-

Sets the timeout period (in seconds) for a watchdog. Ensure that the actual watchdog running time complies with this setting.

-

getTimeout

-

wdt: structure pointer to the Watchdog controller at the core layer.

-

seconds: output time value, which is of the uint32_t type.

-

HDF_STATUS

-

Obtains the timeout period of a watchdog.

-

feed

-

wdt: structure pointer to the Watchdog controller at the core layer.

-

-

HDF_STATUS

-

Feeds a watchdog.

-
- - -## How to Develop - -The Watchdog module adaptation involves the following steps: - -1. Instantiate the driver entry. - - Instantiate the **HdfDriverEntry** structure. - - Call **HDF\_INIT** to register the **HdfDriverEntry** instance with the HDF. - -2. Configure attribute files. - - Add the **deviceNode** information to the **device\_info.hcs** file. - - \(Optional\) Add the **watchdog\_config.hcs** file. - -3. Instantiate the Watchdog controller object. - - Initialize **WatchdogCntlr**. - - Instantiate **WatchdogMethod** in the **WatchdogCntlr** object. - - For details, see [Available APIs](#available-apis). - -4. \(Optional\) Debug the driver. - - For new drivers, verify basic functions, for example, verify the information returned after the connect operation and whether the watchdog timer is successfully set. - - -## Development Example - -The following uses **watchdog\_hi35xx.c** as an example to present the contents that need to be provided by the vendor to implement device functions. - -1. Instantiate the driver entry. The driver entry must be a global variable of the **HdfDriverEntry** type \(defined in **hdf\_device\_desc.h**\), and the value of **moduleName** must be the same as that in **device\_info.hcs**. In the HDF, the start address of each **HdfDriverEntry** object of all loaded drivers is collected to form a segment address space similar to an array for the upper layer to invoke. - - Generally, HDF calls the **Bind** function and then the **Init** function to load a driver. If **Init** fails to be called, HDF calls **Release** to release driver resources and exit. - - - Watchdog driver entry reference - - ``` - struct HdfDriverEntry g_watchdogDriverEntry = { - .moduleVersion = 1, - .Bind = Hi35xxWatchdogBind, // See the Bind function. - .Init = Hi35xxWatchdogInit, // See the Init function. - .Release = Hi35xxWatchdogRelease, //See the Release function. - .moduleName = "HDF_PLATFORM_WATCHDOG",// (Mandatory) The value must be the same as that of moduleName in the .hcs file. - }; - HDF_INIT(g_watchdogDriverEntry);// Call HDF_INIT to register the driver entry with the HDF. - ``` - -2. Add the **deviceNode** information to the **device\_info.hcs** file and configure the component attributes in the **watchdog\_config.hcs** file. The **deviceNode** information is related to registration of the driver entry. The device attribute values are closely related to the default values or value ranges of the **WatchdogCntlr** members at the core layer. - - In this example, there is only one Watchdog controller. If there are multiple Watchdog controllers, you need to add the **deviceNode** information to the **device\_info** file and add the corresponding device attributes to the **watchdog\_config** file. - - - **device\_info.hcs** configuration reference - - ``` - root { - device_info { - match_attr = "hdf_manager"; - device_watchdog :: device {// Device node - device0:: deviceNode {// DeviceNode of the driver - The policy = 1; // The value 1 indicates that the driver publishes kernel-mode services. The value 2 indicates that the driver publishes user-mode services. - priority = 20; // Driver startup priority - permission = 0644; // Permission to create device nodes for the driver - moduleName = "HDF_PLATFORM_WATCHDOG"; - // (Mandatory) Driver name. The value must be the same as that of moduleName in the driver entry structure. - serviceName = "HDF_PLATFORM_WATCHDOG_0"; - // (Mandatory) Unique name of the service published by the driver. - deviceMatchAttr = "hisilicon_hi35xx_watchdog_0"; - // (Mandatory) Keyword matching the private data of the driver. The value must be the same as that of match_attr in the private data configuration table of the driver. - } - } - } - } - ``` - - - **watchdog\_config.hcs** configuration reference - - ``` - root { - platform { - template watchdog_controller {// Template configuration. In the template, you can configure the common parameters shared by service nodes. - id = 0; - match_attr = ""; - regBase = 0x12050000; // (Mandatory) Used for address mapping. - regStep = 0x1000; // (Mandatory) Used for address mapping. - } - controller_0x12050000 :: watchdog_controller {// (Mandatory) Keyword for matching the private data of the device driver. - match_attr = "hisilicon_hi35xx_watchdog_0"; // (Mandatory) The value must be the same as that of deviceMatchAttr in device_info.hcs. - } - // Configure this parameter when there are multiple watchdogs. - ... - } - } - ``` - -3. Initialize the **WatchdogCntlr** object at the core layer, including initializing the vendor custom structure \(passing parameters and data\), instantiating **WatchdogMethod** \(used to call underlying functions of the driver\) in **WatchdogCntlr**, and implementing the **HdfDriverEntry** member functions \(**Bind**, **Init**, and **Release**\). - - Custom structure reference - - To the driver, the custom structure carries parameters and data. The values in the **watchdog\_config.hcs** file are read by HDF, and the structure members are initialized through **DeviceResourceIface**. Some important values, such as the index and the number of pins, are also passed to the **WatchdogCntlr** object at the core layer. - - ``` - struct Hi35xxWatchdog { - struct WatchdogCntlr wdt; // (Mandatory) Carrier that connects the upper and underlying layers. For details, see the following description. - OsalSpinlock lock; - volatile unsigned char *regBase;// [Mandatory] Used for address mapping. - uint32_t phyBase; // (Mandatory) Used for address mapping. - uint32_t regStep; // (Mandatory) Used for address mapping. - }; - // WatchdogCntlr is the core layer controller structure. Its members are assigned with values by using the Init function. - struct WatchdogCntlr { - struct IDeviceIoService service;// Driver service - struct HdfDeviceObject *device; // Drive device - OsalSpinlock lock; // This variable implements the spinlock function. - struct WatchdogMethod *ops; // Interface callback - int16_t wdtId; // ID of the watchdog device - void *priv; // Save the pointer. - }; - ``` - - - Instantiate the callback function structure **WatchdogMethod** in **WatchdogCntlr**. Other members are initialized by using the **Init** and **Bind** functions. - - ``` - static struct WatchdogMethod g_method = { - .getStatus = Hi35xxWatchdogGetStatus, - .start = Hi35xxWatchdogStart, - .stop = Hi35xxWatchdogStop, - .setTimeout = Hi35xxWatchdogSetTimeout, - .getTimeout = Hi35xxWatchdogGetTimeout, - .feed = Hi35xxWatchdogFeed, - }; - ``` - - - Init and Bind functions - - Input parameters: - - **HdfDeviceObject**: device object created by the HDF for each driver. It stores device-related private data and service APIs. - - Return values: - - HDF\_STATUS \(The following table lists some status. For details about other status, see **HDF\_STATUS** in the **//drivers/framework/include/utils/hdf\_base.h** file.\) - - **Table 2** Input parameters and return values of the Init and Bind functions - - - - - - - - - - - - - - - - - - - - - - -

Status (Value)

-

Description

-

HDF_ERR_INVALID_OBJECT

-

Failed to locate the watchdog device

-

HDF_ERR_MALLOC_FAIL

-

Failed to allocate memory

-

HDF_ERR_IO

-

I/O error

-

HDF_SUCCESS

-

Initialization successful

-

HDF_FAILURE

-

Initialization failed

-
- - Function description: - - Initializes the custom structure object and **WatchdogCntlr**, and calls the **WatchdogCntlrAdd** function at the core layer. - - ``` - // Generally, the Init function initializes the members of the Hi35xxWatchdog structure based on the attribute values of the input parameter (HdfDeviceObject). - // In this example, the Bind function initializes the Hi35xxWatchdog structure. - static int32_t Hi35xxWatchdogInit(struct HdfDeviceObject *device) - { - (void)device; - return HDF_SUCCESS; - } - - static int32_t Hi35xxWatchdogBind(struct HdfDeviceObject *device) - { - int32_t ret; - struct Hi35xxWatchdog *hwdt = NULL; - ... - hwdt = (struct Hi35xxWatchdog *)OsalMemCalloc(sizeof(*hwdt));// Apply for memory for the Hi35xxWatchdog structure. - ... - hwdt->regBase = OsalIoRemap(hwdt->phyBase, hwdt->regStep); // Address mapping - ... - hwdt->wdt.priv = (void *)device->property;// (Optional) Assign the device attribute values to priv. However, priv is not called subsequently. - //If priv needs to be called, instantiate the getPriv and releasePriv member functions in WatchdogMethod. - hwdt->wdt.ops = &g_method; // (Mandatory) Assign the instantiated objects to the ops member so that the top layer can invoke the WatchdogMethod member functions. - hwdt->wdt.device = device; // (Mandatory) Enable conversion between HdfDeviceObject and WatchdogcCntlr. - ret = WatchdogCntlrAdd(&hwdt->wdt); // (Mandatory) Call this function to initialize the structure of the core layer. The driver accesses the platform core layer only after a success signal is returned. - if (ret != HDF_SUCCESS) {// If the operation fails, release the resources used by the Init function. - OsalIoUnmap((void *)hwdt->regBase); - OsalMemFree(hwdt); - return ret; - } - return HDF_SUCCESS; - } - ``` - - - Release function - - Input parameters: - - **HdfDeviceObject**: device object created by the HDF for each driver. It stores device-related private data and service APIs. - - Return values: - - – - - Function description: - - Releases the memory and deletes the controller. This function assigns a value to the **Release** API in the driver entry structure. When the HDF fails to call the **Init** function to initialize the driver, the **Release** function can be called to release driver resources. All forced conversion operations for obtaining the corresponding object can be successful only when the **Init** function has the corresponding value assignment operations. - - ``` - static void Hi35xxWatchdogRelease(struct HdfDeviceObject *device) - { - struct WatchdogCntlr *wdt = NULL; - struct Hi35xxWatchdog *hwdt = NULL; - ... - wdt = WatchdogCntlrFromDevice(device);// Convert HdfDeviceObject to WatchdogCntlr by the service member. - //return (device == NULL) ? NULL : (struct WatchdogCntlr *)device->service; - if (wdt == NULL) { - return; - } - WatchdogCntlrRemove(wdt); // Core layer function used to execute wdt->device->service = NULL and release cntlr->lock. - hwdt = (struct Hi35xxWatchdog *)wdt; // Convert WatchdogCntlr to HimciHost. - if (hwdt->regBase != NULL) {// Remove address mapping. - OsalIoUnmap((void *)hwdt->regBase); - hwdt->regBase = NULL; - } - OsalMemFree(hwdt); // Release the memory occupied by the vendor-defined objects. - } - ``` \ No newline at end of file + **Table 1** Description of the callback functions in WatchdogMethod + +| Function| Input Parameter| Output Parameter| Return Value| Description| +| -------- | -------- | -------- | -------- | -------- | +| getStatus | **wdt**: structure pointer to the watchdog controller at the core layer.| **status**: int32_t pointer to the watchdog status (started or stopped).| HDF_STATUS| Obtains the watchdog status.| +| start | **wdt**: structure pointer to the watchdog controller at the core layer.| –| HDF_STATUS| Starts a watchdog.| +| stop | **wdt**: structure pointer to the watchdog controller at the core layer.| –| HDF_STATUS | Stops a watchdog.| +| setTimeout | **wdt**: structure pointer to the watchdog controller at the core layer.
**seconds**: Timeout duration to set, in seconds. The value is of the uint32_t type. | – | HDF_STATUS | Sets the timeout duration for a watchdog. | +| getTimeout | **wdt**: structure pointer to the watchdog controller at the core layer.| **seconds**: Pointer to the watchdog timeout duration obtained. The value is of the uint32_t type. | HDF_STATUS| Obtains the timeout duration of a watchdog.| +| feed | **wdt**: structure pointer to the watchdog controller at the core layer.| –| HDF_STATUS| Feeds a watchdog. | + + +## How to Develop + +The watchdog module adaptation involves the following steps: + +1. Instantiate the driver entry. + - Instantiate the **HdfDriverEntry** structure. + - Call **HDF_INIT** to register the **HdfDriverEntry** instance with the HDF. + +2. Configure attribute files. + - Add the **deviceNode** information to the **device_info.hcs** file. + - (Optional) Add the **watchdog_config.hcs** file. + +3. Instantiate the watchdog controller object. + - Initialize **WatchdogCntlr**. + - Instantiate **WatchdogMethod** in the **WatchdogCntlr** object. + + + > ![](../public_sys-resources/icon-note.gif) **NOTE** + > + > For details about the functions in **WatchdogMethod**, see [Available APIs](#available-apis). + +4. Debug the driver. + + (Optional) For new drivers, verify basic functions, for example, check the information returned after the driver is attached and whether the watchdog timer is successfully set. + + +## Development Example + +The following uses **watchdog_hi35xx.c** as an example to present the information required for implementing device functions. + +1. Instantiate the driver entry. + + The driver entry must be a global variable of the **HdfDriverEntry** type (defined in **hdf_device_desc.h**), and the value of **moduleName** must be the same as that in **device_info.hcs**. In the HDF, the start address of each **HdfDriverEntry** object of all loaded drivers is collected to form a segment address space similar to an array for the upper layer to invoke. + + Generally, the HDF calls the **Bind** function and then the **Init** function to load a driver. If **Init** fails to be called, the HDF calls **Release** to release driver resources and exit. + + Watchdog driver entry example: + + ``` + struct HdfDriverEntry g_watchdogDriverEntry = { + .moduleVersion = 1, + .Bind = Hi35xxWatchdogBind, // See the Bind function. + .Init = Hi35xxWatchdogInit, // See the Init function. + .Release = Hi35xxWatchdogRelease, // See the Release function. + .moduleName = "HDF_PLATFORM_WATCHDOG",// (Mandatory) The value must be the same as that of moduleName in the .hcs file. + }; + HDF_INIT(g_watchdogDriverEntry);// Call HDF_INIT to register the driver entry with the HDF. + ``` + +2. Add the **deviceNode** information to the **device_info.hcs** file and configure the component attributes in the **watchdog_config.hcs** file. + + The **deviceNode** information is related to registration of the driver entry. The device attribute values are closely related to the default values or value ranges of the **WatchdogCntlr** members at the core layer. + + In this example, there is only one watchdog controller. If there are multiple watchdog controllers, you need to add the **deviceNode** information to the **device_info** file and add the corresponding device attributes to the **watchdog_config** file for each controller. + + - **device_info.hcs** configuration example: + + + ``` + root { + device_info { + match_attr = "hdf_manager"; + device_watchdog :: device {// Device node. + device0:: deviceNode { // Device node of the driver. + policy = 1; // Policy for the driver to provide services. + priority = 20; // Driver startup priority. + permission = 0644; // Permission to create device nodes for the driver. + moduleName = "HDF_PLATFORM_WATCHDOG"; + // (Mandatory) Driver name. The value must be the same as that of moduleName in the driver entry structure. + serviceName = "HDF_PLATFORM_WATCHDOG_0"; + // (Mandatory) Unique name of the service published by the driver. + deviceMatchAttr = "hisilicon_hi35xx_watchdog_0"; + // (Mandatory) Keyword matching the private data of the driver. The value must be the same as that of match_attr in the private data configuration table of the driver. + } + } + } + } + ``` + + - **watchdog_config.hcs** configuration example: + + + ``` + root { + platform { + template watchdog_controller {// (Mandatory) Template configuration. In the template, you can configure the common parameters shared by device nodes. + id = 0; + match_attr = ""; + regBase = 0x12050000; // (Mandatory) Used for address mapping. + regStep = 0x1000; // (Mandatory) Used for address mapping. + } + controller_0x12050000 :: watchdog_controller {// (Mandatory) Keyword for matching the private data of the device driver. + match_attr = "hisilicon_hi35xx_watchdog_0"; // (Mandatory) The value must be the same as that of deviceMatchAttr in device_info.hcs. + } + // Configure this parameter when there are multiple watchdogs. + ... + } + } + ``` + +3. Initialize the **WatchdogCntlr** object at the core layer, including defining a custom structure (to pass parameters and data) and implementing the **HdfDriverEntry** member functions (**Bind**, **Init**, and **Release**) to instantiate **WatchdogMethod** in **WatchdogCntlr** (so that the underlying driver functions can be called). + - Defining a custom structure + + To the driver, the custom structure holds parameters and data. The **DeviceResourceIface** method provided by the HDF reads the values in the **watchdog_config.hcs** file to initialize the members in the custom structure and passes important parameters, such as the index and the number of pins, to the **WatchdogCntlr** object at the core layer. + + + ``` + struct Hi35xxWatchdog { + struct WatchdogCntlr wdt; // (Mandatory) Carrier that connects the upper and underlying layers. For details, see the following description. + OsalSpinlock lock; + volatile unsigned char *regBase;// [Mandatory] Used for address mapping. + uint32_t phyBase; // (Mandatory) Used for address mapping. + uint32_t regStep; // (Mandatory) Used for address mapping. + }; + // WatchdogCntlr is the core layer controller structure. The Init function assigns values to the members of WatchdogCntlr. + struct WatchdogCntlr { + struct IDeviceIoService service;// Driver service. + struct HdfDeviceObject *device; // Driver device. + OsalSpinlock lock; // This variable is called by the HDF core layer to implement the spinlock function. + struct WatchdogMethod *ops; // Callbacks. + int16_t wdtId // ID of the watchdog device. + void *priv; // Pointer to the driver's private data. + }; + ``` + + - Instantiating **WatchdogMethod** in **WatchdogCntlr** (other members are initialized by **Init** and **Bind**) + + + ``` + static struct WatchdogMethod g_method = { + .getStatus = Hi35xxWatchdogGetStatus, + .start = Hi35xxWatchdogStart, + .stop = Hi35xxWatchdogStop, + .setTimeout = Hi35xxWatchdogSetTimeout, + .getTimeout = Hi35xxWatchdogGetTimeout, + .feed = Hi35xxWatchdogFeed, + }; + ``` + + - **Init** and **Bind** functions + + Input parameter: + + **HdfDeviceObject**, a device object created by the HDF for each driver, holds device-related private data and service APIs. + + Return value: + + HDF_STATUS + + The table below lists some status. For more information, see **HDF_STATUS** in the /drivers/framework/include/utils/hdf_base.h file. + + **Table 2** HDF_STATUS + + | Status| Description| + | -------- | -------- | + | HDF_ERR_INVALID_OBJECT | Failed to locate the watchdog device.| + | HDF_ERR_MALLOC_FAIL | Failed to allocate memory.| + | HDF_ERR_IO | I/O error.| + | HDF_SUCCESS | Initialization successful.| + | HDF_FAILURE | Initialization failed.| + + Function description: + + Initializes the custom structure object and **WatchdogCntlr**, and calls the **WatchdogCntlrAdd** function at the core layer. + + + ``` + // Generally, the Init function initializes the members of the Hi35xxWatchdog structure based on the attribute values in **HdfDeviceObject**. + // In this example, the Bind function initializes the Hi35xxWatchdog structure. + static int32_t Hi35xxWatchdogInit(struct HdfDeviceObject *device) + { + (void)device; + return HDF_SUCCESS; + } + + static int32_t Hi35xxWatchdogBind(struct HdfDeviceObject *device) + { + int32_t ret; + struct Hi35xxWatchdog *hwdt = NULL; + ... + hwdt = (struct Hi35xxWatchdog *)OsalMemCalloc(sizeof(*hwdt));// Apply for memory for the Hi35xxWatchdog structure. + ... + hwdt->regBase = OsalIoRemap(hwdt->phyBase, hwdt->regStep); // Address mapping + ... + hwdt->wdt.priv = (void *)device->property;// (Optional) Assign the device attribute values to priv. However, priv is not called subsequently. + //If the priv member is required, instantiate getPriv() and releasePriv() of WatchdogMethod. + hwdt->wdt.ops = &g_method; // (Mandatory) Assign the instantiated objects to the ops members so that the top layer can invoke the WatchdogMethod functions. + hwdt->wdt.device = device; // (Mandatory) Enable conversion between HdfDeviceObject and WatchdogcCntlr. + ret = WatchdogCntlrAdd(&hwdt->wdt); // (Mandatory) Call this function to initialize the structure of the core layer. The driver accesses the platform core layer only after a success signal is returned. + if (ret != HDF_SUCCESS) { // If the operation fails, release the resources used by Init(). + OsalIoUnmap((void *)hwdt->regBase); + OsalMemFree(hwdt); + return ret; + } + return HDF_SUCCESS; + } + ``` + + - **Release** function + + Input parameter: + + **HdfDeviceObject**, a device object created by the HDF for each driver, holds device-related private data and service APIs. + + Return value: + + No value is returned. + + Function description: + + Releases driver resources. This function assigns values to **Release()** in the driver entry structure. When the HDF fails to call the **Init** function to initialize the driver, **Release()** can be called to release driver resources. The **Release()** function must contain the operations for releasing the memory and deleting the controller. + + All forced conversion operations for obtaining the corresponding object can be successful only when **Init()** has the corresponding value assignment operations. + + + ``` + static void Hi35xxWatchdogRelease(struct HdfDeviceObject *device) + { + struct WatchdogCntlr *wdt = NULL; + struct Hi35xxWatchdog *hwdt = NULL; + ... + wdt = WatchdogCntlrFromDevice(device);// Use service to convert HdfDeviceObject to WatchdogCntlr. + // return (device == NULL) ? NULL : (struct WatchdogCntlr *)device->service; + if (wdt == NULL) { + return; + } + WatchdogCntlrRemove(wdt); // Core layer function used to execute wdt->device->service = NULL and release cntlr->lock. + hwdt = (struct Hi35xxWatchdog *)wdt; // Convert WatchdogCntlr to HimciHost. + if (hwdt->regBase != NULL) { // Unmap addresses. + OsalIoUnmap((void *)hwdt->regBase); + hwdt->regBase = NULL; + } + OsalMemFree(hwdt); // Release the memory occupied by the vendor-defined objects. + } + ``` diff --git a/en/device-dev/porting/porting-chip-prepare-knows.md b/en/device-dev/porting/porting-chip-prepare-knows.md index 6422f0f6bddd007815c9122704f67713d5f78c7a..64a136cd4884c4d76a9ddf86c9160e410177cdc8 100644 --- a/en/device-dev/porting/porting-chip-prepare-knows.md +++ b/en/device-dev/porting/porting-chip-prepare-knows.md @@ -18,7 +18,7 @@ The implementation of the OpenHarmony project directories and functions relies o | /build/lite | OpenHarmony basic compilation and building framework.| | /kernel/liteos_m | Basic kernel. The implementation related to the chip architecture is in the **arch** directory.| | /device | Board-level implementation, which complies with the OpenHarmony specifications. For details about the directory structure and porting process, see [Overview](../porting/porting-chip-board-overview.md).| -| /vendor | Product-level implementation, which is contributed by Huawei or product vendors.| +| /vendor | Product-level implementation, which is contributed by product vendors. | The **device** directory is in the internal structure of **device/{Chip solution vendor}/{Development board}**. The following uses HiSilicon **hispark_taurus** as an example: @@ -37,7 +37,7 @@ device ``` -The **vendor** directory is in the internal structure of **vendor/{Product solution vendor}/{Product name}**. The following uses the Huawei Wi-Fi IoT product as an example: +The **vendor** directory is in the internal structure of **vendor/{Product solution vendor}/{Product name}**. The following uses the Wi-Fi IoT product as an example: diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001114129426.png b/en/device-dev/quick-start/figures/en-us_image_0000001114129426.png index c5548cb227bd024b49aa3adba0a20869581448e8..8cff39968a2d34bdd93daa5de808a07558b56077 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001114129426.png and b/en/device-dev/quick-start/figures/en-us_image_0000001114129426.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001114129427.png b/en/device-dev/quick-start/figures/en-us_image_0000001114129427.png new file mode 100644 index 0000000000000000000000000000000000000000..b4d11ba64f1f23a789167eabfc36f482fbc09697 Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001114129427.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001160649343.png b/en/device-dev/quick-start/figures/en-us_image_0000001160649343.png index 67d8044b72056d4ed6230ccc4ad99d5e954596b6..144950cb8cb1d260989d988242ca318ab584dfe6 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001160649343.png and b/en/device-dev/quick-start/figures/en-us_image_0000001160649343.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001160649344.png b/en/device-dev/quick-start/figures/en-us_image_0000001160649344.png new file mode 100644 index 0000000000000000000000000000000000000000..82edf61fc871cc83e073036ee2593b89dea5e5cb Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001160649344.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001177478136.png b/en/device-dev/quick-start/figures/en-us_image_0000001177478136.png index fcaf25e47e2e47ecad8aebe463aeccdf1d8bf85e..e83dad0b26392f009564d2e4014e374187ac1d7f 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001177478136.png and b/en/device-dev/quick-start/figures/en-us_image_0000001177478136.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001194504874.png b/en/device-dev/quick-start/figures/en-us_image_0000001194504874.png index fdd12932d3777bd30a208e539a78ede6384cce19..0ba155fce3a06f53d085a1309cc00e9710e3c58d 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001194504874.png and b/en/device-dev/quick-start/figures/en-us_image_0000001194504874.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001194821710.png b/en/device-dev/quick-start/figures/en-us_image_0000001194821710.png index 17d64a31a527a2b7453cc8490655609bd338ad7c..560240a18a081d50201d6185d25da46cc1c7a0eb 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001194821710.png and b/en/device-dev/quick-start/figures/en-us_image_0000001194821710.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001198566364.png b/en/device-dev/quick-start/figures/en-us_image_0000001198566364.png index 1ba77b7feaca23043e71171824cdead7c4f8f108..1fef79a0d9ab7d7862be1e108ae947cec5eb16d2 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001198566364.png and b/en/device-dev/quick-start/figures/en-us_image_0000001198566364.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001198566365.png b/en/device-dev/quick-start/figures/en-us_image_0000001198566365.png new file mode 100644 index 0000000000000000000000000000000000000000..5702f209752edc74d687e5e8ce7e210428f4551e Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001198566365.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001198722374.png b/en/device-dev/quick-start/figures/en-us_image_0000001198722374.png index c6507f28b980b84c65102aa844e93f806cb490a9..6914f2d806dc8a2a8a26a8265f60832686dc2902 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001198722374.png and b/en/device-dev/quick-start/figures/en-us_image_0000001198722374.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001198943768.png b/en/device-dev/quick-start/figures/en-us_image_0000001198943768.png index 5a709092da504fbb090ad8d44938e435712bc0eb..5702f209752edc74d687e5e8ce7e210428f4551e 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001198943768.png and b/en/device-dev/quick-start/figures/en-us_image_0000001198943768.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001220852753.png b/en/device-dev/quick-start/figures/en-us_image_0000001220852753.png new file mode 100644 index 0000000000000000000000000000000000000000..58d4e1027aefb6650920d9d31fbb622bebc4f726 Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001220852753.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001220852754.png b/en/device-dev/quick-start/figures/en-us_image_0000001220852754.png index c3013a3f9bd3951e53e1f0848c12700024c5f5e8..a316d0a2c4117a16143c79426523dbc75c8dd1a8 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001220852754.png and b/en/device-dev/quick-start/figures/en-us_image_0000001220852754.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001220852755.png b/en/device-dev/quick-start/figures/en-us_image_0000001220852755.png new file mode 100644 index 0000000000000000000000000000000000000000..884a8a0d8dfc1e14b3b2a256ede49bc88772c816 Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001220852755.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001221012767.png b/en/device-dev/quick-start/figures/en-us_image_0000001221012767.png new file mode 100644 index 0000000000000000000000000000000000000000..eead40cd3f889b23f73a6f02a9b7f44c822c2e37 Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001221012767.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001221012768.png b/en/device-dev/quick-start/figures/en-us_image_0000001221012768.png new file mode 100644 index 0000000000000000000000000000000000000000..d744afcd6c27ca674ae202bd4ca3511bb58bdbbc Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001221012768.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001221025048.png b/en/device-dev/quick-start/figures/en-us_image_0000001221025048.png index f17d2dd5dbc86b98a659218ed4a5e3a69409ae54..f0d3cfc874effae73aad01dd26961ef4946c8f81 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001221025048.png and b/en/device-dev/quick-start/figures/en-us_image_0000001221025048.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001221172710.png b/en/device-dev/quick-start/figures/en-us_image_0000001221172710.png index 29b22463c375704734e6925861551aa27ec7b295..cd6c3f1d8cea88d58a885446dad9cae3b74bce0b 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001221172710.png and b/en/device-dev/quick-start/figures/en-us_image_0000001221172710.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001221172711.png b/en/device-dev/quick-start/figures/en-us_image_0000001221172711.png new file mode 100644 index 0000000000000000000000000000000000000000..d1992b49a9805cd0823c98c2d6f1500a10c5f249 Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001221172711.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001221344980.png b/en/device-dev/quick-start/figures/en-us_image_0000001221344980.png index 7bf0acc41746926462ab3c352f143f90f2e65358..86501f030f57eea30b724f8b7d32736a8ddc7f21 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001221344980.png and b/en/device-dev/quick-start/figures/en-us_image_0000001221344980.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001221356692.png b/en/device-dev/quick-start/figures/en-us_image_0000001221356692.png index 8f5ee977c68bce18bed83887191ddf870df7d8e9..6d567bf69106c8bb266c7f7f445a317b5405c6a5 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001221356692.png and b/en/device-dev/quick-start/figures/en-us_image_0000001221356692.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001223190441.png b/en/device-dev/quick-start/figures/en-us_image_0000001223190441.png index 63d053122f3c7beaa990f63431ccb16692562535..c3c0811c65d83f3a88f158f1c3336c1a950f4e69 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001223190441.png and b/en/device-dev/quick-start/figures/en-us_image_0000001223190441.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001225760456.png b/en/device-dev/quick-start/figures/en-us_image_0000001225760456.png index 9e249959cad7e68b535f8732b44e20db9f6db2fc..61536a53597991971c997481624f1aedbc232c6d 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001225760456.png and b/en/device-dev/quick-start/figures/en-us_image_0000001225760456.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001227277128.png b/en/device-dev/quick-start/figures/en-us_image_0000001227277128.png index fd2a5588e6576449bcb9ec1f92a12649dcd6c5d0..df66ac7a87d293ae8500eae978fbe5bcbc23e214 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001227277128.png and b/en/device-dev/quick-start/figures/en-us_image_0000001227277128.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001227757036.png b/en/device-dev/quick-start/figures/en-us_image_0000001227757036.png index c354bdb69c0293fd19cb71905f828fca1fe7d09c..dea8677bfd7c9ba3f7b82f00c8422d695f85b86b 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001227757036.png and b/en/device-dev/quick-start/figures/en-us_image_0000001227757036.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001239661509.png b/en/device-dev/quick-start/figures/en-us_image_0000001239661509.png index c3f10040538814eccbecf2ef37d472d59743e08f..541920af4791d36a3ad8eb3e8ccf154dc947944a 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001239661509.png and b/en/device-dev/quick-start/figures/en-us_image_0000001239661509.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001243704061.png b/en/device-dev/quick-start/figures/en-us_image_0000001243704061.png index c93b7b610138e91c0b6b171cb515f540163e731b..f81b300b68edcc0400dcf72dfeb827fcf6ccaeea 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001243704061.png and b/en/device-dev/quick-start/figures/en-us_image_0000001243704061.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001265492885.png b/en/device-dev/quick-start/figures/en-us_image_0000001265492885.png index 7cc6ca102383151b5b67447332e73fc16c5ef85e..1fef79a0d9ab7d7862be1e108ae947cec5eb16d2 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001265492885.png and b/en/device-dev/quick-start/figures/en-us_image_0000001265492885.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001265505181.png b/en/device-dev/quick-start/figures/en-us_image_0000001265505181.png index eff6401bb39152c2d02b7f17e557b1cd5dbb0e87..da90fa7c0cd0da44ab6aff877eb8e11550dc7871 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001265505181.png and b/en/device-dev/quick-start/figures/en-us_image_0000001265505181.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001265652869.png b/en/device-dev/quick-start/figures/en-us_image_0000001265652869.png index 4c1ce174731a8e20b62d119cbe1728e9a8394176..fb6232380ebbc988a3b23dfec149daedd3f0c971 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001265652869.png and b/en/device-dev/quick-start/figures/en-us_image_0000001265652869.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001265665157.png b/en/device-dev/quick-start/figures/en-us_image_0000001265665157.png index 0a574b8ee51edd1f4049e5ca6821a9347a45c2de..56dabefba81dd9391d3bb5f52931bdbdc5753b22 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001265665157.png and b/en/device-dev/quick-start/figures/en-us_image_0000001265665157.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001265676877.png b/en/device-dev/quick-start/figures/en-us_image_0000001265676877.png index a87d8c651147e1b7cb1f3d60513a6b3139540399..f467c1b45f84730fd3fc45158004d9a03dec2551 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001265676877.png and b/en/device-dev/quick-start/figures/en-us_image_0000001265676877.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001265772913.png b/en/device-dev/quick-start/figures/en-us_image_0000001265772913.png index 659d732a4d044cfa4dacb84c5ec96bfc6b29707e..e5596ca2eac9b5d2cd1c96ffa50b1e390c68c904 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001265772913.png and b/en/device-dev/quick-start/figures/en-us_image_0000001265772913.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001265785209.png b/en/device-dev/quick-start/figures/en-us_image_0000001265785209.png index 0e5a65d7765d8bc936ca9a2d7db12f3adeffd831..1fef79a0d9ab7d7862be1e108ae947cec5eb16d2 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001265785209.png and b/en/device-dev/quick-start/figures/en-us_image_0000001265785209.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001265945173.png b/en/device-dev/quick-start/figures/en-us_image_0000001265945173.png index f2447dd8f49268594e781e1c68751b209e01894c..d6dbd5d63c55c135dd8121d4ca1b4d11d5438897 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001265945173.png and b/en/device-dev/quick-start/figures/en-us_image_0000001265945173.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001266887264.png b/en/device-dev/quick-start/figures/en-us_image_0000001266887264.png index f931e2cfba06791a3891248c5d8e6a9f0e86bf0e..e17047264d181b73e48e96a54c60517b57f42fb5 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001266887264.png and b/en/device-dev/quick-start/figures/en-us_image_0000001266887264.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001267532292.png b/en/device-dev/quick-start/figures/en-us_image_0000001267532292.png index 8ed1535a6bc23dc5bd02fbd5a3f1392f46ad8d83..db92b0181a48b56990633058e3a4efce7ca5be82 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001267532292.png and b/en/device-dev/quick-start/figures/en-us_image_0000001267532292.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001271237241.png b/en/device-dev/quick-start/figures/en-us_image_0000001271237241.png index caa9309b7f069597073ffa593a7fbc6820b4b2e9..0a150015345ea48708c486f21b76796f6e3ee36d 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001271237241.png and b/en/device-dev/quick-start/figures/en-us_image_0000001271237241.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001271237242.png b/en/device-dev/quick-start/figures/en-us_image_0000001271237242.png new file mode 100644 index 0000000000000000000000000000000000000000..9a300afbcd842f7c61877123236675efc422f039 Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001271237242.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001271442129.png b/en/device-dev/quick-start/figures/en-us_image_0000001271442129.png new file mode 100644 index 0000000000000000000000000000000000000000..8587b80f4fc5cb91cd18462b47053451947d4833 Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001271442129.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001271442261.png b/en/device-dev/quick-start/figures/en-us_image_0000001271442261.png index 4e14740a2906da609abea693b77a2680fa7054a2..8587b80f4fc5cb91cd18462b47053451947d4833 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001271442261.png and b/en/device-dev/quick-start/figures/en-us_image_0000001271442261.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001271448821.png b/en/device-dev/quick-start/figures/en-us_image_0000001271448821.png index 53cbcb8b0d0c30cb289b746d20b6c73927019d1a..0a150015345ea48708c486f21b76796f6e3ee36d 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001271448821.png and b/en/device-dev/quick-start/figures/en-us_image_0000001271448821.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001271477045.png b/en/device-dev/quick-start/figures/en-us_image_0000001271477045.png index c55a6ddd1aa319adfa05987ff3f5c79231e7208d..8581b9663ab1f1597166d9e5b668c4d70c273e01 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001271477045.png and b/en/device-dev/quick-start/figures/en-us_image_0000001271477045.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001275592884.png b/en/device-dev/quick-start/figures/en-us_image_0000001275592884.png new file mode 100644 index 0000000000000000000000000000000000000000..2186d2a5328684c1a479d4fca6b9fa74884c6a7b Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001275592884.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001276354454.png b/en/device-dev/quick-start/figures/en-us_image_0000001276354454.png new file mode 100644 index 0000000000000000000000000000000000000000..2419d79327a7a13df83fe637916b9abeb180a2b0 Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001276354454.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001278358765.png b/en/device-dev/quick-start/figures/en-us_image_0000001278358765.png index 96b251c58071d4203ff51f28317f378d6ec71ebb..3bb58a00550fb0a0e195eb7f4cdb9e80be1ac6ab 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001278358765.png and b/en/device-dev/quick-start/figures/en-us_image_0000001278358765.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001279425450.png b/en/device-dev/quick-start/figures/en-us_image_0000001279425450.png new file mode 100644 index 0000000000000000000000000000000000000000..fa3d1c40e18002a60a3c179b5e4e1396056a5b41 Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001279425450.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001279426717.png b/en/device-dev/quick-start/figures/en-us_image_0000001279426717.png index 53cbcb8b0d0c30cb289b746d20b6c73927019d1a..0a150015345ea48708c486f21b76796f6e3ee36d 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001279426717.png and b/en/device-dev/quick-start/figures/en-us_image_0000001279426717.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001279586409.png b/en/device-dev/quick-start/figures/en-us_image_0000001279586409.png new file mode 100644 index 0000000000000000000000000000000000000000..e1cfe8323c13c750a03c4d5c86f2c383e554485d Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001279586409.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001279587085.png b/en/device-dev/quick-start/figures/en-us_image_0000001279587085.png new file mode 100644 index 0000000000000000000000000000000000000000..084af8cfb40d4c59aa428890df7a1aee622a79d4 Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001279587085.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001280938208.png b/en/device-dev/quick-start/figures/en-us_image_0000001280938208.png new file mode 100644 index 0000000000000000000000000000000000000000..2e1c5ad3ffe3f4dcceeb78c33856c063aa506b43 Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001280938208.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001312778829.png b/en/device-dev/quick-start/figures/en-us_image_0000001312778829.png index 15791ccc963502062bd54537567db8876d9d7b63..eb1df60899dd8c41a61369410603d8f0adb77486 100644 Binary files a/en/device-dev/quick-start/figures/en-us_image_0000001312778829.png and b/en/device-dev/quick-start/figures/en-us_image_0000001312778829.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001322167645.png b/en/device-dev/quick-start/figures/en-us_image_0000001322167645.png new file mode 100644 index 0000000000000000000000000000000000000000..b2d394f1debbbcf714a401630370639014d46160 Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001322167645.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001326412233.png b/en/device-dev/quick-start/figures/en-us_image_0000001326412233.png new file mode 100644 index 0000000000000000000000000000000000000000..e31eef74e95c2ecbb8e62d4ad897a2188e66d186 Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001326412233.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001327429541.png b/en/device-dev/quick-start/figures/en-us_image_0000001327429541.png new file mode 100644 index 0000000000000000000000000000000000000000..cc19b0a8e8f97ec07b29eab8b01f387c5c81903c Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001327429541.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001333642545.png b/en/device-dev/quick-start/figures/en-us_image_0000001333642545.png new file mode 100644 index 0000000000000000000000000000000000000000..2186d2a5328684c1a479d4fca6b9fa74884c6a7b Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001333642545.png differ diff --git a/en/device-dev/quick-start/figures/en-us_image_0000001333802045.png b/en/device-dev/quick-start/figures/en-us_image_0000001333802045.png new file mode 100644 index 0000000000000000000000000000000000000000..1fef79a0d9ab7d7862be1e108ae947cec5eb16d2 Binary files /dev/null and b/en/device-dev/quick-start/figures/en-us_image_0000001333802045.png differ diff --git a/en/device-dev/subsystems/subsys-build-mini-lite.md b/en/device-dev/subsystems/subsys-build-mini-lite.md index 2f82037899cd8d74fe2388b3c34b1f0137a032e9..5edca2ba8449a7001b207a3bc802bf9a29813471 100644 --- a/en/device-dev/subsystems/subsys-build-mini-lite.md +++ b/en/device-dev/subsystems/subsys-build-mini-lite.md @@ -253,7 +253,7 @@ vendor └── ... ``` -> ![icon-caution.gif](/public_sys-resources/icon-caution.gif) **CAUTION**
+> ![icon-caution.gif](../public_sys-resources/icon-caution.gif) **CAUTION**
> Follow the preceding rules to create directories and files for new products. The Compilation and Building subsystem scans the configured products based on the rules. The key directories and files are described as follows: diff --git a/en/readme/DeviceProfile.md b/en/readme/DeviceProfile.md index 0fe6134cbcb337c7e1dff1c111e98ab44e628f47..d1e4fdc0bfbc4ff5da9f219e52f2c60ac6dbd2d1 100644 --- a/en/readme/DeviceProfile.md +++ b/en/readme/DeviceProfile.md @@ -171,14 +171,13 @@ subscribeInfos.emplace_back(info2); std::list failedEvents; // Call SubscribeProfileEvents. -DistributedDeviceProfileClient::GetInstance().SubscribeProfileEvents(subscribeInfos, - callback, failedEvents); +DistributedDeviceProfileClient::GetInstance().SubscribeProfileEvents(subscribeInfos, callback, failedEvents); sleep(SUBSCRIBE_SLEEP_TIME); std::list profileEvents; profileEvents.emplace_back(ProfileEvent::EVENT_PROFILE_CHANGED); failedEvents.clear(); // Cancel the subscription. -DistributedDeviceProfileClient::GetInstance().UnsubscribeProfileEvents(profileEvents, +DistributedDeviceProfileClient::GetInstance().UnsubscribeProfileEvents(profileEvents, callback, failedEvents); callback, failedEvents); ``` diff --git a/en/release-notes/OpenHarmony-v3.1.1-release.md b/en/release-notes/OpenHarmony-v3.1.1-release.md index 81a705cb5ab619bb9bf1163077f96bfa96b6bcd7..bcff1ffc13392f7b2e563b7e97e679a6e048bee7 100644 --- a/en/release-notes/OpenHarmony-v3.1.1-release.md +++ b/en/release-notes/OpenHarmony-v3.1.1-release.md @@ -21,7 +21,7 @@ Distributed data management is now compatible with the **\@system.storage** APIs Bundle management supports application-specific installation status query. The common event and notification subsystem provides APIs for sending and canceling notifications. -The Feature Ability (FA) model supports ability-level screen orientation query and setting, lock screen display, and screen-on during ability startup. DFX features, such as Application Not Response (ANR) and suspension detection for an application's main thread, are added. More basic capabilities are added for FA widgets. +The Feature Ability (FA) model supports ability-level screen orientation query and setting, lock screen display, and screen-on during ability startup. DFX features, such as Application Not Response and suspension detection for an application's main thread, are added. More basic capabilities are added for FA widgets. **Enhanced application capabilities for the standard system** @@ -32,12 +32,13 @@ The Contacts application allows third-party applications to invoke the system ca **Table 1** Version mapping of software and tools -| Software/Tool| Version| Remarks| +| Software/Tool| Version| Remarks| | -------- | -------- | -------- | -| OpenHarmony | 3.1.1 Release | NA | -| SDK | Ohos_sdk_full 3.1.6.5 (API Version 8 Release) | NA | -| (Optional) HUAWEI DevEco Studio| 3.0 Beta3 for OpenHarmony | Recommended for developing OpenHarmony applications| -| (Optional) HUAWEI DevEco Device Tool| 3.0 Release | Recommended for developing OpenHarmony devices| +| OpenHarmony | 3.1.1 Release | NA | +| Public SDK | Ohos_sdk_public 3.1.6.6 (API Version 8 Release)| This toolkit is intended for application developers and does not contain system APIs that require system permissions.
It is provided as standard in DevEco Studio 3.0 Beta4 or later.
The public SDK of API version 8 was released on July 6, 2022.| +| Full SDK | Ohos_sdk_full 3.1.6.5 (API Version 8 Release) | This toolkit is intended for original equipment manufacturers (OEMs) and contains system APIs that require system permissions.
To use the full SDK, manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](../application-dev/quick-start/full-sdk-switch-guide.md).| +| (Optional) HUAWEI DevEco Studio| 3.0 Beta3 for OpenHarmony | This tool is recommended for developing OpenHarmony applications.| +| (Optional) HUAWEI DevEco Device Tool| 3.0 Release | This tool is recommended for developing OpenHarmony smart devices.| ## Source Code Acquisition @@ -101,8 +102,10 @@ repo forall -c 'git lfs pull' | Hi3861 mini system solution (binary) | 3.1.1 Release | [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_pegasus.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_pegasus.tar.gz.sha256) | | Hi3516 mini system solution - LiteOS (binary)| 3.1.1 Release | [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus.tar.gz.sha256) | | Hi3516 mini system solution - Linux (binary) | 3.1.1 Release | [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus_linux.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/hispark_taurus_linux.tar.gz.sha256) | -| Standard system SDK package (macOS) | 3.1.1 Release | [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-full.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-full.tar.gz.sha256)| -| Standard system SDK package (Windows/Linux) | 3.1.1 Release | [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-full.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-full.tar.gz.sha256)| +| Full SDK package for the standard system (macOS) | 3.1.1 Release | [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-full.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-full.tar.gz.sha256)| +| Full SDK package for the standard system (Windows/Linux) | 3.1.1 Release | [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-full.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-full.tar.gz.sha256)| +| Public SDK package for the standard system (macOS)| 3.1.1 Release | [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-public.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-mac-public.tar.gz.sha256)| +| Public SDK package for the standard system (Windows/Linux)| 3.1.1 Release | [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-public.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.1.1/ohos-sdk-public.tar.gz.sha256)| ## What's New @@ -114,21 +117,22 @@ This version has the following updates to OpenHarmony 3.1 Release. **Table 3** New and enhanced features - | Subsystem| Standard System| Mini and Small Systems| +| Subsystem| Standard System| Mini and Small Systems| | -------- | -------- | -------- | -| System service management| Added group verification.
The following requirement is involved:
I52G5Q Adding group verification| NA | -| Power management| Added the APIs for brightness adjustment and battery information query.
The following requirements are involved:
I526UP Supporting the **\@system.brightness** APIs
I526UP Supporting the **\@system.battery** APIs| NA | -| Bundle management| Added the APIs for querying whether a specified application is installed.
The following requirements are involved:
I56EWD Test framework configuration
I55RZJ Querying whether a specified application is installed| NA | -| Location service| Added compatibility with basic positioning APIs.
The following requirement is involved:
I53WFP Basic positioning capabilities and system APIs| NA | -| Ability| Added the following features to the FA model: ability-level screen orientation query and setting, lock screen display, and screen-on upon startup.
The following requirements are involved:
I56EH7 Querying and setting the landscape/portrait mode for an ability in the FA model
I50D5Y Lock screen display for an ability in the FA model
I56EH7 Screen-on during ability startup in the FA model
I55WB0 Carrying images in widget data
I55WB0 FA widget capability supplement - formManager reconstruction
I55WB0 FA widget capability supplement - widget status query
I55WB0 FA widget capability supplement - deleting invalid widgets
I55WB0 FA widget capability supplement - separate setting of the visibility and update status of widgets
I50D8H Interception of uncatched exceptions
I50D91 ANR processing| NA | -| Media| Added APIs related to audio focus and audio decoding.
The following requirements are involved:
I56REO Supplementing audio focus/device APIs
I522W0 AMR audio encoding| NA | -| Window manager| Added support for setting window properties.
The following requirement is involved:
I56EH7 Window property setting| NA | -| Network management| Added support for WebSocket and fetch APIs and Ethernet connections.
The following requirements are involved:
I53CKH Supporting the **\@system.fetch** APIs
I53CJX Supporting the **\@system.network** APIs
I53CKT WebSocket support
I580PC Ethernet connections| NA | -| Misc services| Added compatibility with HTTP file download APIs.
The following requirement is involved:
I56Q4X Supporting file download APIs| NA | -| Common event and notification| Added the APIs for sending and canceling notifications.
The following requirements are involved:
I50EEW APIs for sending and canceling notifications| NA | -| Distributed data management| Added compatibility with the **\@system.storage** APIs.
The following requirement is involved:
I56RF3 Supporting the **\@system.storage** APIs| NA | -| Startup| Added compatibility with the **\@system.device** APIs.
The following requirement is involved:
I56GBS Supporting the **\@system.device** APIs| NA | -| System applications| The Contacts application allows third-party applications to invoke the system call capability.
The following requirements are involved:
I58ZQ4 The Contacts application allows third-party applications to invoke the system call capability.| NA | +| SDK | SDKs are classified into full SDKs and public SDKs.
Note: The public SDK of API version 8 was released on July 6, 2022.| NA | +| System service management| Added group verification.
The following requirement is involved:
I52G5Q Adding group verification| NA | +| Power management| Added the APIs for brightness adjustment and battery information query.
The following requirements are involved:
I526UP Supporting the **\@system.brightness** APIs
I526UP Supporting the **\@system.battery** APIs| NA | +| Bundle management| Added the APIs for querying whether a specified application is installed.
The following requirements are involved:
I56EWD Test framework configuration
I55RZJ Querying whether a specified application is installed| NA | +| Location service| Added compatibility with basic positioning APIs.
The following requirement is involved:
I53WFP Basic positioning capabilities and system APIs| NA | +| Ability| Added the following features to the FA model: ability-level screen orientation query and setting, lock screen display, and screen-on upon startup.
The following requirements are involved:
I56EH7 Querying and setting the landscape/portrait mode for an ability in the FA model
I50D5Y Lock screen display for an ability in the FA model
I56EH7 Screen-on during ability startup in the FA model
I55WB0 Carrying images in widget data
I55WB0 FA widget capability supplement - formManager reconstruction
I55WB0 FA widget capability supplement - widget status query
I55WB0 FA widget capability supplement - deleting invalid widgets
I55WB0 FA widget capability supplement - separate setting of the visibility and update status of widgets
I50D8H Interception of uncatched exceptions
I50D91 Application Not Response processing| NA | +| Media| Added APIs related to audio focus and audio decoding.
The following requirements are involved:
I56REO Supplementing audio focus/device APIs
I522W0 AMR audio encoding| NA | +| Window manager| Added support for setting window properties.
The following requirement is involved:
I56EH7 Window property setting| NA | +| Network management| Added support for WebSocket and fetch APIs and Ethernet connections.
The following requirements are involved:
I53CKH Supporting the **\@system.fetch** APIs
I53CJX Supporting the **\@system.network** APIs
I53CKT WebSocket support
I580PC Ethernet connections| NA | +| Misc services| Added compatibility with HTTP file download APIs.
The following requirement is involved:
I56Q4X Supporting file download APIs| NA | +| Common event and notification| Added the APIs for sending and canceling notifications.
The following requirements are involved:
I50EEW APIs for sending and canceling notifications| NA | +| Distributed data management| Added compatibility with the **\@system.storage** APIs.
The following requirement is involved:
I56RF3 Supporting the **\@system.storage** APIs| NA | +| Startup| Added compatibility with the **\@system.device** APIs.
The following requirement is involved:
I56GBS Supporting the **\@system.device** APIs| NA | +| System applications| The Contacts application allows third-party applications to invoke the system call capability.
The following requirements are involved:
I58ZQ4 The Contacts application allows third-party applications to invoke the system call capability.| NA | ### API Updates @@ -159,4 +163,4 @@ For details about the adaptation status, see [SIG-Devboard](https://gitee.com/op | ------------------------------------------------------------ | ---------------------------------------------------------- | ------------------------------------------------- | ------------ | | [I4Z3G9](https://gitee.com/openharmony/graphic_graphic_2d/issues/I4Z3G9) | [RK3568] Screen flickering occurs when the secondary window is opened in the immersive primary window.| Developer experience is affected. | 2022-06-15 | | [I58GFY](https://gitee.com/openharmony/communication_wifi/issues/I58GFY) | [RK3568] On the 2.4 GHz and 5 GHz frequency bands, connections fail in WPA+TKIP/AES encryption mode. | The TP-Link AX50 router cannot connect to the Wi-Fi network. | 2022-06-30 | -| [I59P32](https://gitee.com/openharmony/device_manager/issues/I59P32) | [RK3568] After the trust period of a device expires, PIN authentication cannot be performed. | This issue occurs when the timer waiting for the PIN code input times out. It can be resolved by restarting the device.| 2022-06-15 | +| [I59P32](https://gitee.com/openharmony/distributedhardware_device_manager/issues/I59P32) | [RK3568] After the trust period of a device expires, PIN authentication cannot be performed. | This issue occurs when the timer waiting for the PIN code input times out. It can be resolved by restarting the device.| 2022-06-15 | diff --git a/en/release-notes/api-change/v3.2-beta/js-apidiff-distributedschedule.md b/en/release-notes/api-change/v3.2-beta/js-apidiff-distributedschedule.md new file mode 100644 index 0000000000000000000000000000000000000000..d07a990a8e198a5f02adff1e3ad68960713eedb3 --- /dev/null +++ b/en/release-notes/api-change/v3.2-beta/js-apidiff-distributedschedule.md @@ -0,0 +1,16 @@ +# JS API Changes of the Distributed Scheduler Subsystem + +The table below lists the APIs changes of the distributed scheduler subsystem in OpenHarmony 3.2 Beta1 over OpenHarmony 3.1 Release. + +## API Changes + +| Module| Class| Method/Attribute/Enumeration/Constant| Change Type| +|---|---|---|---| +| ohos.continuation.continuationManager | continuationManager | on(type: "deviceConnect", token: number, callback: Callback\>): void; | Added| +| ohos.continuation.continuationManager | continuationManager | off(type: "deviceConnect", token: number): void; | Added| +| ohos.continuation.continuationManager | continuationManager | on(type: "deviceDisconnect", token: number, callback: Callback\>): void; | Added| +| ohos.continuation.continuationManager | continuationManager | off(type: "deviceDisconnect", token: number): void; | Added| +| ohos.continuation.continuationManager | continuationManager | on(type: "deviceConnect", callback: Callback\): void; | Deprecated| +| ohos.continuation.continuationManager | continuationManager | off(type: "deviceConnect", callback?: Callback\): void; | Deprecated| +| ohos.continuation.continuationManager | continuationManager | on(type: "deviceDisconnect", callback: Callback\): void; | Deprecated| +| ohos.continuation.continuationManager | continuationManager | off(type: "deviceDisconnect", callback?: Callback\): void; | Deprecated| diff --git a/zh-cn/OpenHarmony-Overview_zh.md b/zh-cn/OpenHarmony-Overview_zh.md index 58b0decc177a08cf3afb2073874ded39ab24ca0f..d1e7d2846472ee5b603c6b576560b8ba4afe2ac9 100644 --- a/zh-cn/OpenHarmony-Overview_zh.md +++ b/zh-cn/OpenHarmony-Overview_zh.md @@ -146,13 +146,13 @@ OpenHarmony支持如下几种系统类型: ## 支持的开发板 -当前OpenHarmony社区支持17款开发板,下表介绍3款(此处选择三种系统类型首款进入OpenHarmony主干的开发板),更多开发板信息,请参考[社区支持的开发板清单](device-dev/dev-board-on-the-master.md)。 +当前OpenHarmony社区支持17款开发板,下表介绍3款(此处选择三种系统类型首款进入OpenHarmony主干的开发板),更多开发板信息,请参考[社区支持的开发板清单](device-dev/dev-board-on-the-master.md),社区每日构建版本获取地址请参考http://ci.openharmony.cn/dailys/dailybuilds -| 系统类型 | 开发板型号 | 芯片型号 | 主要能力及适配案例 | 典型应用场景 | 开发板代码仓及社区每日构建版本获取地址 | -| -------- | -------- | -------- | -------- | -------- | -------- | -| 标准系统 | 润和DAYU200 | RK3568 | 主要能力:
润和HH-SCDAYU200基于Rockchip RK3568,集成双核心架构GPU以及高效能NPU;板载四核64位Cortex-A55 处理器采用22nm先进工艺,主频高达2.0GHz;支持蓝牙、Wi-Fi、音频、视频和摄像头等功能,拥有丰富的扩展接口,支持多种视频输入输出接口;配置双千兆自适应RJ45以太网口,可满足NVR、工业网关等多网口产品需求。
适配案例:
[DAYU200适配案例](device-dev/porting/porting-dayu200-on_standard-demo.md) | 影音娱乐、智慧出行、智能家居,如烟机、烤箱、跑步机等。 | 代码仓:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | -| 小型系统 | Hispark_Taurus | Hi3516DV300 | 主要能力:
Hi3516DV300是新一代Smart HD IP摄像机SOC,集成新一代ISP(Image Signal Processor)、H.265视频压缩编码器、高性能NNIE引擎,在低码率、高画质、智能处理和分析、低功耗等方面有较好的性能。 | 带屏智能硬件,比如带屏冰箱、车机等。 | 代码仓:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](https://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | -| 轻量系统 | Multi-modal V200Z-R | BES2600 | 主要能力:
Multi-modal V200Z-R开发板是基于恒玄科技BES2600WM芯片的一款高性能、多功能、高性价比AIoT SoC开发板Multi-modal V200Z-R开发板,单模组集成四核ARM处理器(最高主频1GHz),集成双频WiFi + 双模蓝牙,支持标准的802.11 a/b/g/n/协议,支持BT/BLE 5.2协议,内建多种容量的RAM(最大42MB)和Flash(最大32MB),支持MIPI DSI及CSI,适用于各种AIoT多模态VUI + GUI交互硬件场景。
适配案例:
[Multi-modal V200Z-R适配案例](device-dev/porting/porting-bes2600w-on-minisystem-display-demo.md) | 智能硬件、带屏类模组产品,如音箱、手表等。 | 代码仓:
[device_soc_bestechnic](https://gitee.com/openharmony/device_soc_bestechnic)
[device_board_fnlink](https://gitee.com/openharmony/device_board_fnlink)
[vendor_bestechnic](https://gitee.com/openharmony/vendor_bestechnic)
社区每日构建版本获取地址:
http://ci.openharmony.cn/dailys/dailybuilds | + |系统类型 | 开发板型号| 芯片型号 | 主要能力及适配案例 | 典型应用场景 | 开发板代码仓| + |-------- | --------| --------| --------| -------- | -------- | + |标准系统 | 润和DAYU200 | RK3568 | 主要能力:
润和HH-SCDAYU200
基于
Rockchip RK3568,集成双
核心架构GPU以及高效能NPU;板
载四核64位Cortex-A55 处
理器采用22nm先进工艺,主频高
达2.0GHz;支持蓝牙、Wi-Fi、
音频、视频和摄像头等功能,拥
有丰富的扩展接口,支持多种视
频输入输出接口;配置双千兆自
适应RJ45以太网口,可满足
NVR
、工业网关等多网口产
品需求。
适配案例:
[DAYU200适配案例](device-dev/porting/porting-dayu200-on_standard-demo.md) | 影音娱乐、智慧
出行、智
能家居,
如烟机、
烤箱、跑
步机等。 | [device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope)
| + |小型系统 | Hispark_
Taurus | Hi3516DV
300 | 主要能力:
Hi3516DV300是新一
代Smart HD IP摄像
机SOC,集成新一代
ISP(Image Signal P
rocessor)、H.265视频压缩编码
器、高性能NNIE引擎,在低码率
、高画质、智能处理和分析、低
功耗等方面有较好的性能。 | 带屏智能硬件,
比如带屏
冰箱、车
机等。 | [device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](http://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon)
| + |轻量系统 | Multi-modal
V200Z-R | BES2600 | 主要能力:
Multi-
modal V200Z-R开发板是基
于恒玄科技BES2600WM芯片的一
款高性能、多功能、高性价比
AIoT SoC开发板Multi-
modal V200Z-R开发板,单
模组集成四核ARM处理器(最高
主频1GHz),集成双频
WiFi + 双模蓝牙,
支持标准的
802.11 a/b/g/n/协议,支
持BT/BLE 5.2协议,内建
多种容量的RAM(最大42MB)和
Flash(最大32MB),支持
MIPI DSI及CSI,适用于各
种AIoT多模态
VUI + GUI交互硬件
场景。
适配案例:
[Multi-modal V200Z-R适配案例](device-dev/porting/porting-bes2600w-on-minisystem-display-demo.md) | 智能硬件、带屏
类模组产
品,如音
箱、手表
等。 | [device_soc_bestechnic](https://gitee.com/openharmony/device_soc_bestechnic)
[device_board_fnlink](https://gitee.com/openharmony/device_board_fnlink)
[vendor_bestechnic](https://gitee.com/openharmony/vendor_bestechnic)
| ## 快速入门 diff --git a/zh-cn/application-dev/Readme-CN.md b/zh-cn/application-dev/Readme-CN.md index e8f1da2349491f92660dd4ca5146d6e7a84a7ab0..19b9ca337e53338101d7d995f08865062ed8b290 100644 --- a/zh-cn/application-dev/Readme-CN.md +++ b/zh-cn/application-dev/Readme-CN.md @@ -8,10 +8,9 @@ - 快速开始 - 快速入门 - [开发准备](quick-start/start-overview.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) + - [使用eTS语言开发(Stage模型)](quick-start/start-with-ets-stage.md) + - [使用eTS语言开发(FA模型)](quick-start/start-with-ets-fa.md) + - [使用JS语言开发(FA模型)](quick-start/start-with-js-fa.md) - 开发基础知识 - [应用包结构说明(FA模型)](quick-start/package-structure.md) - [应用包结构说明(Stage模型)](quick-start/stage-structure.md) diff --git a/zh-cn/application-dev/ability/stage-ability.md b/zh-cn/application-dev/ability/stage-ability.md index fc43d7b00c5d1a68fa67c98bd5988c65cb4bb001..061faac68db96402e30ad0cf89b1d1136c9c5660 100644 --- a/zh-cn/application-dev/ability/stage-ability.md +++ b/zh-cn/application-dev/ability/stage-ability.md @@ -72,7 +72,7 @@ Ability功能如下(Ability类,具体的API详见[接口文档](../reference ``` 4. 实现Ability生命周期接口。 - 在`onWindowStageCreate(windowStage)`中通过loadContent接口设置应用要加载的页面,window接口的使用详见[窗口开发指导](../windowmanager/window-guidelines.md)。 + 在`onWindowStageCreate(windowStage)`中通过loadContent接口设置应用要加载的页面,window接口的使用详见[窗口开发指导](../windowmanager/application-window-stage.md)。 ```ts export default class MainAbility extends Ability { onCreate(want, launchParam) { diff --git a/zh-cn/application-dev/database/database-distributedobject-guidelines.md b/zh-cn/application-dev/database/database-distributedobject-guidelines.md index dac9fb45126a7f3b3dce8f9ee0cc194ec625ff93..b0e4d49ad058984fb57ad4ec5bb7a8c6ae1ae41d 100644 --- a/zh-cn/application-dev/database/database-distributedobject-guidelines.md +++ b/zh-cn/application-dev/database/database-distributedobject-guidelines.md @@ -130,7 +130,7 @@ ```js //发起方 var local_object = distributedObject.createDistributedObject({name:"jack", age:18, isVis:true, - parent:{mother:"jack mom",father:"jack Dad"},list:[{mother:"jack mom"}, {father:"jack Dad"}]}); + parent:{mother:"jack mom", father:"jack Dad"}, list:[{mother:"jack mom"}, {father:"jack Dad"}]}); local_object.setSessionId(sessionId); //被拉起方 @@ -166,7 +166,7 @@ local_object.name = "jack"; local_object.age = 19; local_object.isVis = false; - local_object.parent = {mother:"jack mom",father:"jack Dad"}; + local_object.parent = {mother:"jack mom", father:"jack Dad"}; local_object.list = [{mother:"jack mom"}, {father:"jack Dad"}]; ``` @@ -210,14 +210,14 @@ ```js // 保存数据对象 - local_object.save("local", (result, data)=>{ + local_object.save("local", (result, data) => { console.log("save callback"); console.info("save sessionId " + data.sessionId); console.info("save version " + data.version); console.info("save deviceId " + data.deviceId); }); // 撤回保存的数据对象 - local_object.revokeSave((result, data) =>{ + local_object.revokeSave((result, data) => { console.log("revokeSave callback"); console.info("revokeSave sessionId " + data.sessionId); }); @@ -225,7 +225,7 @@ 2.Promise方式 ```js // 保存数据对象 - g_object.save("local").then((result)=>{ + g_object.save("local").then((result) => { console.info("save sessionId " + result.sessionId); console.info("save version " + result.version); console.info("save deviceId " + result.deviceId); @@ -233,7 +233,7 @@ console.info("save local failed."); }); // 撤回保存的数据对象 - g_object.revokeSave().then((result)=>{ + g_object.revokeSave().then((result) => { console.info("revokeSave success."); }, (result)=>{ console.info("revokeSave failed."); diff --git a/zh-cn/application-dev/database/database-relational-guidelines.md b/zh-cn/application-dev/database/database-relational-guidelines.md index 785a513f5bc434892d88b3f75b5f5c2491f07b6b..26df601aaf7dfcff5ff6fc1bce3a06640529c5b9 100644 --- a/zh-cn/application-dev/database/database-relational-guidelines.md +++ b/zh-cn/application-dev/database/database-relational-guidelines.md @@ -288,9 +288,9 @@ ```js "requestPermissions": - { - "name": "ohos.permission.DISTRIBUTED_DATASYNC" - } + { + "name": "ohos.permission.DISTRIBUTED_DATASYNC" + } ``` (2) 获取应用权限。 @@ -331,7 +331,7 @@ promise.then((result) => { console.log('sync done.') for (let i = 0; i < result.length; i++) { - console.log('device=' + result[i][0] + ' status=' + result[i][1]) + console.log('device=' + result[i][0] + 'status=' + result[i][1]) } }).catch((err) => { console.log('sync failed') @@ -349,7 +349,7 @@ ```js function storeObserver(devices) { for (let i = 0; i < devices.length; i++) { - console.log('device=' + device[i] + ' data changed') + console.log('device=' + device[i] + 'data changed') } } try { @@ -382,17 +382,17 @@ ```js let promiseBackup = rdbStore.backup("dbBackup.db") - promiseBackup.then(()=>{ + promiseBackup.then(() => { console.info('Backup success.') - }).catch((err)=>{ + }).catch((err) => { console.info('Backup failed, err: ' + err) }) ``` ```js let promiseRestore = rdbStore.restore("dbBackup.db") - promiseRestore.then(()=>{ + promiseRestore.then(() => { console.info('Restore success.') - }).catch((err)=>{ + }).catch((err) => { console.info('Restore failed, err: ' + err) }) ``` diff --git a/zh-cn/application-dev/device/sensor-guidelines.md b/zh-cn/application-dev/device/sensor-guidelines.md index 6259723f5680f363646aca21d9341c6a22435622..8ffc74e20dea5ce602b497d67405ed87312ccf87 100644 --- a/zh-cn/application-dev/device/sensor-guidelines.md +++ b/zh-cn/application-dev/device/sensor-guidelines.md @@ -87,7 +87,7 @@ ``` import sensor from "@ohos.sensor" sensor.on(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data){ - console.info("Subscription succeeded. data = " + data);//调用成功,打印对应传感器的数据 + console.info("Subscription succeeded. data = " + data);// 调用成功,打印对应传感器的数据 } ); ``` @@ -101,7 +101,7 @@ ``` import sensor from "@ohos.sensor" sensor.off(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function() { - console.info("Succeeded in unsubscribing from acceleration sensor data.");//注销成功,返回打印结果 + console.info("Succeeded in unsubscribing from acceleration sensor data.");// 注销成功,返回打印结果 } ); ``` @@ -115,7 +115,7 @@ ``` import sensor from "@ohos.sensor" sensor.once(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data) { - console.info("Data obtained successfully. data=" + data);//获取数据成功,打印对应传感器的数据 + console.info("Data obtained successfully. data=" + data);// 获取数据成功,打印对应传感器的数据 } ); ``` @@ -129,7 +129,7 @@ ``` try { sensor.once(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data) { - console.info("Data obtained successfully. data=" + data);//获取数据成功,打印对应传感器的数据 + console.info("Data obtained successfully. data=" + data);// 获取数据成功,打印对应传感器的数据 }); } catch (error) { console.error(error); diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/cases.md b/zh-cn/application-dev/key-features/multi-device-app-dev/cases.md deleted file mode 100644 index cf634a1e5c8f4ec793c48d6e7621ec4c18f01160..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/key-features/multi-device-app-dev/cases.md +++ /dev/null @@ -1,9 +0,0 @@ -# 案例应用 - - -本章将从OpenHarmony预置的系统应用中,选择一些较为典型的案例,从页面开发和工程结构的角度,介绍"一多"的具体实践。OpenHarmony的产品形态在不断丰富中,当前主要有默认设备和平板两种产品形态,本章的具体实践也将围绕这两种产品形态展开。 - - -- **[短信应用](sms-intro.md)** - -- **[桌面应用](cases-home-screen.md)** \ No newline at end of file diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/interaction-events-unification.md b/zh-cn/application-dev/key-features/multi-device-app-dev/interaction-events-unification.md index de8757da2e44363a30aa616132fbb78fd77ef031..20e03164ee6e4865b3caac476d04e88a5a30fec3 100644 --- a/zh-cn/application-dev/key-features/multi-device-app-dev/interaction-events-unification.md +++ b/zh-cn/application-dev/key-features/multi-device-app-dev/interaction-events-unification.md @@ -42,7 +42,7 @@ 一个完整的拖拽事件,包含多个拖拽子事件,如下表所示(请访问拖拽事件了解详细用法)。当前触控屏和鼠标的拖拽事件已经实现”交互归一”,对触控屏的支持正在开发中。 - | 名称 | 功能描述 | +| 名称 | 功能描述 | | -------- | -------- | | onDragStart | 绑定A组件,触控屏长按/鼠标左键按下后移动触发 | | onDragEnter | 绑定B组件,触控屏手指、鼠标移动进入B组件瞬间触发 | diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/page-development.md b/zh-cn/application-dev/key-features/multi-device-app-dev/page-development.md deleted file mode 100644 index 876cb0ac1b64b0642a34b48618548b80959814c2..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/key-features/multi-device-app-dev/page-development.md +++ /dev/null @@ -1,13 +0,0 @@ -# 一多能力的页面开发介绍 - - -本章介绍如何使用方舟开发框架"一多"能力,开发出在多设备上正常显示的页面。方舟开发框架更推荐开发者使用声明式开发范式开发应用,故本章的内容和示例都基于声明式开发范式,所有示例代码均可以从[码云开源代码仓](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/AdaptiveCapabilities)中获取。 - - -- **[布局能力](layout-intro.md)** - -- **[交互归一](interaction-events-unification.md)** - -- **[多态组件](polymorphic-components.md)** - -- **[资源使用](resource-usage.md)** \ No newline at end of file diff --git a/zh-cn/application-dev/media/Readme-CN.md b/zh-cn/application-dev/media/Readme-CN.md index 4ff544ab9d076efd6ca9ad5cd3a6ed2157b227dc..d0793ffdd3396a75f81a3af585dd59d865078e3f 100755 --- a/zh-cn/application-dev/media/Readme-CN.md +++ b/zh-cn/application-dev/media/Readme-CN.md @@ -5,6 +5,7 @@ - [音频播放开发指导](audio-playback.md) - [音频录制开发指导](audio-recorder.md) - [音频渲染开发指导](audio-renderer.md) + - [音频流管理开发指导](audio-stream-manager.md) - [音频采集开发指导](audio-capturer.md) - [OpenSL ES播放开发指导](opensles-playback.md) - [OpenSL ES录音开发指导](opensles-capture.md) diff --git a/zh-cn/application-dev/media/audio-interruptmode.md b/zh-cn/application-dev/media/audio-interruptmode.md index 6bd6386ab04a6f2894df3e4619b780e8078e4a5a..897fa18ec4091959fc8883d637d53f14c7b9e8b8 100644 --- a/zh-cn/application-dev/media/audio-interruptmode.md +++ b/zh-cn/application-dev/media/audio-interruptmode.md @@ -48,7 +48,7 @@ ```js var mode_ = audio.InterruptMode.SHARE_MODE; - await this.audioRenderer.setInterruptMode(mode_).then(()=>{ + await this.audioRenderer.setInterruptMode(mode_).then(() => { console.log('[JSAR] [SetInterruptMode] 设置: ' + (mode_ == 0 ? "共享模式":"独立焦点模式") + "成功" ); }); ``` diff --git a/zh-cn/application-dev/media/audio-playback.md b/zh-cn/application-dev/media/audio-playback.md index d5fb8cf6df69f69998a10337f57437f0d2f33947..6313ac85397e94b8e26c955ff647fc2d5c6208f3 100644 --- a/zh-cn/application-dev/media/audio-playback.md +++ b/zh-cn/application-dev/media/audio-playback.md @@ -193,12 +193,12 @@ export class AudioDemo { }).catch((err) => { console.info('open fd failed err is' + err); }); - audioPlayer.src = nextFdPath; //设置src属性,并重新触发触发'dataLoad'事件回调 + audioPlayer.src = nextFdPath; // 设置src属性,并重新触发触发'dataLoad'事件回调 } async audioPlayerDemo() { - let audioPlayer = media.createAudioPlayer(); //创建一个音频播放实例 - this.setCallBack(audioPlayer); //设置事件回调 + let audioPlayer = media.createAudioPlayer(); // 创建一个音频播放实例 + this.setCallBack(audioPlayer); // 设置事件回调 let fdPath = 'fd://' // path路径的码流可通过"hdc file send D:\xxx\01.mp3 /data/app/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile" 命令,将其推送到设备上 let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile/01.mp3'; @@ -210,7 +210,7 @@ export class AudioDemo { }).catch((err) => { console.info('open fd failed err is' + err); }); - audioPlayer.src = fdPath; //设置src属性,并触发'dataLoad'事件回调 + audioPlayer.src = fdPath; // 设置src属性,并触发'dataLoad'事件回调 } } ``` diff --git a/zh-cn/application-dev/media/audio-stream-manager.md b/zh-cn/application-dev/media/audio-stream-manager.md new file mode 100644 index 0000000000000000000000000000000000000000..19602da3f2b02f21fa29742ac6a7f5425ec386b4 --- /dev/null +++ b/zh-cn/application-dev/media/audio-stream-manager.md @@ -0,0 +1,158 @@ +# 音频流管理开发指导 + +## 场景介绍 + +AudioStreamManager提供了音频流管理的方法。开发者可以通过本指导了解应用如何通过AudioStreamManager管理音频流。 + +### 工作流程 + +在进行应用开发的过程中,开发者需要使用getStreamManager()创建一个AudioStreamManager实例,进而通过该实例管理音频流。开发者可通过调用on('audioRendererChange')、on('audioCapturerChange')监听音频播放应用和音频录制应用,在应用状态变化、设备变化、音频属性变化时获得通知。同时可通过off('audioRendererChange')、off('audioCapturerChange')取消相关事件的监听。与此同时,开发者可以通过调用(可选)使用getCurrentAudioRendererInfoArray()获取当前音频播放应用的音频流唯一ID、音频播放客户端的UID、音频状态等信息,同理可调用getCurrentAudioCapturerInfoArray()获取音频录制应用的信息。其具体调用关系可参考音频流管理调用关系图。 + +详细API含义可参考:[音频管理API文档AudioStreamManager](../reference/apis/js-apis-audio.md#audiostreammanager9) + +**图1** 音频流管理调用关系图 + +![](figures/zh-ch_image_audio_stream_manager.png) + +## 开发步骤 + +1. 创建AudioStreamManager实例。 + + 在使用AudioStreamManager的API前,需要使用getStreamManager()创建一个AudioStreamManager实例。 + + ```js + var audioStreamManager = audio.getStreamManager(); + ``` + +2. (可选)使用on('audioRendererChange')监听音频渲染器更改事件。 +如果音频流监听应用需要在音频播放应用状态变化、设备变化、音频属性变化时获取通知,可以订阅该事件。更多事件请参考[API参考文档](../reference/apis/js-apis-audio.md)。 + + ```js + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; + console.info('## RendererChange on is called for ' + i + ' ##'); + console.info('StreamId for ' + i + ' is:' + AudioRendererChangeInfo.streamId); + console.info('ClientUid for ' + i + ' is:' + AudioRendererChangeInfo.clientUid); + console.info('Content for ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.content); + console.info('Stream for ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.usage); + console.info('Flag ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.rendererFlags); + console.info('State for ' + i + ' is:' + AudioRendererChangeInfo.rendererState); + var devDescriptor = AudioRendererChangeInfo.deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfo.deviceDescriptors.length; j++) { + console.info('Id:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].id); + console.info('Type:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceType); + console.info('Role:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceRole); + console.info('Name:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].name); + console.info('Address:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].address); + console.info('SampleRates:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]); + console.info('ChannelCounts' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]); + console.info('ChannelMask:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks); + } + } + }); + ``` + +3. (可选)使用off('audioRendererChange')取消监听音频渲染器更改事件。 + + ```js + audioStreamManager.off('audioRendererChange'); + console.info('######### RendererChange Off is called #########'); + ``` + +4. (可选)使用on('audioCapturerChange')监听音频捕获器更改事件。 +如果音频流监听应用需要在音频录制应用状态变化、设备变化、音频属性变化时获取通知,可以订阅该事件。更多事件请参考[API参考文档](../reference/apis/js-apis-audio.md)。 + + ```js + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(' ## audioCapturerChange on is called for element ' + i + ' ##'); + console.info('StreamId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info('ClientUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info('Source for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info('Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info('State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info('Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info('Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info('Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info('Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info('Address:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info('SampleRates:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info('ChannelCounts' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info('ChannelMask:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + } + }); + ``` + +5. (可选)使用off('audioCapturerChange')取消监听音频捕获器更改事件。 + + ```js + audioStreamManager.off('audioCapturerChange'); + console.info('######### CapturerChange Off is called #########'); + ``` + +6. (可选)使用getCurrentAudioRendererInfoArray()获取当前音频渲染器的信息。 +该接口可获取音频流唯一ID,音频播放客户端的UID,音频状态以及音频播放器的其他信息。需注意的是若对第三方音频流监听应用未配置ohos.permission.USE_BLUETOOTH权限,则查询到的设备名称和设备地址为空字符串,若正确配置权限,则显示的实际的设备名称和设备地址信息。 + + ```js + await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { + console.info('######### Get Promise is called ##########'); + if (AudioRendererChangeInfoArray != null) { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; + console.info('StreamId for ' + i +' is:' + AudioRendererChangeInfo.streamId); + console.info('ClientUid for ' + i + ' is:' + AudioRendererChangeInfo.clientUid); + console.info('Content ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.content); + console.info('Stream' + i +' is:' + AudioRendererChangeInfo.rendererInfo.usage); + console.info('Flag' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.rendererFlags); + console.info('State for ' + i + ' is:' + AudioRendererChangeInfo.rendererState); + var devDescriptor = AudioRendererChangeInfo.deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfo.deviceDescriptors.length; j++) { + console.info('Id:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].id); + console.info('Type:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceType); + console.info('Role:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceRole); + console.info('Name:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].name); + console.info('Address:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].address); + console.info('SampleRates:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]); + console.info('ChannelCounts' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]); + console.info('ChannnelMask:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks); + } + } + } + }).catch((err) => { + console.log('getCurrentAudioRendererInfoArray :ERROR: ' + err.message); + }); + ``` + +7. (可选)使用getCurrentAudioCapturerInfoArray()获取当前音频捕获器的信息。 +该接口可获取音频流唯一ID,音频录制客户端的UID,音频状态以及音频捕获器的其他信息。需注意的是若对第三方音频流监听应用未配置ohos.permission.USE_BLUETOOTH权限,则查询到的设备名称和设备地址为空字符串,若正确配置权限,则显示的实际的设备名称和设备地址信息。 + + ```js + await audioStreamManager.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { + console.info('getCurrentAudioCapturerInfoArray: **** Get Promise Called ****'); + if (AudioCapturerChangeInfoArray != null) { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info('StreamId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info('ClientUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info('Source for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info('Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info('State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + var devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info('Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info('Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info('Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info('Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name) + console.info('Address:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info('SampleRates:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info('ChannelCounts' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info('ChannelMask:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + } + } + }).catch((err) => { + console.log('getCurrentAudioCapturerInfoArray :ERROR: ' + err.message); + }); + ``` \ No newline at end of file diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_audio_stream_manager.png b/zh-cn/application-dev/media/figures/zh-ch_image_audio_stream_manager.png new file mode 100644 index 0000000000000000000000000000000000000000..b5c72f9d662abb75e177534a888eef14d48d62ab Binary files /dev/null and b/zh-cn/application-dev/media/figures/zh-ch_image_audio_stream_manager.png differ diff --git a/zh-cn/application-dev/quick-start/Readme-CN.md b/zh-cn/application-dev/quick-start/Readme-CN.md index 48cea0090a5959e26ecbc3f316c56ec641a41adb..781fc318540701a0b14a9bad97c4fc1710a5d18b 100755 --- a/zh-cn/application-dev/quick-start/Readme-CN.md +++ b/zh-cn/application-dev/quick-start/Readme-CN.md @@ -2,13 +2,11 @@ - 快速入门 - [开发准备](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) + - [使用eTS语言开发(Stage模型)](start-with-ets-stage.md) + - [使用eTS语言开发(FA模型)](start-with-ets-fa.md) + - [使用JS语言开发(FA模型)](start-with-js-fa.md) - 开发基础知识 - [应用包结构说明(FA模型)](package-structure.md) - [应用包结构说明(Stage模型)](stage-structure.md) - [SysCap说明](syscap.md) - - [HarmonyAppProvision配置文件](app-provision-structure.md) - + - [HarmonyAppProvision配置文件](app-provision-structure.md) \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/figures/01.png b/zh-cn/application-dev/quick-start/figures/01.png new file mode 100644 index 0000000000000000000000000000000000000000..ab9a01795cd6795448b16e53b7400cc7806e455c Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/01.png differ diff --git a/zh-cn/application-dev/quick-start/figures/02.png b/zh-cn/application-dev/quick-start/figures/02.png new file mode 100644 index 0000000000000000000000000000000000000000..9b06d46ea1285613c00efc7cce55e7dbe2b74a2c Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/02.png differ diff --git a/zh-cn/application-dev/quick-start/figures/04.png b/zh-cn/application-dev/quick-start/figures/04.png new file mode 100644 index 0000000000000000000000000000000000000000..792837f2620a8c44dcf69ad7a56e8aed6693bf24 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/04.png differ diff --git a/zh-cn/application-dev/quick-start/figures/06.png b/zh-cn/application-dev/quick-start/figures/06.png new file mode 100644 index 0000000000000000000000000000000000000000..bdfc0acf1c46ded2b471894dc20af970f3c50836 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/06.png differ diff --git a/zh-cn/application-dev/quick-start/figures/07.png b/zh-cn/application-dev/quick-start/figures/07.png new file mode 100644 index 0000000000000000000000000000000000000000..3749dcb06daed21f87088a9a46afa6d0d87bef3f Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/07.png differ diff --git a/zh-cn/application-dev/quick-start/figures/09.png b/zh-cn/application-dev/quick-start/figures/09.png new file mode 100644 index 0000000000000000000000000000000000000000..ac6dbbab11846274c42bfdd61f7bd5dfe0ace99f Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/09.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311015192.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311015192.png new file mode 100644 index 0000000000000000000000000000000000000000..12978dc861aaa1f826404d9c6838bb8628381615 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311015192.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311175120.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311175120.png new file mode 100644 index 0000000000000000000000000000000000000000..12978dc861aaa1f826404d9c6838bb8628381615 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311175120.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311175132.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311175132.png new file mode 100644 index 0000000000000000000000000000000000000000..2f401b2f8aa84e89bdef25bcf615ff1a621ab6d6 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311175132.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311334932.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311334932.png new file mode 100644 index 0000000000000000000000000000000000000000..42b475577bcc805372336be8971afa5c69c284bd Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311334932.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311334944.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311334944.png new file mode 100644 index 0000000000000000000000000000000000000000..9ce82237297b06c04113d0368d7145661de0d997 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311334944.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311334972.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311334972.png new file mode 100644 index 0000000000000000000000000000000000000000..6499d0b2de7ee290b958059d13d9d19995e0e511 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311334972.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311334976.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311334976.png new file mode 100644 index 0000000000000000000000000000000000000000..7891c03e8fab1eaaf6159964fc338e0be9bb080a Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311334976.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311494580.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311494580.png new file mode 100644 index 0000000000000000000000000000000000000000..6c1ea01d448434e7cfd94e174474e72b57d3b4cc Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311494580.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311494592.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311494592.png new file mode 100644 index 0000000000000000000000000000000000000000..a88a2ec512c0fa4f374d1e9ac03a27c717aeab58 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311494592.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311494604.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311494604.png new file mode 100644 index 0000000000000000000000000000000000000000..6c1ea01d448434e7cfd94e174474e72b57d3b4cc Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001311494604.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001363934577.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001363934577.png new file mode 100644 index 0000000000000000000000000000000000000000..6499d0b2de7ee290b958059d13d9d19995e0e511 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001363934577.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001363934589.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001363934589.png new file mode 100644 index 0000000000000000000000000000000000000000..2f401b2f8aa84e89bdef25bcf615ff1a621ab6d6 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001363934589.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364054485.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364054485.png new file mode 100644 index 0000000000000000000000000000000000000000..6c1ea01d448434e7cfd94e174474e72b57d3b4cc Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364054485.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364054489.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364054489.png new file mode 100644 index 0000000000000000000000000000000000000000..a69b0c6f3b047e5961b05b40b663ce972a90b459 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364054489.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364173989.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364173989.png new file mode 100644 index 0000000000000000000000000000000000000000..f4b6f516a8340914c41600ef24012dd3699648b6 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364173989.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364174013.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364174013.png new file mode 100644 index 0000000000000000000000000000000000000000..12978dc861aaa1f826404d9c6838bb8628381615 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364174013.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364254729.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364254729.png new file mode 100644 index 0000000000000000000000000000000000000000..7fba7aab32a92752b341af024ef97e5acfe3d73d Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364254729.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364254741.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364254741.png new file mode 100644 index 0000000000000000000000000000000000000000..fbbde9923a131d3ab69257b28cfe33ca2a1040cf Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364254741.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364254773.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364254773.png new file mode 100644 index 0000000000000000000000000000000000000000..6499d0b2de7ee290b958059d13d9d19995e0e511 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364254773.png differ diff --git a/zh-cn/application-dev/quick-start/package-structure.md b/zh-cn/application-dev/quick-start/package-structure.md index 6345a071e3ec1d01af0169dcc9ab1de1567f3cf3..fab0b688c882f775baca2f5675fbab106a1db7db 100644 --- a/zh-cn/application-dev/quick-start/package-structure.md +++ b/zh-cn/application-dev/quick-start/package-structure.md @@ -505,6 +505,7 @@ skills示例: | name | 需要使用的权限名称。 | 字符串 | 否 | | reason | 描述申请权限的原因。不能超过256个字节。需要做多语种适配。 | 字符串 | 分情况:当申请的权限为user_grant时,必须填写此字段,否则不允许在应用市场上架;其它权限可缺省,缺省为空 | | usedScene | 描述权限使用的场景和时机。场景类型有:ability、when。ability:ability的名称,可配置多个。when:调用时机,可填的值有inuse(使用时)、always(始终) | 对象 | ability分情况:申请的权限有user_grant时,ability必填;没有user_grant时可缺省,缺省值为空。when可缺省,缺省值为“inuse” | +具体示例可参考[访问控制开发指导](../security/accesstoken-guidelines.md#fa模型)。 表22 js对象的内部结构说明 diff --git a/zh-cn/application-dev/quick-start/stage-structure.md b/zh-cn/application-dev/quick-start/stage-structure.md index fa20a6d5d3cf8cbef28290a52b06576796e7fa9c..808ab2b55571653ca795e7f37379ad2821828e8a 100644 --- a/zh-cn/application-dev/quick-start/stage-structure.md +++ b/zh-cn/application-dev/quick-start/stage-structure.md @@ -507,6 +507,7 @@ requestPermissions示例 : } } ``` +权限访问的更多说明,可参考[访问控制开发指导](../security/accesstoken-guidelines.md) #### form对象内部结构 diff --git a/zh-cn/application-dev/quick-start/start-overview.md b/zh-cn/application-dev/quick-start/start-overview.md index e26343b37162e4c7436b52725907bec71a3d37d6..84d4c8befae5580f86210b8141a06189eebaa8d1 100644 --- a/zh-cn/application-dev/quick-start/start-overview.md +++ b/zh-cn/application-dev/quick-start/start-overview.md @@ -3,7 +3,7 @@ 本文档适用于OpenHarmony应用开发的初学者。通过构建一个简单的具有页面跳转/返回功能的应用(如下图所示),快速了解工程目录的主要文件,熟悉OpenHarmony应用开发流程。 -![zh-cn_image_0000001261809595](figures/zh-cn_image_0000001261809595.png) +![zh-cn_image_0000001364254729](figures/zh-cn_image_0000001364254729.png) 在开始之前,您需要了解有关OpenHarmony应用的一些基本概念:UI框架的简单说明、Ability的基本概念。 @@ -16,37 +16,37 @@ OpenHarmony提供了一套UI开发框架,即方舟开发框架(ArkUI框架)。方舟开发框架可为开发者提供应用UI开发所必需的能力,比如多种组件、布局计算、动画能力、UI交互、绘制等。 -方舟开发框架针对不同目的和技术背景的开发者提供了两种开发范式,分别是基于JS扩展的类Web开发范式(简称“类Web开发范式”)和基于TS扩展的声明式开发范式(简称“声明式开发范式”)。以下是两种开发范式的简单对比。 +方舟开发框架针对不同目的和技术背景的开发者提供了两种开发范式,分别是基于TS扩展的声明式开发范式(简称“声明式开发范式”)和基于JS扩展的类Web开发范式(简称“类Web开发范式”)。以下是两种开发范式的简单对比。 | **开发范式名称** | **语言生态** | **UI更新方式** | **适用场景** | **适用人群** | | -------- | -------- | -------- | -------- | -------- | -| 类Web开发范式 | JS语言 | 数据驱动更新 | 界面较为简单的程序应用和卡片 | Web前端开发人员 | | 声明式开发范式 | 扩展的TS语言(eTS) | 数据驱动更新 | 复杂度较大、团队合作度较高的程序 | 移动系统应用开发人员、系统应用开发人员 | +| 类Web开发范式 | JS语言 | 数据驱动更新 | 界面较为简单的程序应用和卡片 | Web前端开发人员 | -对于JS语言开发时,低代码方式在DevEco Studio V2.2 Beta1及更高版本中支持。 - -对于eTS语言开发,低代码方式在DevEco Studio V3.0 Beta3及更高版本中支持。 - -OpenHarmony低代码开发方式具有丰富的UI界面编辑功能,遵循JS开发规范,通过可视化界面开发方式快速构建布局,可有效降低开发者的上手成本并提升开发者构建UI界面的效率。 -更多UI框架的开发内容及指导,请参见[UI开发](../ui/arkui-overview.md)。 +更多UI框架的开发内容及指导,详见[UI开发](../ui/arkui-overview.md)。 ### Ability Ability是应用所具备能力的抽象,也是应用程序的重要组成部分。一个应用可以具备多种能力(即可以包含多个Ability)。OpenHarmony支持应用以Ability为单位进行部署。 -Ability分为[FA(Feature Ability)](../../glossary.md#f)和[PA(Particle Ability)](../../glossary.md#p)两种类型,每种类型为开发者提供了不同的模板,以便实现不同的业务功能。其中,FA支持[Page Ability](../ability/fa-pageability.md)模板,以提供与用户交互的能力。一个Page Ability可以含有一个或多个页面(即Page),Page Ability与Page的关系如下图所示: +Ability框架模型结构具有两种形态: -![zh-cn_image_0000001215206886](figures/zh-cn_image_0000001215206886.png) +- **FA模型**:API 8及其更早版本的应用程序只能使用FA模型进行开发。更多FA模型的内容详见[FA模型综述](../ability/fa-brief.md)。 -快速入门提供了一个含有两个页面的Page Ability实例。更多Ability的开发内容及指导,请参见[Ability开发](../ability/ability-brief.md)。 +- **Stage模型**:从API 9开始,Ability框架引入并支持使用Stage模型进行开发。更多Stage模型的内容详见[Stage模型综述](../ability/stage-brief.md)。 + +FA模型和Stage模型的工程目录结构存在差异,Stage模型只支持使用eTS语言进行开发。 + +关于FA模型和Stage模型的整体架构和设计思想等更多区别,详见[Ability框架概述](../ability/ability-brief.md)。 + +快速入门提供了一个含有两个页面的Ability的开发实例。更多Ability的开发内容及指导,请见[Ability开发](../ability/ability-brief.md)。 ## 工具准备 -1. 安装最新版[DevEco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta_openharmony)。 +1. 安装最新版[DevEco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta)。 2. 请参考[配置OpenHarmony SDK](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-setting-up-environment-0000001263160443),完成**DevEco Studio**的安装和开发环境配置。 -完成上述操作及基本概念的理解后,可参照[使用eTS语言开发(传统代码方式)](start-with-ets.md)、[使用eTS语言开发(低代码方式)](start-with-ets-low-code.md)、[使用JS语言开发(传统代码方式)](start-with-js.md)、[使用JS语言开发(低代码方式)](start-with-js-low-code.md)中的任一章节进行下一步体验和学习。 - +完成上述操作及基本概念的理解后,可参照[使用eTS语言进行开发(Stage模型)](start-with-ets-stage.md)、[使用eTS语言开发(FA模型)](start-with-ets-fa.md)、[使用JS语言开发(FA模型)](../quick-start/start-with-js-fa.md)中的任一章节进行下一步体验和学习。 diff --git a/zh-cn/application-dev/quick-start/start-with-ets-fa.md b/zh-cn/application-dev/quick-start/start-with-ets-fa.md new file mode 100644 index 0000000000000000000000000000000000000000..c8477362458afba74c5a66612f81adf89537dc48 --- /dev/null +++ b/zh-cn/application-dev/quick-start/start-with-ets-fa.md @@ -0,0 +1,284 @@ +# 使用eTS语言开发(FA模型) + + +> **说明:** +> 请使用**DevEco Studio V3.0.0.601 Beta1**及更高版本。 +> +> 为确保运行效果,本文以使用**DevEco Studio V3.0.0.991 Beta4**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta)获取下载链接。 + + +## 创建eTS工程 + +1. 若首次打开**DevEco Studio**,请点击**Create Project**创建工程。如果已经打开了一个工程,请在菜单栏选择**File** > **New** > **Create Project**来创建一个新工程。选择**OpenHarmony**模板库,选择模板“**Empty Ability**”,点击**Next**进行下一步配置。 + ![01](figures/01.png) + +2. 进入配置工程界面,**Compile SDK** 选择“**8**”(**Complie SDK**选择“**9**”时注意同步选择**Model** 为“**FA**”,此处以选择“**8**”为例),**Language**选择“**eTS**”,其他参数保持默认设置即可。 + ![02](figures/02.png) + + > **说明:** + > DevEco Studio V3.0 Beta3及更高版本支持使用eTS[低代码开发](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-low-code-development-0000001218440652)方式。 + > + > 低代码开发方式具有丰富的UI界面编辑功能,通过可视化界面开发方式快速构建布局,可有效降低开发者的上手成本并提升开发者构建UI界面的效率。 + > + > 如需使用低代码开发方式,请打开上图中的Enable Super Visual开关。 + +3. 点击**Finish**,工具会自动生成示例代码和相关资源,等待工程创建完成。 + + +## eTS工程目录结构 + +- **entry**:OpenHarmony工程模块,编译构建生成一个[HAP](../../glossary.md#hap)包。 + - **src > main > ets**:用于存放ets源码。 + - **src > main > ets > MainAbility**:应用/服务的入口。 + - **src > main > ets > MainAbility > pages**:MainAbility包含的页面。 + - **src > main > ets > MainAbility > pages > index.ets**:pages列表中的第一个页面,即应用的首页入口。 + - **src > main > ets > MainAbility > app.ets**:承载Ability生命周期。 + - **src > main > resources**:用于存放应用/服务所用到的资源文件,如图形、多媒体、字符串、布局文件等。关于资源文件,详见[资源文件的分类](../ui/ui-ts-basic-resource-file-categories.md)。 + - **src > main > config.json**:模块配置文件。主要包含HAP包的配置信息、应用/服务在具体设备上的配置信息以及应用/服务的全局配置信息。具体的配置文件说明,详见[应用包结构配置文件的说明(FA模型)](package-structure.md)。 + - **build-profile.json5**:当前的模块信息 、编译信息配置项,包括buildOption、targets配置等。 + - **hvigorfile.js**:模块级编译构建任务脚本,开发者可以自定义相关任务和代码实现。 + +- **build-profile.json5**:应用级配置信息,包括签名、产品配置等。 + +- **hvigorfile.js**:应用级编译构建任务脚本。 + + +## 构建第一个页面 + +1. 使用文本组件。 + 工程同步完成后,在“**Project**”窗口,点击“**entry > src > main > ets > MainAbility > pages**”,打开“**index.ets**”文件,可以看到页面由Text组件组成。“**index.ets**”文件的示例如下: + + + ```ts + // index.ets + @Entry + @Component + struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } + } + ``` + +2. 添加按钮。 + 在默认页面基础上,我们添加一个Button组件,作为按钮响应用户点击,从而实现跳转到另一个页面。“**index.ets**”文件的示例如下: + + + ```ts + // index.ets + @Entry + @Component + struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + // 添加按钮,以响应用户点击 + Button() { + Text('Next') + .fontSize(30) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('40%') + .height('5%') + } + .width('100%') + } + .height('100%') + } + } + ``` + +3. 在编辑窗口右上角的侧边工具栏,点击Previewer,打开预览器。第一个页面效果如下图所示: + ![zh-cn_image_0000001364254741](figures/zh-cn_image_0000001364254741.png) + + +## 构建第二个页面 + +1. 创建第二个页面。 + - 新建第二个页面文件。在“**Project**”窗口,打开“**entry > src > main > ets > MainAbility**”,右键点击“**pages**”文件夹,选择“**New > eTS File**”,命名为“**second**”,点击“**Finish**”。可以看到文件目录结构如下: + + ![zh-cn_image_0000001311334932](figures/zh-cn_image_0000001311334932.png) + + > **说明:** + > 开发者也可以在右键点击“**pages**”文件夹时,选择“**New > Page**”,则无需手动配置相关页面路由。 + - 配置第二个页面的路由。在config.json文件中的“module - js - pages”下配置第二个页面的路由“pages/second”。示例如下: + + ```json + { + "module": { + "js": [ + { + "pages": [ + "pages/index", + "pages/second" + ], + } + ] + } + } + ``` + +2. 添加文本及按钮。 + 参照第一个页面,在第二个页面添加Text组件、Button组件等,并设置其样式。“**second.ets**”文件的示例如下: + + + ```ts + // second.ets + @Entry + @Component + struct Second { + @State message: string = 'Hi there' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('Back') + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('40%') + .height('5%') + } + .width('100%') + } + .height('100%') + } + } + ``` + + +## 实现页面间的跳转 + +页面间的导航可以通过页面路由router来实现。页面路由router根据页面url找到目标页面,从而实现跳转。使用页面路由请导入router模块。 + +1. 第一个页面跳转到第二个页面。 + 在第一个页面中,跳转按钮绑定onClick事件,点击按钮时跳转到第二页。“**index.ets**”文件的示例如下: + + + ```ts + // index.ets + import router from '@ohos.router'; + + @Entry + @Component + struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + // 添加按钮,以响应用户点击 + Button() { + Text('Next') + .fontSize(30) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('40%') + .height('5%') + // 跳转按钮绑定onClick事件,点击时跳转到第二页 + .onClick(() => { + router.push({ url: 'pages/second' }) + }) + } + .width('100%') + } + .height('100%') + } + } + ``` + +2. 第二个页面返回到第一个页面。 + 在第二个页面中,返回按钮绑定onClick事件,点击按钮时返回到第一页。“**second.ets**”文件的示例如下: + + + ```ts + // second.ets + import router from '@ohos.router'; + + @Entry + @Component + struct Second { + @State message: string = 'Hi there' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('Back') + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('40%') + .height('5%') + // 返回按钮绑定onClick事件,点击按钮时返回到第一页 + .onClick(() => { + router.back() + }) + } + .width('100%') + } + .height('100%') + } + } + ``` + +3. 打开index.ets文件,点击预览器中的![zh-cn_image_0000001311175120](figures/zh-cn_image_0000001311175120.png)按钮进行刷新。效果如下图所示: + ![zh-cn_image_0000001364173989](figures/zh-cn_image_0000001364173989.png) + + +## 使用真机运行应用 + +1. 将搭载OpenHarmony标准系统的开发板与电脑连接。 + +2. 点击**File**> **Project Structure...** > **Project**>**SigningConfigs** 界面勾选“**Automatically generate signing**”,等待自动签名完成即可,点击“**OK**”。如下图所示: + ![06](figures/06.png) + +3. 在编辑窗口右上角的工具栏,点击![zh-cn_image_0000001311494580](figures/zh-cn_image_0000001311494580.png)按钮运行。效果如下图所示: + ![zh-cn_image_0000001363934577](figures/zh-cn_image_0000001363934577.png) + +恭喜您已经使用eTS语言开发(FA模型)完成了第一个OpenHarmony应用,快来[探索更多的OpenHarmony功能](../application-dev-guide.md)吧。 diff --git a/zh-cn/application-dev/quick-start/start-with-ets-low-code.md b/zh-cn/application-dev/quick-start/start-with-ets-low-code.md deleted file mode 100644 index ac80b5edac057582e6cb6e3b189d088c0a2860d7..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/quick-start/start-with-ets-low-code.md +++ /dev/null @@ -1,203 +0,0 @@ -# 使用eTS语言开发(低代码方式) - - -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 该特性在**DevEco Studio V3.0 Beta3**及更高版本中支持。 -> -> 目前eTS低代码开发方式支持的组件较少,更多组件的支持将在后续版本中实现。 -> -> 为确保运行效果,本文以使用**DevEco Studio V3.0.0.900 Beta3**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta_openharmony)获取下载链接。 - - -OpenHarmony低代码开发方式具有丰富的UI界面编辑功能,通过可视化界面开发方式快速构建布局,可有效降低开发者的上手成本并提升开发者构建UI界面的效率。 - - -使用低代码开发应用或服务有以下两种开发方式: - - -- 直接创建一个支持低代码开发的新工程以进行开发。本文以此方式为例进行说明。 - -- 在已有工程中,创建visual文件来进行开发。此种方式的操作可参考[创建visual文件支持低代码开发](#构建第二个页面)。 - - -## 创建新工程支持低代码开发 - -1. 若首次打开**DevEco Studio**,请点击**Create Project**创建工程。如果已有一个工程,请点击**File** > **New** > **Create Project**。选择模板“**Empty Ability**”,点击**Next**进行下一步配置。 - - ![zh-cn_image_0000001233528152](figures/zh-cn_image_0000001233528152.png) - -2. 进入配置工程界面,打开“**Enable Super Visual**”开关,**UI Syntax**选择“**eTS**”,其他参数保持默认设置即可。 - - ![zh-cn_image_0000001277728569](figures/zh-cn_image_0000001277728569.png) - -3. 点击**Finish**,工具会自动生成示例代码和相关资源,等待工程创建完成。 - - -## 低代码开发工程项目文件 - -工程同步完成后,自动生成以下目录结构: - -![zh-cn_image_0000001277809333](figures/zh-cn_image_0000001277809333.png) - -- **entry > src > main > ets > MainAbility > pages > index.ets**:低代码页面的逻辑描述文件,定义了页面里所用到的所有的逻辑关系,比如数据、事件等,详情请参考[TS语法糖](../ui/ts-syntactic-sugar.md)。如果创建了多个低代码页面,则pages目录下会生成多个页面文件夹及对应的ets文件。 - -- **entry > src > main > supervisual > MainAbility > pages > index.visual**:visual文件存储低代码页面的数据模型,双击该文件即可打开低代码页面,进行可视化开发设计。如果创建了多个低代码页面,则pages目录下会生成多个页面文件夹及对应的visual文件。 - - -## 构建第一个页面 - -工程同步完成后,第一个页面已有一个容器、一段文本(Hello World)显示。为了更详细地了解低代码开发,我们将删除画布原有模板组件,从零开始完成页面的添加、设置。 - -第一个页面内有一个容器、一段文本和一个按钮,通过Column、Text和Button组件来实现。其中,Column为沿垂直方向布局的容器组件,具体使用请见[Column](../reference/arkui-ts/ts-container-column.md)。 - -1. 删除画布原有模板组件。 - 打开index.visual文件,选中画布中的组件,单击鼠标右键,选择Delete删除画布原有模板组件。操作如下所示: - - ![zh-cn_image_0000001233208980](figures/zh-cn_image_0000001233208980.gif) - -2. 添加容器,设置Column容器的样式和属性。 - 选中UI Control中的Column组件,将其拖至画布。点击右侧属性样式栏中的图标![zh-cn_image_0000001233048996](figures/zh-cn_image_0000001233048996.png)(General),设置Column组件的高度Height为100%,使其占满屏幕;点击右侧属性样式栏中的图标![zh-cn_image_0000001233368860](figures/zh-cn_image_0000001233368860.png)(Feature),设置Column组件的AlignItems样式为center,使得其子组件在水平轴上居中显示。操作如下所示: - - ![zh-cn_image_0000001277488977](figures/zh-cn_image_0000001277488977.gif) - -3. 添加文本。 - 选中UI Control中的Text组件,将其拖至画布,再拖至Column组件的中央区域。点击右侧属性样式栏中的图标![zh-cn_image_0000001277608813](figures/zh-cn_image_0000001277608813.png)(Feature),设置Text组件的Content属性为“this.message”(即“Hello World”);设置组件的FontSize样式为30fp,使得其文字放大;设置组件的TextAlign样式为center,使得组件文字居中显示。再选中画布上的Text组件,拖动放大。操作如下所示: - - ![zh-cn_image_0000001235731706](figures/zh-cn_image_0000001233528156.gif) - -4. 添加按钮。 - 选中UI Control中的Button组件,将其拖至画布,再拖至Text组件下面。点击右侧属性样式栏中的图标![zh-cn_image_0000001277728577](figures/zh-cn_image_0000001277728577.png)(General),设置Button组件的Height为40vp;点击右侧属性样式栏中的图标![zh-cn_image_0000001277809337](figures/zh-cn_image_0000001277809337.png)(Feature),设置Button组件的Label属性为“Next”;设置Button组件的FontSize样式为25fp,使得其文字放大。操作如下所示: - - ![zh-cn_image_0000001235732402](figures/zh-cn_image_0000001233208988.gif) - -5. 在编辑窗口右上角的侧边工具栏,点击Previewer,打开预览器。第一个页面效果如下图所示: - - ![zh-cn_image_0000001235892798](figures/zh-cn_image_0000001233049004.png) - - -## 构建第二个页面 - -1. 创建第二个页面。 - 在“**Project**”窗口,打开“**entry > src > main > ets > MainAbility**”,右键点击“**pages**”文件夹,选择“**New > Visual**”,命名为“**second**”,单击“**Finish**”,即完成第二个页面的创建。可以看到文件目录结构如下: - - ![zh-cn_image_0000001233368868](figures/zh-cn_image_0000001233368868.png) - -2. [删除画布原有模板组件。](#delete_origin_content) - -3. [添加容器,设置Column容器的样式和属性。](#add_container) - -4. 添加文本。 - - - 在second.ets文件中,将本页面的message文本内容设置为“Hi there”,示例如下: - - ```ts - // second.ets - @Entry - @Component - struct Second { - @State message: string = 'Hi there' - - /** - * In low-code mode, do not add anything to the build function, as it will be - * overwritten by the content generated by the .visual file in the build phase. - */ - build() { - - } - } - ``` - - 选中Text组件,将其拖至画布,再拖至Column组件的中央区域。点击右侧属性样式栏中的图标![zh-cn_image_0000001277488985](figures/zh-cn_image_0000001277488985.png)(Feature),设置Text组件的Content属性为“this.message”(即“Hi there”);设置Text组件的FontSize样式为30fp;设置组件的TextAlign样式为center。再选中画布上的Text组件,拖动放大。操作如下所示: - - ![zh-cn_image_0000001280255513](figures/zh-cn_image_0000001277608817.gif) - -5. 添加按钮。 - 选中UI Control中的Button组件,将其拖至画布,再拖至Text组件下面。点击右侧属性样式栏中的图标![zh-cn_image_0000001233528160](figures/zh-cn_image_0000001233528160.png)(General),设置Button组件的Height为40vp;点击右侧属性样式栏中的图标![zh-cn_image_0000001277728597](figures/zh-cn_image_0000001277728597.png)(Feature),设置Button组件的Value属性为“Back”;设置组件的FontSize样式为25fp,使得其文字放大。操作如下所示: - - ![zh-cn_image_0000001280383937](figures/zh-cn_image_0000001277809361.gif) - - -## 实现页面间的跳转 - -页面间的导航可以通过页面路由router来实现。页面路由router根据页面url找到目标页面,从而实现跳转。使用页面路由请导入router模块。 - -1. 第一个页面跳转到第二个页面。 - 在第一个页面中,跳转按钮绑定onclick方法,点击按钮时跳转到第二页。需同时处理ets文件及visual文件。 - - “**index.ets**”示例如下: - - ```ts - // index.ets - import router from '@ohos.router'; - - @Entry - @Component - struct Index { - @State message: string = 'Hello World' - - /** - * In low-code mode, do not add anything to the build function, as it will be - * overwritten by the content generated by the .visual file in the build phase. - */ - onclick() { - router.push({ - url: 'pages/second', // 指定要跳转的页面 - }) - } - - build() { - } - } - ``` - - - “**index.visual**”: 打开index.visual,选中画布上的Button组件。点击右侧属性样式栏中的事件图标![zh-cn_image_0000001233209020](figures/zh-cn_image_0000001233209020.png)(Events),鼠标点击OnClick事件的输入框,选择this.onclick,如下所示: - - ![zh-cn_image_0000001235745716](figures/zh-cn_image_0000001233049040.png) - -2. 第二个页面返回到第一个页面。 - 在第二个页面中,返回按钮绑定back方法,点击按钮时返回到第一页。需同时处理ets文件及visual文件。 - - - “**second.ets**”示例如下: - - ```ts - // second.ets - import router from '@ohos.router'; - - @Entry - @Component - struct Second { - @State message: string = 'Hi there' - - /** - * In low-code mode, do not add anything to the build function, as it will be - * overwritten by the content generated by the .visual file in the build phase. - */ - back() { - router.back() - } - - build() { - - } - } - ``` - - “**second.visual**”: 打开second.visual,选中画布上的Button组件。点击右侧属性样式栏中的事件图标![zh-cn_image_0000001233368900](figures/zh-cn_image_0000001233368900.png)(Events),鼠标点击OnClick事件的输入框,选择this.back,如下所示: - - ![zh-cn_image_0000001280385809](figures/zh-cn_image_0000001277489017.png) - -3. 打开index.visual或index.ets文件,点击预览器中的 ![zh-cn_image_0000001277608849](figures/zh-cn_image_0000001277608849.png) 按钮进行刷新。效果如下图所示: - - ![zh-cn_image_0000001233528192](figures/zh-cn_image_0000001233528192.png) - - -## 使用真机运行应用 - -1. 将搭载OpenHarmony标准系统的开发板与电脑连接。 - -2. 点击**File** > **Project Structure** > **Project** > **Signing Configs**界面勾选“**Automatically generate signing**”,等待自动签名完成即可,点击“**OK**”。如下图所示: - - ![zh-cn_image_0000001277728613](figures/zh-cn_image_0000001277728613.png) - -3. 在编辑窗口右上角的工具栏,点击![zh-cn_image_0000001277809373](figures/zh-cn_image_0000001277809373.png)按钮运行。效果如下图所示: - - ![zh-cn_image_0000001233209024](figures/zh-cn_image_0000001233209024.png) - -恭喜您已经使用eTS语言开发(低代码方式)完成了第一个OpenHarmony应用,快来[探索更多的OpenHarmony功能](../application-dev-guide.md)吧。 diff --git a/zh-cn/application-dev/quick-start/start-with-ets.md b/zh-cn/application-dev/quick-start/start-with-ets-stage.md similarity index 54% rename from zh-cn/application-dev/quick-start/start-with-ets.md rename to zh-cn/application-dev/quick-start/start-with-ets-stage.md index 7c921bc9145276d79ef4303aa951705c0e042d08..f8c2493e72073c120599477c6bd1d580fa7be23e 100644 --- a/zh-cn/application-dev/quick-start/start-with-ets.md +++ b/zh-cn/application-dev/quick-start/start-with-ets-stage.md @@ -1,46 +1,57 @@ -# 使用eTS语言开发(传统代码方式) +# 使用eTS语言开发(Stage模型) -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 请使用**DevEco Studio V3.0.0.601 Beta1**及更高版本。 + +> **说明:** +> 请使用**DevEco Studio V3.0.0.900 Beta3**及更高版本。 > -> 为确保运行效果,本文以使用**DevEco Studio V3.0.0.900 Beta3**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta_openharmony)获取下载链接。 +> 为确保运行效果,本文以使用**DevEco Studio V3.0.0.991 Beta4**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta)获取下载链接。 ## 创建eTS工程 -1. 若首次打开**DevEco Studio**,请点击**Create Project**创建工程。如果已有一个工程,请点击**File** > **New** > **Create Project**。选择模板“**Empty Ability**”,点击**Next**进行下一步配置。 +1. 若首次打开**DevEco Studio**,请点击**Create Project**创建工程。如果已经打开了一个工程,请在菜单栏选择**File** > **New** > **Create Project**来创建一个新工程。选择**OpenHarmony**模板库,选择模板“**Empty Ability**”,点击**Next**进行下一步配置。 + ![01](figures/01.png) - ![zh-cn_image_0000001223556342](figures/zh-cn_image_0000001223556342.png) +2. 进入配置工程界面,**Compile SDK**选择“**9**”,**Model** 选择“**Stage**”,**Language** 选择“**eTS**”,其他参数保持默认设置即可。 + ![07](figures/07.png) -2. 进入配置工程界面,**UI Syntax**选择“**eTS**”,其他参数保持默认设置即可。 + > **说明:** + > + > 支持使用eTS[低代码开发](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-low-code-development-0000001218440652)方式。 + > + > 低代码开发方式具有丰富的UI界面编辑功能,通过可视化界面开发方式快速构建布局,可有效降低开发者的上手成本并提升开发者构建UI界面的效率。 + > + > 如需使用低代码开发方式,请打开上图中的Enable Super Visual开关。 + +3. 点击**Finish**,工具会自动生成示例代码和相关资源,等待工程创建完成。 - ![zh-cn_image_0000001223716826](figures/zh-cn_image_0000001223716826.png) -3. 点击**Finish**,工具会自动生成示例代码和相关资源,等待工程创建完成。 +## eTS工程目录结构 +![zh-cn_image_0000001364054489](figures/zh-cn_image_0000001364054489.png) -## eTS工程项目文件 +- **AppScope > app.json5**:应用的全局配置信息。 -- **entry** :OpenHarmony工程模块,编译构建生成一个[HAP](../../glossary.md#hap)包。 - - **src > main > ets** :用于存放ets源码。 - - **src > main > ets > MainAbility** :应用/服务的入口。 - - **src > main > ets > MainAbility > pages** :MainAbility包含的页面。 - - **src > main > ets > MainAbility > pages > index.ets** :pages列表中的第一个页面,即应用的首页入口。 - - **src > main > ets > MainAbility > app.ets** :承载Ability生命周期。 - - **src > main > resources** :用于存放应用/服务所用到的资源文件,如图形、多媒体、字符串、布局文件等。 - - **src > main > config.json** :模块配置文件。主要包含HAP包的配置信息、应用/服务在具体设备上的配置信息以及应用/服务的全局配置信息。具体的配置文件说明,详见[应用包结构配置文件的说明](package-structure.md)。 - - **build-profile.json5** :当前的模块信息 、编译信息配置项,包括buildOption、targets配置等。 - - **hvigorfile.js** :模块级编译构建任务脚本,开发者可以自定义相关任务和代码实现。 +- **entry**:OpenHarmony工程模块,编译构建生成一个[HAP](../../glossary.md#hap)包。 + - **src > main > ets**:用于存放ets源码。 + - **src > main > ets > Application > AbilityStage.ts**:实现AbilityStage接口。 + - **src > main > ets > MainAbility**:应用/服务的入口。 + - **src > main > ets > MainAbility > MainAbility.ts**:承载Ability生命周期。 + - **src > main > ets > pages**:MainAbility包含的页面。 + - **src > main > resources**:用于存放应用/服务所用到的资源文件,如图形、多媒体、字符串、布局文件等。关于资源文件,详见[资源文件的分类](../ui/ui-ts-basic-resource-file-categories.md)。 + - **src > main > module.json5**:模块配置文件。主要包含HAP包的配置信息、应用/服务在具体设备上的配置信息以及应用/服务的全局配置信息。具体的配置文件说明,详见[应用包结构配置文件的说明(Stage模型)](stage-structure.md)。 + - **build-profile.json5**:当前的模块信息 、编译信息配置项,包括buildOption、targets配置等。 + - **hvigorfile.js**:模块级编译构建任务脚本,开发者可以自定义相关任务和代码实现。 -- **build-profile.json5** :应用级配置信息,包括签名、产品配置等。 +- **build-profile.json5**:应用级配置信息,包括签名、产品配置等。 -- **hvigorfile.js** :应用级编译构建任务脚本。 +- **hvigorfile.js**:应用级编译构建任务脚本。 ## 构建第一个页面 1. 使用文本组件。 -工程同步完成后,在“**Project**”窗口,点击“**entry > src > main > ets > MainAbility > pages**”,打开“**index.ets**”文件,可以看到页面由Text组件组成。“**index.ets**”文件的示例如下: + 工程同步完成后,在“**Project**”窗口,点击“**entry > src > main > ets > MainAbility > pages**”,打开“**index.ets**”文件,可以看到页面由Text组件组成。“**index.ets**”文件的示例如下: ```ts @@ -103,46 +114,33 @@ ``` 3. 在编辑窗口右上角的侧边工具栏,点击Previewer,打开预览器。第一个页面效果如下图所示: - - ![zh-cn_image_0000001216239356](figures/zh-cn_image_0000001216239356.png) + ![zh-cn_image_0000001311334976](figures/zh-cn_image_0000001311334976.png) ## 构建第二个页面 1. 创建第二个页面。 - - 新建第二个页面文件。在“**Project**”窗口,打开“**entry > src > main > ets > MainAbility**”,右键点击“**pages**”文件夹,选择“**New > eTS File**”,命名为“**second**”,点击“**Finish**”。可以看到文件目录结构如下: - - ![zh-cn_image_0000001223397122](figures/zh-cn_image_0000001223397122.png) + - 新建第二个页面文件。在“**Project**”窗口,打开“**entry > src > main > ets**”,右键点击“**pages**”文件夹,选择“**New > eTS File**”,命名为“**second**”,点击“**Finish**”。可以看到文件目录结构如下: - > 说明: - > - > 开发者也可以在右键点击“**pages**”文件夹时,选择“**new > Page**”,则无需手动配置相关页面的路由。 + ![09](figures/09.png) - - 配置第二个页面的路由。在config.json文件中的“module - js - pages”下配置第二个页面的路由“pages/second”。示例如下: - - ``` + > **说明:** + > 开发者也可以在右键点击“**pages**”文件夹时,选择“**New > Page**”,则无需手动配置相关页面路由。 + - 配置第二个页面的路由。在“**Project**”窗口,打开“**entry > src > main > resources > base > profile **”,在main_pages.json文件中的“src”下配置第二个页面的路由“pages/second”。示例如下: + + ```json { - ... - "module": { - ... - "js": [ - { - ... - "pages": [ - "pages/index", - "pages/second" - ] - ... - } - ] - } + "src": [ + "pages/index", + "pages/second" + ] } - ``` + ``` 2. 添加文本及按钮。 参照第一个页面,在第二个页面添加Text组件、Button组件等,并设置其样式。“**second.ets**”文件的示例如下: - + ```ts // second.ets @Entry @@ -268,21 +266,18 @@ } ``` -3. 打开index.ets文件,点击预览器中的 ![zh-cn_image_0000001262219043](figures/zh-cn_image_0000001262219043.png) 按钮进行刷新。 效果如下图所示: - - ![zh-cn_image_0000001260684127](figures/zh-cn_image_0000001260684127.png) +3. 打开index.ets文件,点击预览器中的![zh-cn_image_0000001311015192](figures/zh-cn_image_0000001311015192.png)按钮进行刷新。效果如下图所示: + ![zh-cn_image_0000001364254773](figures/zh-cn_image_0000001364254773.png) ## 使用真机运行应用 1. 将搭载OpenHarmony标准系统的开发板与电脑连接。 -2. 点击**File** > **Project Structure** > **Project** > **SigningConfigs**界面勾选“**Automatically generate signing**”,等待自动签名完成即可,点击“**OK**”。如下图所示: - - ![zh-cn_image_0000001268077317](figures/zh-cn_image_0000001268077317.png) - -3. 在编辑窗口右上角的工具栏,点击![zh-cn_image_0000001262206247](figures/zh-cn_image_0000001262206247.png)按钮运行。效果如下图所示: +2. 点击**File**> **Project Structure...** > **Project**>**SigningConfigs**界面勾选“**Automatically generate signing**”,等待自动签名完成即可,点击“**OK**”。如下图所示: + ![06](figures/06.png) - ![zh-cn_image_0000001217526428](figures/zh-cn_image_0000001217526428.png) +3. 在编辑窗口右上角的工具栏,点击![zh-cn_image_0000001364054485](figures/zh-cn_image_0000001364054485.png)按钮运行。效果如下图所示: + ![zh-cn_image_0000001311334972](figures/zh-cn_image_0000001311334972.png) -恭喜您已经使用eTS语言(传统代码方式)开发完成了第一个OpenHarmony应用,快来[探索更多的OpenHarmony功能](../application-dev-guide.md)吧。 +恭喜您已经使用eTS语言开发(Stage模型)完成了第一个OpenHarmony应用,快来[探索更多的OpenHarmony功能](../application-dev-guide.md)吧。 diff --git a/zh-cn/application-dev/quick-start/start-with-js.md b/zh-cn/application-dev/quick-start/start-with-js-fa.md similarity index 57% rename from zh-cn/application-dev/quick-start/start-with-js.md rename to zh-cn/application-dev/quick-start/start-with-js-fa.md index 32ce2eb43af404acb80112678764d37cd3e79cb9..d735f4a0ed5d2805161164eeb23327019b0cc10c 100644 --- a/zh-cn/application-dev/quick-start/start-with-js.md +++ b/zh-cn/application-dev/quick-start/start-with-js-fa.md @@ -1,40 +1,45 @@ -# 使用JS语言开发(传统代码方式) +# 使用JS语言开发(FA模型) -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 为确保运行效果,本文以使用**DevEco Studio V3.0.0.900 Beta3**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta_openharmony)获取下载链接。 +> **说明:** +> 为确保运行效果,本文以使用**DevEco Studio V3.0.0.991 Beta4**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta)获取下载链接。 ## 创建JS工程 -1. 若首次打开**DevEco Studio**,请点击**Create Project**创建工程。如果已有一个工程,请点击**File** > **New** > **Create Project**。选择模板“**Empty Ability**”,点击**Next**进行下一步配置。 +1. 若首次打开**DevEco Studio**,请点击**Create Project**创建工程。如果已经打开了一个工程,请在菜单栏选择**File** > **New** > **Create Project**来创建一个新工程。选择**OpenHarmony**模板库,选择模板“**Empty Ability**”,点击**Next**进行下一步配置。 + ![01](figures/01.png) - ![zh-cn_image_0000001223558814](figures/zh-cn_image_0000001223558814.png) +2. 进入配置工程界面,**Compile SDK**选择“**8**”(**Complie SDK**选择“**9**”时注意同步选择 **Model** 为“**FA**”,此处以选择“**8**”为例),**Language**选择“**JS**”,其他参数保持默认设置即可。 + ![04](figures/04.png) -2. 进入配置工程界面,**UI Syntax**选择“**JS**”,其他参数保持默认设置即可。 - - ![zh-cn_image_0000001223877162](figures/zh-cn_image_0000001223877162.png) + > **说明:** + > DevEco Studio V2.2 Beta1及更高版本支持使用JS[低代码开发](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-low-code-development-0000001218440652)方式。 + > + > 低代码开发方式具有丰富的UI界面编辑功能,通过可视化界面开发方式快速构建布局,可有效降低开发者的上手成本并提升开发者构建UI界面的效率。 + > + > 如需使用低代码开发方式,请打开上图中的Enable Super Visual开关。 3. 点击**Finish**,工具会自动生成示例代码和相关资源,等待工程创建完成。 -## JS工程项目文件 +## JS工程目录结构 - **entry**:OpenHarmony工程模块,编译构建生成一个[HAP](../../glossary.md#hap)包。 - - **src > main > js** :用于存放js源码。 - - **src > main > js > MainAbility** :应用/服务的入口。 - - **src > main > js > MainAbility > i18n** :用于配置不同语言场景资源内容,比如应用文本词条、图片路径等资源。 - - **src > main > js > MainAbility > pages** :MainAbility包含的页面。 - - **src > main > js > MainAbility > app.js** :承载Ability生命周期。 + - **src > main > js**:用于存放js源码。 + - **src > main > js > MainAbility**:应用/服务的入口。 + - **src > main > js > MainAbility > i18n**:用于配置不同语言场景资源内容,比如应用文本词条、图片路径等资源。 + - **src > main > js > MainAbility > pages**:MainAbility包含的页面。 + - **src > main > js > MainAbility > app.js**:承载Ability生命周期。 - - **src > main > resources** :用于存放应用/服务所用到的资源文件,如图形、多媒体、字符串、布局文件等。 - - **src > main > config.json** :模块配置文件。主要包含HAP包的配置信息、应用/服务在具体设备上的配置信息以及应用/服务的全局配置信息。具体的配置文件说明,详见[应用包结构配置文件的说明](package-structure.md)。 - - **build-profile.json5** :当前的模块信息 、编译信息配置项,包括buildOption、targets配置等。 - - **hvigorfile.js** :模块级编译构建任务脚本,开发者可以自定义相关任务和代码实现。 + - **src > main > resources**:用于存放应用/服务所用到的资源文件,如图形、多媒体、字符串、布局文件等。关于资源文件,详见[资源限定与访问](../ui/js-framework-resource-restriction.md)。 + - **src > main > config.json**:模块配置文件。主要包含HAP包的配置信息、应用/服务在具体设备上的配置信息以及应用/服务的全局配置信息。具体的配置文件说明,详见[应用包结构配置文件的说明(FA模型)](package-structure.md)。 + - **build-profile.json5**:当前的模块信息 、编译信息配置项,包括buildOption、targets配置等。 + - **hvigorfile.js**:模块级编译构建任务脚本,开发者可以自定义相关任务和代码实现。 -- **build-profile.json5** :应用级配置信息,包括签名、产品配置等。 +- **build-profile.json5**:应用级配置信息,包括签名、产品配置等。 -- **hvigorfile.js** :应用级编译构建任务脚本。 +- **hvigorfile.js**:应用级编译构建任务脚本。 ## 构建第一个页面 @@ -44,7 +49,7 @@ ```html - +
Hello World @@ -57,7 +62,7 @@ ```html - +
Hello World @@ -73,6 +78,7 @@ ```css + /* index.css */ .container { display: flex; flex-direction: column; @@ -103,9 +109,7 @@ ``` 4. 在编辑窗口右上角的侧边工具栏,点击Previewer,打开预览器。第一个页面效果如下图所示: - - - ![zh-cn_image_0000001216084724](figures/zh-cn_image_0000001216084724.png) + ![zh-cn_image_0000001311494592](figures/zh-cn_image_0000001311494592.png) ## 构建第二个页面 @@ -113,14 +117,14 @@ 1. 创建第二个页面。 在“**Project**”窗口,打开“**entry > src > main > js > MainAbility**”,右键点击“**pages**”文件夹,选择“**New > Page**”,命名为“**second**”,点击“**Finish**”,即完成第二个页面的创建。可以看到文件目录结构如下: - ![zh-cn_image_0000001223877210](figures/zh-cn_image_0000001223877210.png) + ![zh-cn_image_0000001311334944](figures/zh-cn_image_0000001311334944.png) 2. 添加文本及按钮。 参照第一个页面,在第二个页面添加文本、按钮及点击按钮绑定页面返回等。“**second.hml**”文件的示例如下: ```html - +
Hi there @@ -131,9 +135,10 @@
``` -3. 设置页面样式。“**second.css**”文件的示例如下: +3. **设置页面样式。**“**second.css**”文件的示例如下: ```css + /* second.css */ .container { display: flex; flex-direction: column; @@ -200,24 +205,18 @@ } ``` -3. 打开index文件夹下的任意一个文件,点击预览器中的 ![zh-cn_image_0000001262339067](figures/zh-cn_image_0000001262339067.png) 按钮进行刷新。效果如下图所示: - - ![zh-cn_image_0000001216269940](figures/zh-cn_image_0000001216269940.png) +3. 打开index文件夹下的任意一个文件,点击预览器中的![zh-cn_image_0000001364174013](figures/zh-cn_image_0000001364174013.png)按钮进行刷新。效果如下图所示: + ![zh-cn_image_0000001311175132](figures/zh-cn_image_0000001311175132.png) ## 使用真机运行应用 1. 将搭载OpenHarmony标准系统的开发板与电脑连接。 -2. 点击**File** > **Project Structure** > **Project** > **Signing Configs**界面勾选“**Automatically generate signing**”,等待自动签名完成即可,点击“**OK**”。如下图所示: - - ![zh-cn_image_0000001223557290](figures/zh-cn_image_0000001223557290.png) - -3. 在编辑窗口右上角的工具栏,点击![zh-cn_image_0000001217047316](figures/zh-cn_image_0000001217047316.png)按钮运行。效果如下图所示: +2. 点击**File**> **Project Structure...** > **Project**>**Signing Configs**界面勾选“**Automatically generate signing**”,等待自动签名完成即可,点击“**OK**”。如下图所示: + ![06](figures/06.png) - ![zh-cn_image_0000001217527892](figures/zh-cn_image_0000001217527892.png) +3. 在编辑窗口右上角的工具栏,点击![zh-cn_image_0000001311494604](figures/zh-cn_image_0000001311494604.png)按钮运行。效果如下图所示: + ![zh-cn_image_0000001363934589](figures/zh-cn_image_0000001363934589.png) -恭喜您已经使用JS语言开发(传统代码方式)完成了第一个OpenHarmony应用,快来[探索更多的OpenHarmony功能](../application-dev-guide.md)吧。 -## 相关实例 -针对使用JS语言(传统代码方式)开发快速入门,有以下相关实例可供参考: -- [`JsHelloWorld`:你好世界(JS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/common/JsHelloWorld) +恭喜您已经使用JS语言开发(FA模型)完成了第一个OpenHarmony应用,快来[探索更多的OpenHarmony功能](../application-dev-guide.md)吧。 diff --git a/zh-cn/application-dev/quick-start/start-with-js-low-code.md b/zh-cn/application-dev/quick-start/start-with-js-low-code.md deleted file mode 100644 index bdd4bfad89140eacc919502e19bd0993885a3dff..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/quick-start/start-with-js-low-code.md +++ /dev/null @@ -1,170 +0,0 @@ -# 使用JS语言开发(低代码方式) - - -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 该特性在**DevEco Studio V2.2 Beta1**及更高版本中支持。 -> -> 为确保运行效果,本文以使用**DevEco Studio V3.0.0.900 Beta3**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download_beta_openharmony)获取下载链接。 - - -OpenHarmony低代码开发方式具有丰富的UI界面编辑功能,通过可视化界面开发方式快速构建布局,可有效降低开发者的上手成本并提升开发者构建UI界面的效率。 - - -使用低代码开发应用或服务有以下两种开发方式: - - -- 直接创建一个支持低代码开发的新工程以进行开发。本文以此方式为例进行说明。 - -- 在已有工程中,创建visual文件来进行开发。此种方式的操作可参考[创建visual文件支持低代码开发](#构建第二个页面)。 - - -## 创建新工程支持低代码开发 - -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 该功能在DevEco Studio 3.0 Beta2及更高版本中支持,且compileSdkVersion必须为7或以上。 - -1. 若首次打开**DevEco Studio**,请点击**Create Project**创建工程。如果已有一个工程,请点击**File** > **New** > **Create Project**。选择模板“**Empty Ability**”,点击**Next**进行下一步配置。 - - ![zh-cn_image_0000001268198893](figures/zh-cn_image_0000001268198893.png) - -2. 进入配置工程界面,打开“**Enable Super Visual**”开关,**UI Syntax**选择“**JS**”,其他参数保持默认设置即可。 - - ![zh-cn_image_0000001223717294](figures/zh-cn_image_0000001223717294.png) - -3. 点击**Finish**,工具会自动生成示例代码和相关资源,等待工程创建完成。 - - -## 低代码开发工程项目文件 - -工程同步完成后,自动生成以下目录结构: - -![zh-cn_image_0000001223558810](figures/zh-cn_image_0000001223558810.png) - -- **entry > src > main > js > MainAbility > pages > index > index.js** :低代码页面的逻辑描述文件,定义了页面里所用到的所有的逻辑关系,比如数据、事件等,详情请参考[JS语法参考](../ui/js-framework-syntax-js.md)。如果创建了多个低代码页面,则pages目录下会生成多个页面文件夹及对应的js文件。 - - > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** - > 使用低代码页面开发时,其关联js文件的同级目录中不能包含hml和css页面,例如上图中的 **js > MainAbility > pages > index** 目录下不能包含hml与css文件,否则会出现编译报错。 - -- **entry > src > main > supervisual > MainAbility > pages > index > index.visual** :visual文件存储低代码页面的数据模型,双击该文件即可打开低代码页面,进行可视化开发设计。如果创建了多个低代码页面,则pages目录下会生成多个页面文件夹及对应的visual文件。 - - -## 构建第一个页面 - -工程同步完成后,第一个页面已有一个容器、一段文本(Hello World)显示。为了更详细地了解低代码开发,我们将删除画布原有模板组件,从零开始完成页面的添加、设置。 - -第一个页面内有一个容器、一段文本和一个按钮,通过Div、Text和Button组件来实现。 - -1. 删除画布原有模板组件。 - 打开index.visual文件,选中画布中的组件,单击鼠标右键,选择Delete删除画布原有模板组件。操作如下所示: - - ![zh-cn_image_0000001216600980](figures/zh-cn_image_0000001216600980.gif) - -2. 添加容器,设置Div容器的样式和属性。 - 选中UI Control中的Div组件,将其拖至画布。点击右侧属性样式栏中的样式图标![zh-cn_image_0000001260226691](figures/zh-cn_image_0000001260226691.png)(General),设置Div组件的高度Height为100%,使其占满屏幕;点击右侧属性样式栏中的样式图标![zh-cn_image_0000001215226858](figures/zh-cn_image_0000001215226858.png)(Flex),设置Div组件的FlexDirection样式为column,使Div的主轴垂直;设置Div组件的JustifyContent样式为center,使得其子组件在主轴上居中显示;设置Div组件的AlignItems样式为center,使得其子组件在交叉轴上居中显示。操作如下所示: - - ![zh-cn_image_0000001216448880](figures/zh-cn_image_0000001216448880.gif) - -3. 添加文本。 - 选中UI Control中的Text组件,将其拖至Div组件的中央区域。点击右侧属性样式栏中的属性图标![zh-cn_image_0000001215066868](figures/zh-cn_image_0000001215066868.png)(Properties),设置Text组件的Content属性为“Hello World”;点击右侧属性样式栏中的样式图标![zh-cn_image_0000001215386842](figures/zh-cn_image_0000001215386842.png)(Feature),设置组件的FontSize样式为60px,使得其文字放大;设置组件的TextAlign样式为center,使得组件文字居中显示。再选中画布上的Text组件,拖动放大。操作如下所示: - - ![zh-cn_image_0000001216446670](figures/zh-cn_image_0000001216446670.gif) - -4. 添加按钮。 - 选中UI Control中的Button组件,将其拖至Text组件下面。点击右侧属性样式栏中的属性图标![zh-cn_image_0000001260106745](figures/zh-cn_image_0000001260106745.png)(Properties),设置Button组件的Value属性为“Next”,点击右侧属性样式栏中的样式图标![zh-cn_image_0000001259866741](figures/zh-cn_image_0000001259866741.png)(Feature),设置组件的FontSize样式为40px,使得其文字放大;再选中画布上的Button组件,拖动放大。操作如下所示: - - ![zh-cn_image_0000001260928361](figures/zh-cn_image_0000001260928361.gif) - -5. 在编辑窗口右上角的侧边工具栏,点击Previewer,打开预览器。第一个页面效果如下图所示: - - ![zh-cn_image_0000001216288558](figures/zh-cn_image_0000001216288558.png) - - -## 构建第二个页面 - -1. 创建第二个页面。 - 在“**Project**”窗口,打开“**entry > src > main > js > MainAbility**”,右键点击“**pages**”文件夹,选择“**New > Visual**”,命名为“**second**”,单击“**Finish**”,即完成第二个页面的创建。 - 新建visual文件的操作如下: - - create-newVisual - - 可以看到文件目录结构如下: - - ![zh-cn_image_0000001223882030](figures/zh-cn_image_0000001223882030.png) - -2. [删除画布原有模板组件。](#delete_origin_content) - -3. [添加容器,设置Div容器的样式和属性。](#add_container) - -4. 添加文本。 - 选中Text组件,拖至Div组件的中央区域。点击右侧属性样式栏中的属性图标![zh-cn_image_0000001260227453](figures/zh-cn_image_0000001260227453.png)(Properties),设置Text组件的Content属性为“Hi there”;点击右侧属性样式栏中的样式图标![zh-cn_image_0000001260107497](figures/zh-cn_image_0000001260107497.png)(Feature),设置组件的FontSize样式为60px;设置组件的TextAlign样式为center。再选中画布上的Text组件,拖动放大。操作如下所示: - - ![zh-cn_image_0000001216614132](figures/zh-cn_image_0000001216614132.gif) - -5. 添加按钮。 - 选中UI Control中的Button组件,将其拖至Text组件下面。点击右侧属性样式栏中的属性图标![zh-cn_image_0000001215227618](figures/zh-cn_image_0000001215227618.png)(Properties),设置Button组件的Value属性为“Back”,点击右侧属性样式栏中的样式图标![zh-cn_image_0000001259987441](figures/zh-cn_image_0000001259987441.png)(Feature),设置组件的FontSize样式为40px,使得其文字放大;再选中画布上的Button组件,拖动放大。操作如下所示: - - ![zh-cn_image_0000001261017331](figures/zh-cn_image_0000001261017331.gif) - - -## 实现页面间的跳转 - -页面间的导航可以通过[页面路由router](../ui/ui-js-building-ui-routes.md)来实现。页面路由router根据页面url找到目标页面,从而实现跳转。使用页面路由请导入router模块。 - -1. 第一个页面跳转到第二个页面。 - 在第一个页面中,跳转按钮绑定onclick方法,点击按钮时跳转到第二页。需同时处理js文件及visual文件。 - - “**index.js**”示例如下: - - ```js - import router from '@ohos.router'; - - export default { - onclick() { - router.push({ - url:'pages/second/second', // 指定要跳转的页面 - }) - } - } - ``` - - - “**index.visual**”: 打开index.visual,选中画布上的Button组件。点击右侧属性样式栏中的事件图标![zh-cn_image_0000001215388136](figures/zh-cn_image_0000001215388136.png)(Events),鼠标点击Click事件的输入框,选择onclick,如下所示: - - ![zh-cn_image_0000001223722586](figures/zh-cn_image_0000001223722586.png) - -2. 第二个页面返回到第一个页面。 - 在第二个页面中,返回按钮绑定back方法,点击按钮时返回到第一页。 - - 需同时处理js文件及visual文件。 - - - “**second.js**”示例如下: - - ```js - import router from '@ohos.router'; - - export default { - back() { - router.back() - } - } - ``` - - “**second.visual**”: 打开second.visual,选中画布上的Button组件。点击右侧属性样式栏中的事件图标![zh-cn_image_0000001215388262](figures/zh-cn_image_0000001215388262.png)(Events),鼠标点击Click事件的输入框,选择back,如下所示: - - ![zh-cn_image_0000001268082945](figures/zh-cn_image_0000001268082945.png) - -3. 打开index.visual或index.js文件,点击预览器中的 ![zh-cn_image_0000001261979271](figures/zh-cn_image_0000001261979271.png) 按钮进行刷新。效果如下图所示: - - ![zh-cn_image_0000001261142799](figures/zh-cn_image_0000001261142799.png) - - -## 使用真机运行应用 - -1. 将搭载OpenHarmony标准系统的开发板与电脑连接。 - -2. 点击**File** > **Project Structure** > **Project** > **Signing Configs**界面勾选“**Automatically generate signing**”,等待自动签名完成即可,点击“**OK**”。如下图所示: - - ![zh-cn_image_0000001268283201](figures/zh-cn_image_0000001268283201.png) - -3. 在编辑窗口右上角的工具栏,点击![zh-cn_image_0000001262207811](figures/zh-cn_image_0000001262207811.png)按钮运行。效果如下图所示: - - ![zh-cn_image_0000001262127855](figures/zh-cn_image_0000001262127855.png) - -恭喜您已经使用JS语言开发(低代码方式)完成了第一个OpenHarmony应用,快来[探索更多的OpenHarmony功能](../application-dev-guide.md)吧。 diff --git a/zh-cn/application-dev/reference/apis/Readme-CN.md b/zh-cn/application-dev/reference/apis/Readme-CN.md index e3e3ed792be478083abb801f9cb62c151aa4f0f2..c5624597587250de137733ebd6d8ffb36bbccb48 100755 --- a/zh-cn/application-dev/reference/apis/Readme-CN.md +++ b/zh-cn/application-dev/reference/apis/Readme-CN.md @@ -200,7 +200,9 @@ - [@ohos.screenLock (锁屏管理)](js-apis-screen-lock.md) - [@ohos.systemTime (设置系统时间)](js-apis-system-time.md) - [@ohos.wallpaper (壁纸)](js-apis-wallpaper.md) + - [@ohos.systemTimer(设置系统时间)](js-apis-system-timer.md) - [Timer (定时器)](js-apis-timer.md) + - 设备管理 - [@ohos.batteryInfo (电量信息)](js-apis-battery-info.md) diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md index dd960f8294fa7b03b3183bedb0431e73dfc29809..cd16f889508f3adcefabc621304527d06c1a2b88 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md @@ -2,7 +2,8 @@ 本模块提供内部包的管理 -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** +> > 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 @@ -48,7 +49,7 @@ SystemCapability.BundleManager.BundleFramework | ---------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- | | bundleName | string | 是 | 要查询的应用程序包名称。 | | userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | -| callback | AsyncCallback> | 是 | 程序启动作为入参的回调函数,返回程序信息。 | +| callback | AsyncCallback\> | 是 | 程序启动作为入参的回调函数,返回程序信息。 | @@ -81,7 +82,7 @@ SystemCapability.BundleManager.BundleFramework | 类型 | 说明 | | ------------------------------------------------------------ | ------------------------- | -| Promise\<[LauncherAbilityInfo](js-apis-bundle-LauncherAbilityInfo.md)> | Promise形式返回程序信息。 | +| Promise\> | Promise形式返回程序信息。 | ## innerBundleManager.on @@ -107,7 +108,7 @@ SystemCapability.BundleManager.BundleFramework | -------------------- | --------------------- | ---- | ---------------------------------------------------- | | type | "BundleStatusChange" | 是 | 指示应执行命令。 | | bundleStatusCallback | BundleStatusCallback | 是 | 指示要注册的回调。 | -| callback | AsyncCallback | 是 | 程序启动作为入参的回调函数,返回正确结果或错误信息。 | +| callback | AsyncCallback\ | 是 | 程序启动作为入参的回调函数,返回正确结果或错误信息。 | ## innerBundleManager.on @@ -138,7 +139,7 @@ SystemCapability.BundleManager.BundleFramework | 类型 | 说明 | | --------------- | ----------------------------------- | -| Promise | Promise形式返回正确结果或错误信息。 | +| Promise\ | Promise形式返回正确结果或错误信息。 | ## innerBundleManager.off @@ -163,7 +164,7 @@ SystemCapability.BundleManager.BundleFramework | 名称 | 类型 | 必填 | 描述 | | -------- | --------------------- | ---- | ---------------------------------------------------- | | type | "BundleStatusChange" | 是 | 指示应执行命令。 | -| callback | AsyncCallback | 是 | 程序启动作为入参的回调函数,返回正确结果或错误信息。 | +| callback | AsyncCallback\ | 是 | 程序启动作为入参的回调函数,返回正确结果或错误信息。 | ## innerBundleManager.off @@ -193,13 +194,13 @@ SystemCapability.BundleManager.BundleFramework | 类型 | 说明 | | --------------- | ----------------------------------- | -| Promise | Promise形式返回正确结果或错误信息。 | +| Promise\ | Promise形式返回正确结果或错误信息。 | ## innerBundleManager.getAllLauncherAbilityInfos getAllLauncherAbilityInfos(userId: number, callback: AsyncCallback<Array<LauncherAbilityInfo>>) : void; -以异步方法根据给定的包名获取所有的LauncherAbilityInfos,使用callback形式返回结果。 +以异步方法获取所有的LauncherAbilityInfos,使用callback形式返回结果。 **需要权限:** @@ -218,13 +219,13 @@ SystemCapability.BundleManager.BundleFramework | 名称 | 类型 | 必填 | 描述 | | -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- | | userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | -| callback | AsyncCallback> | 是 | 程序启动作为入参的回调函数,返回程序信息。 | +| callback | AsyncCallback\> | 是 | 程序启动作为入参的回调函数,返回程序信息。 | ## innerBundleManager.getAllLauncherAbilityInfos getAllLauncherAbilityInfos(userId: number) : Promise<Array<LauncherAbilityInfo>> -以异步方法根据给定的包名获取LauncherAbilityInfos,使用Promise形式返回结果。 +以异步方法获取LauncherAbilityInfos,使用Promise形式返回结果。 **需要权限:** @@ -248,7 +249,7 @@ SystemCapability.BundleManager.BundleFramework | 类型 | 说明 | | ------------------------------------------------------------ | ------------------------- | -| Promise\<[LauncherAbilityInfo](js-apis-bundle-LauncherAbilityInfo.md)> | Promise形式返回程序信息。 | +| Promise\> | Promise形式返回程序信息。 | ## innerBundleManager.getShortcutInfos @@ -273,7 +274,7 @@ SystemCapability.BundleManager.BundleFramework | 名称 | 类型 | 必填 | 描述 | | ---------- | ------------------------------------------------------------ | ---- | ---------------------------------------------- | | bundleName | string | 是 | 要查询的应用程序包名称。 | -| callback | AsyncCallback> | 是 | 程序启动作为入参的回调函数,返回快捷方式信息。 | +| callback | AsyncCallback\> | 是 | 程序启动作为入参的回调函数,返回快捷方式信息。 | ## innerBundleManager.getShortcutInfos @@ -303,5 +304,5 @@ SystemCapability.BundleManager.BundleFramework | 类型 | 说明 | | -------------------------------------------------------- | ----------------------------- | -| Promise\<[ShortcutInfo](js-apis-bundle-ShortcutInfo.md)> | Promise形式返回快捷方式信息。 | +| Promise\> | Promise形式返回快捷方式信息。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md index 4d56ae1f358889500fcc3787560a3dc8eeea27b3..a32fdcc7d7e01ff4e05ce885ec2cdfeee288c6dc 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md @@ -1,8 +1,9 @@ # distributedBundle模块(JS端SDK接口) -本模块提供内部包的管理 +本模块提供分布式包的管理 -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** +> > 本模块首批接口从API version 8 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 @@ -27,7 +28,7 @@ SystemCapability.BundleManager.DistributedBundleFramework getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback<RemoteAbilityInfo>): void; -以异步方法根据给定的包名获取有关远程设备AbilityInfo信息,使用callback形式返回结果。 +以异步方法根据给定的ElementName获取有关远程设备AbilityInfo信息,使用callback形式返回结果。 **需要权限:** @@ -54,7 +55,7 @@ SystemCapability.BundleManager.DistributedBundleFramework getRemoteAbilityInfo(elementName: ElementName): Promise<RemoteAbilityInfo> -以异步方法根据给定的包名获取有关远程设备AbilityInfo信息,使用Promise形式返回结果。 +以异步方法根据给定的ElementName获取有关远程设备AbilityInfo信息,使用Promise形式返回结果。 **需要权限:** @@ -84,7 +85,7 @@ SystemCapability.BundleManager.DistributedBundleFramework getRemoteAbilityInfos(elementNames: Array<ElementName>, callback: AsyncCallback<Array<RemoteAbilityInfo>>): void; -以异步方法根据给定的包名获取有关远程设备AbilityInfos信息,使用callback形式返回结果。 +以异步方法根据给定的ElementName获取有关远程设备AbilityInfos信息,使用callback形式返回结果。 **需要权限:** @@ -111,7 +112,7 @@ SystemCapability.BundleManager.DistributedBundleFramework getRemoteAbilityInfos(elementNames: Array<ElementName>): Promise<Array<RemoteAbilityInfo>> -以异步方法根据给定的包名获取有关远程设备AbilityInfo信息,使用Promise形式返回结果。 +以异步方法根据给定的ElementName获取有关远程设备AbilityInfos信息,使用Promise形式返回结果。 **需要权限:** @@ -129,7 +130,7 @@ SystemCapability.BundleManager.DistributedBundleFramework | 名称 | 类型 | 必填 | 描述 | | ------------ | --------------------------------------------------- | ---- | ----------------------- | -| elementNames | Array<[ElementName](js-apis-bundle-ElementName.md)> | 是 | 获得的ElementName信息。 | +| elementNames | Array<[ElementName](js-apis-bundle-ElementName.md)> | 是 | ElementName信息,最大数组长度为10。 | **返回值:** 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 ce4e117c246682340b6c063ffaf33fe5b80755be..61dd1a23ddb25ee89c13f0527597e0cb37e14c99 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md @@ -536,7 +536,7 @@ SystemCapability.BundleManager.BundleFramework ## bundle.setAbilityEnabled8+ -setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback<void>): void; +setAbilityEnabled(info: AbilityInfo, isEnable: boolean, callback: AsyncCallback<void>): void; 设置是否启用指定的功能 @@ -1510,7 +1510,7 @@ bundle.queryAbilityByWant(want, bundleFlags, userId) queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback>): void -以异步方法根据给定的意图获取获取指定用户下Ability信息,使用callback形式返回结果。 +以异步方法根据给定的意图获取指定用户下Ability信息,使用callback形式返回结果。 **需要权限:** @@ -1897,8 +1897,8 @@ SystemCapability.BundleManager.BundleFramework | 名称 | 类型 | 必填 | 描述 | | -------------- | ------ | ---- | ---------------------------------------- | | want | [Want](js-apis-application-Want.md) | 是 | 包含要查询的应用程序包名称的意图。 | -| extensionType | number | 是 | 用于指定查找的extensionAbilityInfo的类型。 默认值:0,取值范围:枚举值: [ExtensionAbilityType](#ExtensionAbilityType9) | -| extensionFlags | number | 是 | 用于指定返回ExtensionAbilityInfo信息。默认值:0,取值范围:枚举值: [ExtensionFlags](#ExtensionFlag9) | +| extensionType | number | 是 | 用于指定查找的extensionAbilityInfo的类型。 默认值:0,取值范围:枚举值: [ExtensionAbilityType](#extensionabilitytype9) | +| extensionFlags | number | 是 | 用于指定返回ExtensionAbilityInfo信息。默认值:0,取值范围:枚举值: [ExtensionFlags](#extensionflag9) | | userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0 | **返回值:** @@ -1946,8 +1946,8 @@ SystemCapability.BundleManager.BundleFramework | 名称 | 类型 | 必填 | 描述 | | -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | want | [Want](js-apis-application-Want.md) | 是 | 指示包含要查询的应用程序包名称的意图。 | -| extensionType | number | 是 | 用于指定查找的extensionAbilityInfo的类型。 默认值:0,取值范围:枚举值: [ExtensionAbilityType](#ExtensionAbilityType9) | -| extensionFlags | number | 是 | 用于指定返回ExtensionAbilityInfo信息。默认值:0,取值范围:枚举值: [ExtensionFlags](#ExtensionFlag9)| +| extensionType | number | 是 | 用于指定查找的extensionAbilityInfo的类型。 默认值:0,取值范围:枚举值: [ExtensionAbilityType](#extensionabilitytype9) | +| extensionFlags | number | 是 | 用于指定返回ExtensionAbilityInfo信息。默认值:0,取值范围:枚举值: [ExtensionFlags](#extensionflag9)| | userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0 | | callback | AsyncCallback> | 是 | 程序启动作为入参的回调函数,返回ExtensionAbility信息。 | @@ -1989,8 +1989,8 @@ SystemCapability.BundleManager.BundleFramework | 名称 | 类型 | 必填 | 描述 | | -------------- | ---------------------------------------- | ---- | ---------------------------------------- | | want | [Want](js-apis-application-Want.md) | 是 | 指示包含要查询的应用程序包名称的意图。 | -| extensionType | number | 是 | 用于指定查找的extensionAbilityInfo的类型。 默认值:0,取值范围:枚举值: [ExtensionAbilityType](#ExtensionAbilityType9) | -| extensionFlags | number | 是 | 用于指定返回ExtensionAbilityInfo信息。默认值:0,取值范围:枚举值: [ExtensionFlags](#ExtensionFlag9) | +| extensionType | number | 是 | 用于指定查找的extensionAbilityInfo的类型。 默认值:0,取值范围:枚举值: [ExtensionAbilityType](#extensionabilitytype9) | +| extensionFlags | number | 是 | 用于指定返回ExtensionAbilityInfo信息。默认值:0,取值范围:枚举值: [ExtensionFlags](#extensionflag9) | | callback | AsyncCallback> | 是 | 程序启动作为入参的回调函数,返回ExtensionAbility信息。 | **示例:** @@ -2147,7 +2147,7 @@ bundle.getProfileByExtensionAbility(moduleName, extensionAbilityName, metadataNa setDisposedStatus(bundleName: string, status: number, callback: AsyncCallback\): void; -此接口为系统接口,以异步方法根据给定的bundleName和status来设置对应应用的处置状态,使用callback形式返回结果。 +以异步方法根据给定的bundleName和status来设置对应应用的处置状态,使用callback形式返回结果。 **需要权限:** ohos.permission.MANAGE_DISPOSED_APP_STATUS @@ -2179,7 +2179,7 @@ bundle.setDisposedStatus(bundleName, status, caller) setDisposedStatus(bundleName: string, status: number): Promise\; -此接口为系统接口,以异步方法根据给定的bundleName和status来设置对应应用的处置状态,使用Promise形式返回结果。 +以异步方法根据给定的bundleName和status来设置对应应用的处置状态,使用Promise形式返回结果。 **需要权限:** ohos.permission.MANAGE_DISPOSED_APP_STATUS @@ -2217,6 +2217,8 @@ bundle.setDisposedStatus(bundleName, status).then(data=>{ getDisposedStatus(bundleName: string, callback: AsyncCallback\): void; +以异步方法根据给定的bundleName来获取对应应用的处置状态,使用callback形式返回结果。 + **需要权限:** ohos.permission.MANAGE_DISPOSED_APP_STATUS **系统能力:** SystemCapability.BundleManager.BundleFramework @@ -2245,7 +2247,7 @@ bundle.getDisposedStatus(bundleName, caller) getDisposedStatus(bundleName: string): Promise\; -此接口为系统接口,以异步方法根据给定的bundleName来获取对应应用的处置状态,使用Promise形式返回结果。 +以异步方法根据给定的bundleName来获取对应应用的处置状态,使用Promise形式返回结果。 **需要权限:** ohos.permission.MANAGE_DISPOSED_APP_STATUS diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-Want.md b/zh-cn/application-dev/reference/apis/js-apis-application-Want.md index fe90a7f82ece3a649a0d803391df1eec09697f6d..4caa15330e98b80ea127c89dc122d50e85fe298b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-Want.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-Want.md @@ -31,15 +31,87 @@ import Want from '@ohos.application.Want'; **示例:** -``` js - var want = { - "deviceId": "", // deviceId为空表示本设备 - "bundleName": "com.extreme.test", - "abilityName": "MainAbility", - "moduleName": "entry" // moduleName非必选 - }; - this.context.startAbility(want, (error) => { - // 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability - console.log("error.code = " + error.code) - }) -``` +- 基础用法 + + ``` js + var want = { + "deviceId": "", // deviceId为空表示本设备 + "bundleName": "com.extreme.test", + "abilityName": "MainAbility", + "moduleName": "entry" // moduleName非必选 + }; + this.context.startAbility(want, (error) => { + // 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability + console.log("error.code = " + error.code) + }) + ``` + +- 传递FD数据,FD表示文件描述符(FileDescriptor) + + ``` js + var fd; + try { + fd = fileio.openSync("/data/storage/el2/base/haps/pic.png"); + } catch(e) { + console.log("openSync fail:" + JSON.stringify(e)); + } + var want = { + "deviceId": "", // deviceId为空表示本设备 + "bundleName": "com.extreme.test", + "abilityName": "MainAbility", + "moduleName": "entry" // moduleName非必选 + "parameters": { + "keyFd":{"type":"FD", "value":fd} + } + }; + this.context.startAbility(want, (error) => { + // 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability + console.log("error.code = " + error.code) + }) + ``` + +- 传递RemoteObject数据 + + ``` js + class Stub extends rpc.RemoteObject { + constructor(des) { + if (typeof des == 'string') { + super(des); + } else { + return null; + } + } + + onRemoteRequest(code, data, reply, option) { + if (code === 1) { + console.log('onRemoteRequest called') + let token = data.readInterfaceToken(); + let num = data.readInt(); + this.method(); + return true; + } + return false; + } + + method() { + console.log('method called'); + } + } + + var remoteObject = new Stub('want-test'); + var want = { + "deviceId": "", // deviceId为空表示本设备 + "bundleName": "com.extreme.test", + "abilityName": "MainAbility", + "moduleName": "entry" // moduleName非必选 + "parameters": { + "keyRemoteObject":{"type":"RemoteObject", "value":remoteObject} + } + }; + this.context.startAbility(want, (error) => { + // 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability + console.log("error.code = " + error.code) + }) + ``` + + diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md b/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md index 3c585bdd09536059377027115a5c85e561674196..4d3076f97c57dd54f485927a5cef3ca0ad6d4de2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md @@ -20,11 +20,13 @@ var args = AbilityDelegatorRegistry.getArguments(); 测试参数信息 +**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core + | 名称 | 类型 | 可读 | 可写 | 说明 | | ------------------- | ---------------------- | ---- | ---- | ------------------------------------------------------------ | -| bundleName | string | 是 | 是 | 当前被测试应用的包名
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core | -| parameters | {[key:string]: string} | 是 | 是 | 当前启动单元测试的参数
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core | -| testCaseNames | string | 是 | 是 | 测试用例名称
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core | -| testRunnerClassName | string | 是 | 是 | 执行测试用例的测试执行器的名称
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core | +| bundleName | string | 是 | 是 | 当前被测试应用的包名 | +| parameters | {[key:string]: string} | 是 | 是 | 当前启动单元测试的参数 | +| testCaseNames | string | 是 | 是 | 测试用例名称 | +| testRunnerClassName | string | 是 | 是 | 执行测试用例的测试执行器的名称 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-abilityMonitor.md b/zh-cn/application-dev/reference/apis/js-apis-application-abilityMonitor.md index df6b0968eef4ed2d6026faf4872d04b3890fa49c..64ffa05699b2148d5440938e8c9d6001005cfd12 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-abilityMonitor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-abilityMonitor.md @@ -33,15 +33,17 @@ abilityDelegator.addAbilityMonitor(monitor, (err : any) => { Ability监听器 +系统能力:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core + | 名称 | 类型 | 可读 | 可写 | 说明 | | ------------------------------------------------------------ | -------- | ---- | ---- | ------------------------------------------------------------ | | abilityName | string | 是 | 是 | 当前AbilityMonitor绑定的ability名称
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core | -| onAbilityCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | 是 | 是 | ability被启动初始化时的回调函数
不设置该属性则不能收到该生命周期回调
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core | -| onAbilityForeground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | 是 | 是 | ability状态变成前台时的回调函数
不设置该属性则不能收到该生命周期回调
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core | -| onAbilityBackground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | 是 | 是 | ability状态变成后台时的回调函数
不设置该属性则不能收到该生命周期回调
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core | -| onAbilityDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | 是 | 是 | ability被销毁前的回调函数
不设置该属性则不能收到该生命周期回调
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core | -| onWindowStageCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | 是 | 是 | window stage被创建时的回调函数
不设置该属性则不能收到该生命周期回调
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core | -| onWindowStageRestore?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | 是 | 是 | window stage被重载时的回调函数
不设置该属性则不能收到该生命周期回调
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core | -| onWindowStageDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | 是 | 是 | window stage被销毁前的回调函数
不设置该属性则不能收到该生命周期回调
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core | +| onAbilityCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | 是 | 是 | ability被启动初始化时的回调函数
不设置该属性则不能收到该生命周期回调 | +| onAbilityForeground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | 是 | 是 | ability状态变成前台时的回调函数
不设置该属性则不能收到该生命周期回调 | +| onAbilityBackground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | 是 | 是 | ability状态变成后台时的回调函数
不设置该属性则不能收到该生命周期回调 | +| onAbilityDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | 是 | 是 | ability被销毁前的回调函数
不设置该属性则不能收到该生命周期回调
| +| onWindowStageCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | 是 | 是 | window stage被创建时的回调函数
不设置该属性则不能收到该生命周期回调
| +| onWindowStageRestore?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | 是 | 是 | window stage被重载时的回调函数
不设置该属性则不能收到该生命周期回调
| +| onWindowStageDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | 是 | 是 | window stage被销毁前的回调函数
不设置该属性则不能收到该生命周期回调
| diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-applicationContext.md b/zh-cn/application-dev/reference/apis/js-apis-application-applicationContext.md index 91a467c2e41ffbe9e3d062249cf264025bb39894..7705d4bd7c71ddb7ae42fd1ce52e838849a4b8fb 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-applicationContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-applicationContext.md @@ -28,7 +28,7 @@ registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): **number** | 参数名 | 类型 | 必填 | 说明 | | ------------------------ | -------- | ---- | ------------------------------ | -| [AbilityLifecycleCallback](js-apis-application-abilityLifecycleCallback.md) | callback | 是 | 回调方法,返回注册监听事件的ID。 | +| callback | [AbilityLifecycleCallback](js-apis-application-abilityLifecycleCallback.md) | 是 | 回调方法,返回注册监听事件的ID。 | **返回值:** @@ -98,7 +98,7 @@ unregisterAbilityLifecycleCallback(callbackId: **number**, callback: AsyncCallb | 参数名 | 类型 | 必填 | 说明 | | ------------- | -------- | ---- | -------------------------- | | callbackId | number | 是 | 注册监听应用内生命周期的ID。 | -| AsyncCallback | callback | 是 | 回调方法。 | +| callback | AsyncCallback\ | 是 | 回调方法。 | **示例:** @@ -123,7 +123,7 @@ registerEnvironmentCallback(callback: EnvironmentCallback): **number**; | 参数名 | 类型 | 必填 | 说明 | | ------------------------ | -------- | ---- | ------------------------------ | -| [EnvironmentCallback](js-apis-application-EnvironmentCallback.md) | callback | 是 | 回调方法,返回注册监听事件的ID。 | +| callback | [EnvironmentCallback](js-apis-application-EnvironmentCallback.md) | 是 | 回调方法,返回注册监听事件的ID。 | **返回值:** @@ -175,7 +175,7 @@ unregisterEnvironmentCallback(callbackId: **number**, callback: AsyncCallback<* | 参数名 | 类型 | 必填 | 说明 | | ------------- | -------- | ---- | -------------------------- | | callbackId | number | 是 | 注册监听系统环境变化的ID。 | -| AsyncCallback | callback | 是 | 回调方法。 | +| callback | AsyncCallback\ | 是 | 回调方法。 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-context.md b/zh-cn/application-dev/reference/apis/js-apis-application-context.md index bcb6005cd25490b112d3f50de4382e498851a08b..b8f385ca6ed186b99659199e936c60975e6263d7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-context.md @@ -7,8 +7,6 @@ Context模块提供开发者运行代码的上下文环境的能力,包括查 > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块接口仅可在Stage模型下使用。 -提供开发者运行代码的上下文环境,包括应用信息、ResourceManager等信息。 - ## 使用说明 通过AbilityContext等继承实现。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-shellCmdResult.md b/zh-cn/application-dev/reference/apis/js-apis-application-shellCmdResult.md index ae8f7c42862086343031cddbc6fb0a81ccee88d7..2c9f76234fb7eec46f45e2faf3d09f2bf980b7ae 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-shellCmdResult.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-shellCmdResult.md @@ -30,5 +30,5 @@ Shell命令执行结果 | 名称 | 类型 | 可读 | 可写 | 说明 | | --------- | ------ | ---- | ---- | ------------------------------------------------------------ | -| stdResult | string | 是 | 是 | 标准输出内容
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core | -| exitCode | number | 是 | 是 | 结果码
**系统能力:** SystemCapability.Ability.AbilityRuntime.Core | +| stdResult | string | 是 | 是 | 标准输出内容 | +| exitCode | number | 是 | 是 | 结果码 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-appmanager.md b/zh-cn/application-dev/reference/apis/js-apis-appmanager.md index c23fba3ad41639ac832219c4001dc34c8f699395..7688a46b0bec337a7cecc801e2855afd576328c6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-appmanager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-appmanager.md @@ -694,7 +694,7 @@ console.log('-------- processDiedInfo: ---------', processDiedInfo); | ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | | bundleName8+ | 只读 | string | 否 | 包名。 | | uid8+ | 只读 | number | 否 | 用户ID。 | -| state8+ | 只读 | number | 否 | 进程信息。 | +| state8+ | 只读 | number | 否 | 应用状态。 | ## AbilityStateData @@ -708,7 +708,7 @@ console.log('-------- processDiedInfo: ---------', processDiedInfo); | bundleName8+ | string | 是 | 否 | 应用包名。 | | abilityName8+ | string | 是 | 否 | Ability名称。 | | uid8+ | number | 是 | 否 | 用户ID。 | -| state8+ | number | 是 | 否 | 应用程序信息。 | +| state8+ | number | 是 | 否 | Ability状态。 | | moduleName9+ | string | 是 | 否 | Ability所属的HAP包的名称。 | | abilityType8+ | string | 是 | 否 | 能力类型、页面或服务等。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-audio.md b/zh-cn/application-dev/reference/apis/js-apis-audio.md index a3bd5bc6b452bb0f5565c05a0c888eb60a373b10..f42b90abb0d58da82d213a56dff3f0a9bad5b56a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-audio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-audio.md @@ -619,8 +619,8 @@ audio.createAudioCapturer(audioCapturerOptions).then((data) => { | 名称 | 类型 | 必填 | 说明 | | :---------------- | :------------------------------------------------ | :--- | :----------------- | -| type | [DeviceChangeType](#DeviceChangeType) | 是 | 设备连接状态变化。 | -| deviceDescriptors | [AudioDeviceDescriptors](#AudioDeviceDescriptors) | 是 | 设备信息。 | +| type | [DeviceChangeType](#devicechangetype) | 是 | 设备连接状态变化。 | +| deviceDescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | 是 | 设备信息。 | ## DeviceChangeType @@ -1675,7 +1675,7 @@ on(type: 'deviceChange', callback: Callback): void | 参数名 | 类型 | 必填 | 说明 | | :------- | :--------------------------------------------------- | :--- | :----------------------------------------- | | type | string | 是 | 订阅的事件的类型。支持事件:'deviceChange' | -| callback | Callback<[DeviceChangeAction](#DeviceChangeAction)\> | 是 | 获取设备更新详情。 | +| callback | Callback<[DeviceChangeAction](#devicechangeaction)\> | 是 | 获取设备更新详情。 | **示例:** @@ -1701,7 +1701,7 @@ off(type: 'deviceChange', callback?: Callback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------------------------- | ---- | ------------------------------------------ | | type | string | 是 | 订阅的事件的类型。支持事件:'deviceChange' | -| callback | Callback<[DeviceChangeAction](#DeviceChangeAction)> | 否 | 获取设备更新详情。 | +| callback | Callback<[DeviceChangeAction](#devicechangeaction)> | 否 | 获取设备更新详情。 | **示例:** @@ -1912,7 +1912,7 @@ getCurrentAudioRendererInfoArray(callback: AsyncCallback<AudioRendererChangeI **示例:** ``` audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { - console.info('[GET_RENDERER_STATE_1_CALLBACK] **** Get Callback Called ****'); + console.info('getCurrentAudioRendererInfoArray **** Get Callback Called ****'); if (err) { console.log('getCurrentAudioRendererInfoArray :ERROR: '+ err.message); resultFlag = false; @@ -1960,7 +1960,7 @@ getCurrentAudioRendererInfoArray(): Promise<AudioRendererChangeInfoArray> **示例:** ``` await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { - console.info('[GET_RENDERER_STATE_3_PROMISE] ######### Get Promise is called ##########'); + console.info('getCurrentAudioRendererInfoArray ######### Get Promise is called ##########'); if (AudioRendererChangeInfoArray != null) { for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; @@ -1985,7 +1985,6 @@ await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (Audi } }).catch((err) => { console.log('getCurrentAudioRendererInfoArray :ERROR: ' + err.message); - resultFlag = false; }); ``` @@ -2006,10 +2005,9 @@ getCurrentAudioCapturerInfoArray(callback: AsyncCallback<AudioCapturerChangeI **示例:** ``` audioStreamManager.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => { - console.info('[GET_CAPTURER_STATE_1_CALLBACK] **** Get Callback Called ****'); + console.info('getCurrentAudioCapturerInfoArray **** Get Callback Called ****'); if (err) { console.log('getCurrentAudioCapturerInfoArray :ERROR: '+err.message); - resultFlag = false; } else { if (AudioCapturerChangeInfoArray != null) { for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { @@ -2051,8 +2049,8 @@ getCurrentAudioCapturerInfoArray(): Promise<AudioCapturerChangeInfoArray> **示例:** ``` -await audioStreamManagerCB.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { - console.info('AFCapturerChangeLog: [GET_CAP_STA_1_PR] **** Get Promise Called ****'); +await audioStreamManager.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { + console.info('getCurrentAudioCapturerInfoArray **** Get Promise Called ****'); if (AudioCapturerChangeInfoArray != null) { for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { console.info('StreamId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); @@ -2075,7 +2073,6 @@ await audioStreamManagerCB.getCurrentAudioCapturerInfoArray().then( function (Au } }).catch((err) => { console.log('getCurrentAudioCapturerInfoArray :ERROR: ' + err.message); - resultFlag = false; }); ``` @@ -2096,7 +2093,7 @@ on(type: "audioRendererChange", callback: Callback<AudioRendererChangeInfoArr **示例:** ``` -audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { +audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; console.info('## RendererChange on is called for ' + i + ' ##'); @@ -2125,7 +2122,7 @@ audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) = off(type: "audioRendererChange"); -监听音频渲染器更改事件。 +取消监听音频渲染器更改事件。 **系统能力:** SystemCapability.Multimedia.Audio.Renderer @@ -2137,8 +2134,8 @@ off(type: "audioRendererChange"); **示例:** ``` -audioStreamManagerCB.off('audioRendererChange'); -console.info('[RENDERER-CHANGE-ON-001] ######### RendererChange Off is called #########'); +audioStreamManager.off('audioRendererChange'); +console.info('######### RendererChange Off is called #########'); ``` ### on('audioCapturerChange')9+ @@ -2184,7 +2181,7 @@ audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => off(type: "audioCapturerChange"); -监听音频捕获器更改事件。 +取消监听音频捕获器更改事件。 **系统能力:** SystemCapability.Multimedia.Audio.Capturer @@ -2197,7 +2194,7 @@ off(type: "audioCapturerChange"); **示例:** ``` audioStreamManager.off('audioCapturerChange'); -console.info('[GET_CAPTURER_STATE_2_PROMISE] ######### CapturerChange Off is called #########'); +console.info('######### CapturerChange Off is called #########'); ``` @@ -2228,8 +2225,8 @@ var AudioStreamInfo = { encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW } -var streamManagerCB = audioManager.getStreamManager(); -streamManagerCB.isAudioRendererLowLatencySupported(AudioStreamInfo, (result) => { +var audioStreamManager = audioManager.getStreamManager(); +audioStreamManager.isAudioRendererLowLatencySupported(AudioStreamInfo, (result) => { console.info('isAudioRendererLowLatencySupported success var = ' + result); }); ``` @@ -2266,8 +2263,8 @@ var AudioStreamInfo = { encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW } -var streamManager = await audioManager.getStreamManager(); -var result = streamManager.isAudioRendererLowLatencySupported(AudioStreamInfo); +var audioStreamManager = await audioManager.getStreamManager(); +var result = audioStreamManager.isAudioRendererLowLatencySupported(AudioStreamInfo); console.info('isAudioRendererLowLatencySupported success var =' + result); ``` @@ -2298,6 +2295,7 @@ import audio from '@ohos.multimedia.audio'; var audioStreamManager; var audioStreamManagerCB; var Tag = "AFCapLog : "; +var resultFlag = false; await audioManager.getStreamManager().then(async function (data) { audioStreamManager = data; @@ -2337,7 +2335,7 @@ audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) = } if (AudioRendererChangeInfoArray[i].rendererState == 1 && devDescriptor != null) { resultFlag = true; - console.info(Tag + '[RENDERER-CHANGE-ON-001] ResultFlag for '+ i +' is:'+ resultFlag); + console.info(Tag + 'ResultFlag for '+ i +' is:'+ resultFlag); } } }); @@ -2369,6 +2367,7 @@ import audio from '@ohos.multimedia.audio'; const audioManager = audio.getAudioManager(); var Tag = "AFCapLog : "; +var resultFlag = false; audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); @@ -2390,7 +2389,7 @@ audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => } if (AudioCapturerChangeInfoArray[i].capturerState == 1 && devDescriptor != null) { resultFlag = true; - console.info(Tag + '[CAPTURER-CHANGE-ON-001] ResultFlag for element ' + i + ' is: ' + resultFlag); + console.info(Tag + 'ResultFlag for element ' + i + ' is: ' + resultFlag); } } }); @@ -3193,7 +3192,7 @@ setInterruptMode(mode: InterruptMode): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ---------- | ---------------------------------- | ------ | ---------- | -| mode | [InterruptMode](#InterruptMode) | 是 | 焦点模型。 | +| mode | [InterruptMode](#interruptmode9) | 是 | 焦点模型。 | **返回值:** @@ -3239,7 +3238,7 @@ setInterruptMode(mode: InterruptMode, callback: Callback\): void | 参数名 | 类型 | 必填 | 说明 | | ------- | ----------------------------------- | ------ | -------------- | -|mode | [InterruptMode](#InterruptMode) | 是 | 焦点模型。| +|mode | [InterruptMode](#interruptmode9) | 是 | 焦点模型。| |callback | Callback\ | 是 |回调返回执行结果。| **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md b/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md index 707fc62049d2c9e51bfe2c4bf8e0dfd12080bc23..81321e5a5fe3513db44b9b8eb236c84d69be1bb7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md @@ -343,7 +343,7 @@ setBluetoothScanMode(mode: ScanMode, duration: number): boolean | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | ---------------------------- | | mode | [ScanMode](#scanmode) | 是 | 蓝牙扫描模式。 | -| duration | number | 是 | 设备可被发现的持续时间,单位为秒;设置为0则持续可发现。 | +| duration | number | 是 | 设备可被发现的持续时间,单位为毫秒;设置为0则持续可发现。 | **返回值:** @@ -1029,7 +1029,7 @@ getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfi | 类型 | 说明 | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| [A2dpSourceProfile](#A2dpSourceProfile)或[HandsFreeAudioGatewayProfile](#HandsFreeAudioGatewayProfile) | 对应的profile的对象实例,当前支持A2dpSourceProfile, HandsFreeAudioGatewayProfile。 | +| [A2dpSourceProfile](#a2dpsourceprofile)或[HandsFreeAudioGatewayProfile](#handsfreeaudiogatewayprofile) | 对应的profile的对象实例,当前支持A2dpSourceProfile, HandsFreeAudioGatewayProfile。 | **示例:** @@ -1055,7 +1055,7 @@ getProfileInst(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayP | 类型 | 说明 | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| [A2dpSourceProfile](#A2dpSourceProfile)或 [HandsFreeAudioGatewayProfile](#HandsFreeAudioGatewayProfile)或[HidHostProfile](#HidHostProfile)或[PanProfile](#PanProfile) | 对应的profile的对象实例,当前支持A2dpSourceProfile/HandsFreeAudioGatewayProfile/HidHostProfile/PanProfile。 | +| [A2dpSourceProfile](#a2dpsourceprofile)或 [HandsFreeAudioGatewayProfile](#handsfreeaudiogatewayprofile)或[HidHostProfile](#hidhostprofile)或[PanProfile](#panprofile) | 对应的profile的对象实例,当前支持A2dpSourceProfile/HandsFreeAudioGatewayProfile/HidHostProfile/PanProfile。 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInfo.md index ee49cd6790b2f25bf684f335c9bcdb203000eb48..f92370a7861bdb78dbcd0df1ae92e6eab04d1f38 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInfo.md @@ -24,7 +24,7 @@ | appInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | 是 | 否 | 应用程序的配置信息 | | abilityInfos | Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | 是 | 否 | Ability的配置信息
通过传入GET_BUNDLE_WITH_ABILITIES获取 | | reqPermissions | Array\ | 是 | 否 | 应用运行时需向系统申请的权限集合
通过传入GET_BUNDLE_WITH_REQUESTED_PERMISSION获取 | -| reqPermissionDetails | Array\<[ReqPermissionDetail](#ReqPermissionDetail)> | 是 | 否 | 应用运行时需向系统申请的权限集合的详细信息
通过传入GET_BUNDLE_WITH_REQUESTED_PERMISSION获取 | +| reqPermissionDetails | Array\<[ReqPermissionDetail](#reqpermissiondetail)> | 是 | 否 | 应用运行时需向系统申请的权限集合的详细信息
通过传入GET_BUNDLE_WITH_REQUESTED_PERMISSION获取 | | vendor | string | 是 | 否 | 应用包的供应商 | | versionCode | number | 是 | 否 | 应用包的版本号 | | versionName | string | 是 | 否 | 应用包的版本文本描述信息 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-ShortcutInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-ShortcutInfo.md index 71a3d1077b9c3a64ebcb40095eeb518baf508994..2a1eb5a9b7e34e472b584258e8014939910c785d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-ShortcutInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-ShortcutInfo.md @@ -2,18 +2,19 @@ -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** +> > 本模块首批接口从API version 7 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -配置文件中定义的权限详细信息 +配置文件中定义的快捷方式信息。 ## ShortcutWant -获取有关快捷方式将启动的功能和目标的信息 +快捷方式所指向的目标信息。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework @@ -25,7 +26,7 @@ ## ShortcutInfo -获取有关快捷方式将启动的功能和目标的信息 +快捷方式属性信息。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework diff --git a/zh-cn/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md b/zh-cn/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md index cbdaec93ae9d5aafc915071a696c5cf9a0ec1d80..bc7145c55e268f1da2a710f6d0f239132cb33ef8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md +++ b/zh-cn/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md @@ -1,13 +1,14 @@ # ContinuationExtraParams -本模块提供流转管理入口中互联面板所需的过滤参数。 +本模块提供流转管理入口中设备选择模块所需的过滤参数。 -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> **说明:** +> > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## ContinuationExtraParams -表示流转管理入口中互联面板所需的过滤参数。 +表示流转管理入口中设备选择模块所需的过滤参数。 **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.DistributedAbilityManager 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 9a237033df49f7b5c50d0d7d4efee60588caa5b5..ac3e4d5e4c5da4f553e8979f5c972e7338a60308 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 @@ -21,7 +21,7 @@ import data_rdb from '@ohos.data.rdb'; getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback<RdbStore>): void -获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,结果以callback形式返回。 +获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,使用callback异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -51,7 +51,7 @@ data_rdb.getRdbStore(this.context, STORE_CONFIG, 1, function (err, rdbStore) { getRdbStore(context: Context, config: StoreConfig, version: number): Promise<RdbStore> -获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,结果以Promise形式返回。 +获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,使用Promise异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -85,7 +85,7 @@ promise.then(async (rdbStore) => { deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void>): void -删除数据库,结果以callback形式返回。 +删除数据库,使用callback异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -111,7 +111,7 @@ data_rdb.deleteRdbStore(this.context, "RdbTest.db", function (err, rdbStore) { deleteRdbStore(context: Context, name: string): Promise<void> -使用指定的数据库文件配置删除数据库,结果以Promise形式返回。 +使用指定的数据库文件配置删除数据库,使用Promise异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -953,7 +953,7 @@ predicates.notIn("NAME", ["Lisa", "Rose"]) insert(table: string, values: ValuesBucket, callback: AsyncCallback<number>):void -向目标表中插入一行数据,结果以callback形式返回。 +向目标表中插入一行数据,使用callback异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -972,12 +972,12 @@ const valueBucket = { "SALARY": 100.5, "CODES": new Uint8Array([1, 2, 3, 4, 5]), } -rdbStore.insert("EMPLOYEE", valueBucket, function (err, ret) { - if (err) { - console.info("Insert failed, err: " + err) - return +rdbStore.insert("EMPLOYEE", valueBucket, function (status, rowId) { + if (status) { + console.log("Insert is failed"); + return; } - console.log("Insert first done: " + ret) + console.log("Insert is successful, rowId = " + rowId); }) ``` @@ -986,7 +986,7 @@ rdbStore.insert("EMPLOYEE", valueBucket, function (err, ret) { insert(table: string, values: ValuesBucket):Promise<number> -向目标表中插入一行数据,结果以Promise形式返回。 +向目标表中插入一行数据,使用Promise异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1010,19 +1010,113 @@ const valueBucket = { "CODES": new Uint8Array([1, 2, 3, 4, 5]), } let promise = rdbStore.insert("EMPLOYEE", valueBucket) -promise.then(async (ret) => { - console.log("Insert first done: " + ret) -}).catch((err) => { - console.log("Insert failed, err: " + err) +promise.then((rowId) => { + console.log("Insert is successful, rowId = " + rowId); +}).catch((status) => { + console.log("Insert is failed"); }) ``` +### batchInsert9+ + +batchInsert(table: string, values: Array<ValuesBucket>, callback: AsyncCallback<number>):void + +向目标表中插入一组数据,使用callback异步回调。 + +**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 + +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| table | string | 是 | 指定的目标表名。 | +| values | Array<[ValuesBucket](#valuesbucket)> | 是 | 表示要插入到表中的一组数据。 | +| callback | AsyncCallback<number> | 是 | 指定callback回调函数。如果操作成功,返回插入的数据个数,否则返回-1。 | + +**示例:** +```js +const valueBucket1 = { + "NAME": "Lisa", + "AGE": 18, + "SALARY": 100.5, + "CODES": new Uint8Array([1, 2, 3, 4, 5]) +} +const valueBucket2 = { + "NAME": "Jack", + "AGE": 19, + "SALARY": 101.5, + "CODES": new Uint8Array([6, 7, 8, 9, 10]) +} +const valueBucket3 = { + "NAME": "Tom", + "AGE": 20, + "SALARY": 102.5, + "CODES": new Uint8Array([11, 12, 13, 14, 15]) +} + +var valueBuckets = new Array(valueBucket1, valueBucket2, valueBucket3); +rdbStore.batchInsert("EMPLOYEE", valueBuckets, function(status, insertNum) { + if (status) { + console.log("bathInsert is failed, status = " + status); + return; + } + console.log("bathInsert is successful, the number of values that were inserted = " + insertNum); +}) +``` + +### batchInsert9+ + +batchInsert(table: string, values: Array<ValuesBucket>):Promise<number> + +向目标表中插入一组数据,使用Promise异步回调。 + +**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 + +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| table | string | 是 | 指定的目标表名。 | +| values | Array<[ValuesBucket](#valuesbucket)> | 是 | 表示要插入到表中的一组数据。 | + +**返回值**: +| 类型 | 说明 | +| -------- | -------- | +| Promise<number> | 指定Promise回调函数。如果操作成功,返回插入的数据个数,否则返回-1。 | + +**示例:** +```js +const valueBucket1 = { + "NAME": "Lisa", + "AGE": 18, + "SALARY": 100.5, + "CODES": new Uint8Array([1, 2, 3, 4, 5]) +} +const valueBucket2 = { + "NAME": "Jack", + "AGE": 19, + "SALARY": 101.5, + "CODES": new Uint8Array([6, 7, 8, 9, 10]) +} +const valueBucket3 = { + "NAME": "Tom", + "AGE": 20, + "SALARY": 102.5, + "CODES": new Uint8Array([11, 12, 13, 14, 15]) +} + +var valueBuckets = new Array(valueBucket1, valueBucket2, valueBucket3); +let promise = rdbStore.batchInsert("EMPLOYEE", valueBuckets); +promise.then((insertNum) => { + console.log("bathInsert is successful, the number of values that were inserted = " + insertNum); +}).catch((status) => { + console.log("bathInsert is failed, status = " + status); +}) +``` ### update update(values: ValuesBucket, predicates: RdbPredicates, callback: AsyncCallback<number>):void -根据RdbPredicates的指定实例对象更新数据库中的数据,结果以callback形式返回。 +根据RdbPredicates的指定实例对象更新数据库中的数据,使用callback异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1057,7 +1151,7 @@ rdbStore.update(valueBucket, predicates, function (err, ret) { update(values: ValuesBucket, predicates: RdbPredicates):Promise<number> -根据RdbPredicates的指定实例对象更新数据库中的数据,结果以Promise形式返回。 +根据RdbPredicates的指定实例对象更新数据库中的数据,使用Promise异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1093,7 +1187,7 @@ promise.then(async (ret) => { ### update9+ update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>):void -根据DataSharePredicates的指定实例对象更新数据库中的数据,结果以callback形式返回。 +根据DataSharePredicates的指定实例对象更新数据库中的数据,使用callback异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1128,7 +1222,7 @@ rdbStore.update("EMPLOYEE", valueBucket, predicates, function (err, ret) { update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates):Promise<number> -根据DataSharePredicates的指定实例对象更新数据库中的数据,结果以Promise形式返回。 +根据DataSharePredicates的指定实例对象更新数据库中的数据,使用Promise异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1168,7 +1262,7 @@ promise.then(async (ret) => { delete(predicates: RdbPredicates, callback: AsyncCallback<number>):void -根据RdbPredicates的指定实例对象从数据库中删除数据,结果以callback形式返回。 +根据RdbPredicates的指定实例对象从数据库中删除数据,使用callback异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1196,7 +1290,7 @@ rdbStore.delete(predicates, function (err, rows) { delete(predicates: RdbPredicates):Promise<number> -根据RdbPredicates的指定实例对象从数据库中删除数据,结果以Promise形式返回。 +根据RdbPredicates的指定实例对象从数据库中删除数据,使用Promise异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1227,7 +1321,7 @@ promise.then((rows) => { delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>):void -根据DataSharePredicates的指定实例对象从数据库中删除数据,结果以callback形式返回。 +根据DataSharePredicates的指定实例对象从数据库中删除数据,使用callback异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1255,7 +1349,7 @@ rdbStore.delete("EMPLOYEE", predicates, function (err, rows) { delete(table: string, predicates: dataSharePredicates.DataSharePredicates):Promise<number> -根据DataSharePredicates的指定实例对象从数据库中删除数据,结果以Promise形式返回。 +根据DataSharePredicates的指定实例对象从数据库中删除数据,使用Promise异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1287,7 +1381,7 @@ promise.then((rows) => { query(predicates: RdbPredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void -根据指定条件查询数据库中的数据,结果以callback形式返回。 +根据指定条件查询数据库中的数据,使用callback异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1317,7 +1411,7 @@ rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function (e query(predicates: RdbPredicates, columns?: Array<string>):Promise<ResultSet> -根据指定条件查询数据库中的数据,结果以Promise形式返回。 +根据指定条件查询数据库中的数据,使用Promise异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1349,7 +1443,7 @@ query(predicates: RdbPredicates, columns?: Array<string>):Promise<Resul query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void -根据指定条件查询数据库中的数据,结果以callback形式返回。 +根据指定条件查询数据库中的数据,使用callback异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1380,7 +1474,7 @@ rdbStore.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns?: Array<string>):Promise<ResultSet> -根据指定条件查询数据库中的数据,结果以Promise形式返回。 +根据指定条件查询数据库中的数据,使用Promise异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1414,7 +1508,7 @@ promise.then((resultSet) => { querySql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallback<ResultSet>):void -根据指定SQL语句查询数据库中的数据,结果以callback形式返回。 +根据指定SQL语句查询数据库中的数据,使用callback异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1442,7 +1536,7 @@ rdbStore.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", querySql(sql: string, bindArgs?: Array<ValueType>):Promise<ResultSet> -根据指定SQL语句查询数据库中的数据,结果以Promise形式返回。 +根据指定SQL语句查询数据库中的数据,使用Promise异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1473,7 +1567,7 @@ promise.then((resultSet) => { executeSql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallback<void>):void -执行包含指定参数但不返回值的SQL语句,结果以callback形式返回。 +执行包含指定参数但不返回值的SQL语句,使用callback异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1501,7 +1595,7 @@ rdbStore.executeSql(SQL_CREATE_TABLE, null, function(err) { executeSql(sql: string, bindArgs?: Array<ValueType>):Promise<void> -执行包含指定参数但不返回值的SQL语句,结果以Promise形式返回。 +执行包含指定参数但不返回值的SQL语句,使用Promise异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1620,7 +1714,7 @@ try { backup(destName:string, callback: AsyncCallback<void>):void -以指定名称备份数据库,结果以callback形式返回。 +以指定名称备份数据库,使用callback异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1645,7 +1739,7 @@ rdbStore.backup("dbBackup.db", function(err) { backup(destName:string): Promise<void> -以指定名称备份数据库,结果以promise形式返回。 +以指定名称备份数据库,使用Promise异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1673,7 +1767,7 @@ promiseBackup.then(()=>{ restore(srcName:string, callback: AsyncCallback<void>):void -从指定的数据库备份文件恢复数据库,结果以callback形式返回。 +从指定的数据库备份文件恢复数据库,使用callback异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1698,7 +1792,7 @@ rdbStore.restore("dbBackup.db", function(err) { restore(srcName:string): Promise<void> -从指定的数据库备份文件恢复数据库,结果以promise形式返回。 +从指定的数据库备份文件恢复数据库,使用Promise异步回调。 **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core。 @@ -1726,7 +1820,7 @@ promiseRestore.then(()=>{ setDistributedTables(tables: Array<string>, callback: AsyncCallback<void>): void -设置分布式列表,结果以callback形式返回。 +设置分布式列表,使用callback异步回调。 **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC @@ -1754,7 +1848,7 @@ rdbStore.setDistributedTables(["EMPLOYEE"], function (err) { setDistributedTables(tables: Array<string>): Promise<void> -设置分布式列表,结果以Promise形式返回。 +设置分布式列表,使用Promise异步回调。 **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC @@ -1784,7 +1878,7 @@ promise.then(() => { obtainDistributedTableName(device: string, table: string, callback: AsyncCallback<string>): void -根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名, 结果以callback形式返回。 +根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名, 使用callback异步回调。 **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC @@ -1813,7 +1907,7 @@ rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, obtainDistributedTableName(device: string, table: string): Promise<string> -根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名,结果以Promise形式返回。 +根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名,使用Promise异步回调。 **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC @@ -1844,7 +1938,7 @@ promise.then((tableName) => { sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback<Array<[string, number]>>): void -在设备之间同步数据, 结果以callback形式返回。 +在设备之间同步数据, 使用callback异步回调。 **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC @@ -1878,7 +1972,7 @@ rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicates, function (err, resul sync(mode: SyncMode, predicates: RdbPredicates): Promise<Array<[string, number]>> -在设备之间同步数据,结果以Promise形式返回。 +在设备之间同步数据,使用Promise异步回调。 **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC @@ -1947,7 +2041,7 @@ try { off(event:'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void -从数据库中删除指定类型的指定观察者, 结果以callback形式返回。 +从数据库中删除指定类型的指定观察者, 使用callback异步回调。 **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC diff --git a/zh-cn/application-dev/reference/apis/js-apis-device-manager.md b/zh-cn/application-dev/reference/apis/js-apis-device-manager.md index cac1ec40cf6d581f7f19f1f2774cca54021fbfe7..21a164bd5006b04eb34b932d543a8deed0419420 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-device-manager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-device-manager.md @@ -9,7 +9,7 @@ - 认证和取消认证设备 - 查询可信设备列表 - 查询本地设备信息,包括设备名称,设备类型和设备标识 - +- 发布设备发现 > **说明:** > > - 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 @@ -61,7 +61,7 @@ createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager | deviceName | string | 是 | 设备名称。 | | deviceType | [DeviceType](#devicetype) | 是 | 设备类型。 | | networkId8+ | string | 是 | 设备网络标识。 | - +| range9+ | number | 是 | 发现设备的距离。 | ## DeviceType @@ -184,6 +184,18 @@ createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager | token | number | 是 | 认证Token。 | | extraInfo | {[key:string] : any} | 否 | 认证信息可扩展字段。 | +## PublishInfo + +发布设备参数 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedHardware.DeviceManager + +| 名称 | 类型 | 必填 | 描述 | +| ------------- | --------------------------------- | ---- | ----------------- | +| publishId | number | 是 | 发布设备标识,用于标识不同的发布周期。 | +| mode | [DiscoverMode ](#discovermode) | 是 | 发现模式。 | +| freq | [ExchangeFreq](#exchangefreq) | 是 | 发现频率。 | +| ranging | boolean | 是 | 发布的设备是否支持测距能力。 | ## DeviceManager @@ -359,6 +371,45 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo): void dmInstance.startDeviceDiscovery(subscribeInfo); //当有设备发现时,通过deviceFound回调通知给应用程序 ``` +### startDeviceDiscovery9+ + +startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions: string): void + +发现周边设备。 + +**系统能力**:SystemCapability.DistributedHardware.DeviceManager + +- 参数: + | 名称 | 参数类型 | 必填 | 说明 | + | ------------- | ------------------------------- | ---- | ----- | + | subscribeInfo | [SubscribeInfo](#subscribeinfo) | 是 | 发现信息。 | + | filterOptions | [string](#filteroptions) | 否 | 发现设备过滤信息。| + +- 示例: + ```js + //生成发现标识,随机数确保每次调用发现接口的标识不一致 + var subscribeId = Math.floor(Math.random() * 10000 + 1000); + var subscribeInfo = { + "subscribeId": subscribeId, + "mode": 0xAA, //主动模式 + "medium": 0, //自动发现类型,同时支持多种发现类型 + "freq": 2, //高频率 + "isSameAccount": false, + "isWakeRemote": false, + "capability": 1 + }; + var filterOptions = { + "filter_op": "OR", // 可选, 默认"OR" + "filters": [ + { + "type": "range", + "value": 50 // 需过滤发现设备的距离,单位(cm) + } + ] +}; + dmInstance.startDeviceDiscovery(subscribeInfo, JSON.stringify(filterOptions)); //当有设备发现时,通过deviceFound回调通知给应用程序 + ``` + ### stopDeviceDiscovery stopDeviceDiscovery(subscribeId: number): void @@ -378,6 +429,51 @@ stopDeviceDiscovery(subscribeId: number): void dmInstance.stopDeviceDiscovery(subscribeId); ``` +### publishDeviceDiscovery9+ + +publishDeviceDiscovery(publishInfo: PublishInfo): void + +发现设备发现。 + +**系统能力**:SystemCapability.DistributedHardware.DeviceManager + +- 参数: + | 名称 | 参数类型 | 必填 | 说明 | + | ------------- | ------------------------------- | ---- | ----- | + | publishInfo | [PublishInfo](#publishinfo) | 是 | 发布设备发现信息。 | + +- 示例: + ```js + //生成发布标识,随机数确保每次调用发现接口的标识不一致 + var publishId = Math.floor(Math.random() * 10000 + 1000); + var publishInfo = { + "publishId": publishId, + "mode": 0xAA, //主动模式 + "freq": 2, //高频率 + "ranging": 1 //支持发现时测距 + }; + dmInstance.publishDeviceDiscovery(publishInfo); //当有发布结果时,通过回调通知给应用程序 + ``` + +### unPublishDeviceDiscovery + +unPublishDeviceDiscovery(publishId: number): void + +停止发布设备发现。 + +**系统能力**:SystemCapability.DistributedHardware.DeviceManager + +- 参数: + | 名称 | 参数类型 | 必填 | 说明 | + | ----------- | -------- | ---- | ----- | + | publishId | number | 是 | 发布标识。 | + +- 示例: + ```js + //入参需要和publishDeviceDiscovery接口传入的publishId配对使用 + dmInstance.unPublishDeviceDiscovery(publishId); + ``` + ### authenticateDevice authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback<{deviceId: string, pinToken ?: number}>): void @@ -599,6 +695,93 @@ off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason: ); ``` +### on('publishSuccess') + +on(type: 'publishSuccess', callback: Callback<{ publishId: number }>): void + +注册发布设备发现回调监听。 + +**系统能力**:SystemCapability.DistributedHardware.DeviceManager + +- 参数: + | 名称 | 参数类型 | 必填 | 说明 | + | -------- | ---------------------------------------- | ---- | -------------------------- | + | type | string | 是 | 注册发布设备发现回调,以便将发布结果时通知应用程序。 | + | callback | Callback<{ publishId: number }> | 是 | 注册设备发布的回调方法。 | + +- 示例: + ```js + dmInstance.on('publishSuccess', (data) => { + console.info("publishSuccess:" + JSON.stringify(data)); + } + ); + ``` + +### off('publishSuccess') + +off(type: 'publishSuccess', callback?: Callback<{ publishId: number }>): void + +取消注册设备发现回调。 + +**系统能力**:SystemCapability.DistributedHardware.DeviceManager + +- 参数: + | 名称 | 参数类型 | 必填 | 说明 | + | -------- | ---------------------------------------- | ---- | --------------------------- | + | type | string | 是 | 取消注册设备发现回调。 | + | callback | Callback<{ publishId: number }> | 是 | 指示要取消注册的设备发布回调。 | + +- 示例: + ```js + dmInstance.off('publishSuccess', (data) => { + console.info('publishSuccess' + JSON.stringify(data)); + } + ); + ``` + +### on('publishFail') + +on(type: 'publishFail', callback: Callback<{ publishId: number, reason: number }>): void + +注册设备发布失败回调监听。 + +**系统能力**:SystemCapability.DistributedHardware.DeviceManager + +- 参数: + | 名称 | 参数类型 | 必填 | 说明 | + | -------- | ----------------------------------------------------- | ---- | ------------------------------ | + | type | string | 是 | 注册设备发布失败回调,以便在发布设备失败时通知应用程序。 | + | callback | Callback<{ publishId: number, reason: number }> | 是 | 注册设备发布失败的回调方法。 | + +- 示例: + ```js + dmInstance.on('publishFail', (data) => { + this.log("publishFail on:" + JSON.stringify(data)); + } + ); + ``` + +### off('publishFail') + +off(type: 'publishFail', callback?: Callback<{ publishId: number, reason: number }>): void + +取消注册设备发现失败回调。 + +**系统能力**:SystemCapability.DistributedHardware.DeviceManager + +- 参数: + | 名称 | 参数类型 | 必填 | 说明 | + | -------- | ----------------------------------------------------- | ---- | ----------------- | + | type | string | 是 | 取消注册设备发布失败回调。 | + | callback | Callback<{ publishId: number, reason: number }> | 是 | 指示要取消注册的设备发布失败回调。 | + +- 示例: + ```js + dmInstance.off('publishFail', (data) => { + console.info('publishFail' + JSON.stringify(data)); + } + ); + ``` ### on('serviceDie') diff --git a/zh-cn/application-dev/reference/apis/js-apis-display.md b/zh-cn/application-dev/reference/apis/js-apis-display.md index a0512d075e978281605477d13f402967fcb043b3..22e041d0a45217c562d4c421d82b9a721f0cfcce 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-display.md +++ b/zh-cn/application-dev/reference/apis/js-apis-display.md @@ -174,6 +174,42 @@ getAllDisplay(): Promise<Array<Display>> }); ``` +## display.hasPrivateWindow9+ + +hasPrivateWindow(displayId: number): boolean + +查询指定display对象上是否有可见的隐私窗口。可通过[setPrivacyMode](js-apis-window.md#setprivacymode7)接口设置隐私窗口。隐私窗口内容将无法被截屏或录屏。 + +此接口为系统接口。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------------------------- | ---- |----------| +| id | number | 是 | 显示设备的id。 | + +**返回值:** + +| 类型 | 说明 | +| -------------------------------- |-----------------------------------------------------------------------| +|boolean | 查询的display对象上是否有可见的隐私窗口。
true表示此display对象上有可见的隐私窗口,false表示此display对象上没有可见的隐私窗口。
| + +**示例:** + + ```js + var ret = display.hasPrivateWindow(displayClass.id); + if (ret == undefined) { + console.log("HasPrivateWindow undefined."); + } + if (ret) { + console.log("HasPrivateWindow."); + } else if (!ret) { + console.log("Don't HasPrivateWindow."); + } + ``` + ## display.on('add'|'remove'|'change') on(type: 'add'|'remove'|'change', callback: Callback<number>): void @@ -215,3 +251,4 @@ off(type: 'add'|'remove'|'change', callback?: Callback<number>): void ```js display.off("remove"); ``` + diff --git a/zh-cn/application-dev/reference/apis/js-apis-geolocation.md b/zh-cn/application-dev/reference/apis/js-apis-geolocation.md index af1e4a30179d3e012aabc248ccd460f15894b34a..3cd5bb1b94919b8e48c4b2c8b215254963bd05aa 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-geolocation.md +++ b/zh-cn/application-dev/reference/apis/js-apis-geolocation.md @@ -22,13 +22,14 @@ on(type: 'locationChange', request: LocationRequest, callback: Callback<Locat **系统能力**:SystemCapability.Location.Location.Core -**参数**: +**参数:** - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 设置事件类型。type为“locationChange”,表示位置变化。 | | request | LocationRequest | 是 | 设置位置请求参数。 | | callback | Callback<[Location](#location)> | 是 | 接收位置变化状态变化监听。 | + **示例** @@ -52,9 +53,9 @@ off(type: 'locationChange', callback?: Callback<Location>) : void **系统能力**:SystemCapability.Location.Location.Core -**参数**: +**参数:** - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 设置事件类型。type为“locationChange”,表示位置变化。 | | callback | Callback<[Location](#location)> | 否 | 接收位置变化状态变化监听。 | @@ -82,9 +83,9 @@ on(type: 'locationServiceState', callback: Callback<boolean>) : void **系统能力**:SystemCapability.Location.Location.Core -**参数**: +**参数:** - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 设置事件类型。type为“locationServiceState”,表示位置服务状态。 | | callback | Callback<boolean> | 是 | 接收位置服务状态变化监听。 | @@ -112,7 +113,7 @@ off(type: 'locationServiceState', callback?: Callback<boolean>) : void; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 设置事件类型。type为“locationServiceState”,表示位置服务状态。 | | callback | Callback<boolean> | 否 | 接收位置服务状态变化监听。 | @@ -141,7 +142,7 @@ on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, ca **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 设置事件类型。type为“cachedGnssLocationsReporting”,表示GNSS缓存定位结果上报。 | | request | CachedGnssLocationsRequest | 是 | GNSS缓存功能配置参数 | @@ -171,7 +172,7 @@ off(type: 'cachedGnssLocationsReporting', callback?: Callback<Array<Locati **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 设置事件类型。type为“cachedGnssLocationsReporting”,表示GNSS缓存定位结果上报。 | | callback | Callback<boolean> | 否 | 接收GNSS缓存位置上报。 | @@ -201,7 +202,7 @@ on(type: 'gnssStatusChange', callback: Callback<SatelliteStatusInfo>) : vo **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 设置事件类型。type为“gnssStatusChange”,表示订阅GNSS卫星状态信息上报。 | | callback | Callback<SatelliteStatusInfo> | 是 | 接收GNSS卫星状态信息上报。 | @@ -229,7 +230,7 @@ off(type: 'gnssStatusChange', callback?: Callback<SatelliteStatusInfo>) : **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 设置事件类型。type为“gnssStatusChange”,表示订阅GNSS卫星状态信息上报。 | | callback | Callback<SatelliteStatusInfo> | 否 | 接收GNSS卫星状态信息上报。 | @@ -257,7 +258,7 @@ on(type: 'nmeaMessageChange', callback: Callback<string>) : void; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 设置事件类型。type为“nmeaMessageChange”,表示订阅GNSS NMEA信息上报。 | | callback | Callback<string> | 是 | 接收GNSS NMEA信息上报。 | @@ -285,7 +286,7 @@ off(type: 'nmeaMessageChange', callback?: Callback<string>) : void; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 设置事件类型。type为“nmeaMessageChange”,表示订阅GNSS NMEA信息上报。 | | callback | Callback<string> | 否 | 接收GNSS NMEA信息上报。 | @@ -314,7 +315,7 @@ on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 设置事件类型。type为“fenceStatusChange”,表示订阅围栏事件上报。 | | request | GeofenceRequest | 是 | 围栏的配置参数。 | @@ -359,7 +360,7 @@ off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 设置事件类型。type为“fenceStatusChange”,表示订阅围栏事件上报。 | | request | GeofenceRequest | 是 | 围栏的配置参数。 | @@ -402,7 +403,7 @@ on(type: 'countryCodeChange', callback: Callback<CountryCode>) : void; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 设置事件类型。type为“countryCodeChange”,表示订阅国家码信息上报。 | | callback | Callback<CountryCode> | 是 | 接收国家码信息上报。 | @@ -428,7 +429,7 @@ off(type: 'countryCodeChange', callback?: Callback<CountryCode>) : void; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 设置事件类型。type为“countryCodeChange”,表示取消订阅国家码信息上报。 | | callback | Callback<CountryCode> | 是 | 接收国家码信息上报。 | @@ -458,7 +459,7 @@ getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback<L **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | request | [CurrentLocationRequest](#currentlocationrequest) | 否 | 设置位置请求参数。 | | callback | AsyncCallback<[Location](#location)> | 是 | 用来接收位置信息的回调。 | @@ -493,13 +494,13 @@ getCurrentLocation(request?: CurrentLocationRequest) : Promise<Location> **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | request | [CurrentLocationRequest](#currentlocationrequest) | 否 | 设置位置请求参数。 | **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<[Location](#location)> | 返回位置信息。 | @@ -526,7 +527,7 @@ getLastLocation(callback: AsyncCallback<Location>) : void **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | callback | AsyncCallback<[Location](#location)> | 是 | 用来接收上次位置的回调。 | @@ -557,7 +558,7 @@ getLastLocation() : Promise<Location> **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<[Location](#location)> | 返回上次位置信息。 | @@ -584,7 +585,7 @@ isLocationEnabled(callback: AsyncCallback<boolean>) : void **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | callback | AsyncCallback<boolean> | 是 | 用来接收位置服务状态的回调。 | @@ -614,7 +615,7 @@ isLocationEnabled() : Promise<boolean> **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<boolean> | 返回位置服务是否可用的状态。 | @@ -640,7 +641,7 @@ requestEnableLocation(callback: AsyncCallback<boolean>) : void **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | callback | AsyncCallback<boolean> | 是 | 用来接收位置服务状态的回调。 | @@ -670,7 +671,7 @@ requestEnableLocation() : Promise<boolean> **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<boolean> | 返回位置服务是否可用。 | @@ -697,7 +698,7 @@ enableLocation(callback: AsyncCallback<boolean>) : void; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | callback | AsyncCallback<boolean> | 是 | 用来接收位置服务状态的回调。 | @@ -729,7 +730,7 @@ enableLocation() : Promise<boolean> **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<boolean> | 返回位置服务是否可用。 | @@ -755,7 +756,7 @@ disableLocation(callback: AsyncCallback<boolean>) : void; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | callback | AsyncCallback<boolean> | 是 | 用来接收位置服务状态的回调。 | @@ -787,7 +788,7 @@ disableLocation() : Promise<boolean> **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<boolean> | 返回位置服务是否可用。 | @@ -811,7 +812,7 @@ isGeoServiceAvailable(callback: AsyncCallback<boolean>) : void **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | callback | AsyncCallback<boolean> | 是 | 用来接收地理编码服务状态的回调。 | @@ -841,7 +842,7 @@ isGeoServiceAvailable() : Promise<boolean> **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<boolean> | 返回地理编码服务是否可用的状态。 | @@ -866,7 +867,7 @@ getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | request | [ReverseGeoCodeRequest](#reversegeocoderequest) | 是 | 设置逆地理编码请求的相关参数。 | | callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | 是 | 设置接收逆地理编码请求的回调参数。 | @@ -898,13 +899,13 @@ getAddressesFromLocation(request: ReverseGeoCodeRequest) : Promise<Array<G **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | request | [ReverseGeoCodeRequest](#reversegeocoderequest) | 是 | 设置逆地理编码请求的相关参数。 | **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<Array<[GeoAddress](#geoaddress)>> | 返回地理描述信息。 | @@ -930,7 +931,7 @@ getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback< **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | request | [GeoCodeRequest](#geocoderequest) | 是 | 设置地理编码请求的相关参数。 | | callback | AsyncCallback<Array<[GeoAddress](#geoaddress)>> | 是 | 设置接收地理编码请求的回调参数。 | @@ -962,13 +963,13 @@ getAddressesFromLocationName(request: GeoCodeRequest) : Promise<Array<GeoA **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | request | [GeoCodeRequest](#geocoderequest) | 是 | 设置地理编码请求的相关参数。 | **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<Array<[GeoAddress](#geoaddress)>> | 设置接收地理编码请求的回调参数。 | @@ -994,7 +995,7 @@ getCachedGnssLocationsSize(callback: AsyncCallback<number>) : void; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | callback | AsyncCallback<number> | 是 | 用来接收GNSS芯片缓存位置个数的回调。 | @@ -1024,7 +1025,7 @@ getCachedGnssLocationsSize() : Promise<number>; **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<number> | 返回GNSS缓存位置的个数。 | @@ -1049,7 +1050,7 @@ flushCachedGnssLocations(callback: AsyncCallback<boolean>) : void; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | callback | AsyncCallback<boolean> | 是 | 用来接收清空GNSS芯片缓存位置操作的结果。 | @@ -1079,7 +1080,7 @@ flushCachedGnssLocations() : Promise<boolean>; **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<boolean> | 清空所有GNSS缓存位置是否成功。 | @@ -1104,7 +1105,7 @@ sendCommand(command: LocationCommand, callback: AsyncCallback<boolean>) : **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | command | LocationCommand | 是 | 指定目标场景,和将要发送的命令(字符串)。 | | callback | AsyncCallback<boolean> | 是 | 用来接收命令发送的结果。 | @@ -1136,13 +1137,13 @@ sendCommand(command: LocationCommand) : Promise<boolean>; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | command | LocationCommand | 是 | 指定目标场景,和将要发送的命令(字符串)。 | **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<boolean> | 表示命令发送成功或失败。 | @@ -1170,7 +1171,7 @@ isLocationPrivacyConfirmed(type : LocationPrivacyType, callback: AsyncCallback&l **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | LocationPrivacyType | 是 | 指定隐私申明场景,例如开机向导中的隐私申明、开启网络定位功能时弹出的隐私申明等。 | | callback | AsyncCallback<boolean> | 是 | 表示用户是否同意定位服务隐私申明。 | @@ -1203,13 +1204,13 @@ isLocationPrivacyConfirmed(type : LocationPrivacyType,) : Promise<boolean> **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | LocationPrivacyType | 是 | 指定隐私申明场景,例如开机向导中的隐私申明、开启网络定位功能时弹出的隐私申明等。 | **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<boolean> | 表示用户是否同意定位服务隐私申明。 | @@ -1236,7 +1237,7 @@ setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed: boolean **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | LocationPrivacyType | 是 | 指定隐私申明场景,例如开机向导中的隐私申明、开启网络定位功能时弹出的隐私申明等。 | | isConfirmed | boolean | 是 | 表示用户是否同意定位服务隐私申明。 | @@ -1270,14 +1271,14 @@ setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed : boolea **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | LocationPrivacyType | 是 | 指定隐私申明场景,例如开机向导中的隐私申明、开启网络定位功能时弹出的隐私申明等。 | | isConfirmed | boolean | 是 | 表示用户是否同意定位服务隐私申明。 | **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<boolean> | 表示操作是否成功。 | @@ -1300,7 +1301,7 @@ getCountryCode(callback: AsyncCallback<CountryCode>) : void; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | callback | AsyncCallback<CountryCode> | 是 | 用来接收国家码。 | @@ -1332,7 +1333,7 @@ getCountryCode() : Promise<CountryCode>; **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<CountryCode> | 返回国家码。 | @@ -1361,7 +1362,7 @@ enableLocationMock(scenario?: LocationRequestScenario, callback: AsyncCallback&l **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | scenario | LocationRequestScenario | 否 | 指示在什么场景下使能位置模拟功能。 | | callback | AsyncCallback<void> | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | @@ -1392,14 +1393,14 @@ enableLocationMock(scenario?: LocationRequestScenario) : Promise<void>; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | scenario | LocationRequestScenario | 否 | 指示使能什么场景的位置模拟功能。如果不携带该参数则表示使能所有场景的位置模拟功能。 | **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<void> | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | @@ -1433,7 +1434,7 @@ disableLocationMock(scenario?: LocationRequestScenario, callback: AsyncCallback& **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | scenario | LocationRequestScenario | 否 | 指示去使能某个场景的位置模拟功能。如果不携带该参数则表示去使能所有场景的位置模拟功能。 | | callback | AsyncCallback<void> | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | @@ -1465,13 +1466,13 @@ disableLocationMock(scenario?: LocationRequestScenario) : Promise<void>; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | scenario | LocationRequestScenario | 否 | 指示去使能某个场景的位置模拟功能。如果不携带该参数则表示去使能所有场景的位置模拟功能。 | **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<void> | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | @@ -1505,7 +1506,7 @@ setMockedLocations(config: LocationMockConfig, callback: AsyncCallback<void&g **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | config | LocationMockConfig | 是 | 指示位置模拟的配置参数,包含模拟位置上报的时间间隔和模拟位置数组。 | | callback | AsyncCallback<void> | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | @@ -1543,13 +1544,13 @@ setMockedLocations(config: LocationMockConfig) : Promise<void>; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | config | LocationMockConfig | 是 | 指示位置模拟的配置参数,包含模拟位置上报的时间间隔和模拟位置数组。 | **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<void> | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | @@ -1591,7 +1592,7 @@ enableReverseGeocodingMock(callback: AsyncCallback<void>) : void; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | callback | AsyncCallback<void> | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | @@ -1625,7 +1626,7 @@ enableReverseGeocodingMock() : Promise<void>; **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<void> | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | @@ -1658,7 +1659,7 @@ disableReverseGeocodingMock(callback: AsyncCallback<void>) : void; **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | callback | AsyncCallback<void> | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | @@ -1692,7 +1693,7 @@ disableReverseGeocodingMock() : Promise<void>; **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<void> | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | @@ -1725,7 +1726,7 @@ setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>, ca **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | mockInfos | Array<ReverseGeocodingMockInfo> | 是 | 指示逆地理编码模拟功能的配置参数数组。逆地理编码模拟功能的配置参数包含了一个位置和一个地名。 | | callback | AsyncCallback<void> | 是 | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | @@ -1734,11 +1735,11 @@ setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>, ca ```js var mockInfos = [ - {"location": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}}, ]; geolocation.setReverseGeocodingMockInfo(mockInfos, (err, data) => { if (err) { @@ -1763,13 +1764,13 @@ setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>) : **参数**: - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | mockInfos | Array<ReverseGeocodingMockInfo> | 是 | 指示逆地理编码模拟功能的配置信息数组。逆地理编码模拟功能的配置信息包含了一个位置和一个地名。 | **返回值**: - | 参数名 | 说明 | + | 参数名 | 说明 | | -------- | -------- | | Promise<void> | 用来接收执行结果,如果执行成功就返回nullptr,否则就返回错误信息。 | @@ -1777,11 +1778,11 @@ setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>) : ```js var mockInfos = [ - {"location": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "shanghai", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "beijing", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "shenzhen", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "wuhan", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}}, - {"location": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "chengdu", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 30.12, "longitude": 120.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 31.12, "longitude": 121.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 32.12, "longitude": 122.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 33.12, "longitude": 123.11, "maxItems": 1, "isFromMock": true}}, + {"location": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1}, "geoAddress": {"locale": "zh", "latitude": 34.12, "longitude": 124.11, "maxItems": 1, "isFromMock": true}}, ]; geolocation.setReverseGeocodingMockInfo(mockInfos) .then((result) => { diff --git a/zh-cn/application-dev/reference/apis/js-apis-huks.md b/zh-cn/application-dev/reference/apis/js-apis-huks.md index e6ab60f61b19eebe48128c5dd85eef3f7de5586d..0f4c594431e26d488432f9fd63f1022d6713dcdb 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-huks.md +++ b/zh-cn/application-dev/reference/apis/js-apis-huks.md @@ -16,7 +16,7 @@ import huks from '@ohos.security.huks' 表示错误码的枚举。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 名称 | 值 | 说明 | | -------------------------- | ----- | ---- | @@ -59,6 +59,11 @@ import huks from '@ohos.security.huks' | HUKS_ERROR_NEW_ROOT_KEY_MATERIAL_EXIST | -36 |表示存在新的根密钥材料。| | HUKS_ERROR_UPDATE_ROOT_KEY_MATERIAL_FAIL | -37 |表示更新根密钥材料失败。| | HUKS_ERROR_VERIFICATION_FAILED | -38 |表示验证证书链失败。| +| HUKS_ERROR_GET_USERIAM_SECINFO_FAILED9+ | -40 |表示获取当前用户安全属性信息失败。| +| HUKS_ERROR_GET_USERIAM_AUTHINFO_FAILED9+ | -41 |表示获取当前用户认证信息失败。| +| HUKS_ERROR_USER_AUTH_TYPE_NOT_SUPPORT9+ | -42 |表示不支持当前用户认证类型的访问控制。| +| HUKS_ERROR_KEY_AUTH_FAILED9+ | -43 |表示安全访问控制认证失败。| +| HUKS_ERROR_DEVICE_NO_CREDENTIAL9+ | -44 |表示设备当前未录入凭据。| | HUKS_ERROR_CHECK_GET_ALG_FAIL | -100 |表示检查获取 ALG 失败。| | HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL | -101 |表示检查获取密钥大小失败。| | HUKS_ERROR_CHECK_GET_PADDING_FAIL | -102 |表示检查获取填充失败。| @@ -95,7 +100,7 @@ import huks from '@ohos.security.huks' 表示密钥用途。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 名称 | 值 | 说明 | | ------------------------ | ---- | -------------------------------- | @@ -113,7 +118,7 @@ import huks from '@ohos.security.huks' 表示摘要算法。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 名称 | 值 | 说明 | | ---------------------- | ---- | ---------------------------------------- | @@ -130,7 +135,7 @@ import huks from '@ohos.security.huks' 表示补齐算法。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 名称 | 值 | 说明 | | ---------------------- | ---- | ---------------------------------------- | @@ -145,7 +150,7 @@ import huks from '@ohos.security.huks' 表示加密模式。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 名称 | 值 | 说明 | | ------------- | ---- | --------------------- | @@ -160,7 +165,7 @@ import huks from '@ohos.security.huks' 表示密钥长度。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 名称 | 值 | 说明 | | ---------------------------------- | ---- | ------------------------------------------ | @@ -189,7 +194,7 @@ import huks from '@ohos.security.huks' 表示密钥使用的算法。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 名称 | 值 | 说明 | | ------------------------- | ---- | --------------------- | @@ -212,7 +217,7 @@ import huks from '@ohos.security.huks' 表示生成密钥的类型。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 名称 | 值 | 说明 | | ------------------------------ | ---- | ---------------- | @@ -224,7 +229,7 @@ import huks from '@ohos.security.huks' 表示密钥的产生方式。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 名称 | 值 | 说明 | | -------------------------- | ---- | ------------------------------------ | @@ -237,7 +242,7 @@ import huks from '@ohos.security.huks' 表示密钥存储方式。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 名称 | 值 | 说明 | | ----------------------- | ---- | ------------------------------ | @@ -248,7 +253,7 @@ import huks from '@ohos.security.huks' 表示发送Tag的方式。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 名称 | 值 | 说明 | | -------------------- | ---- | ----------------- | @@ -259,7 +264,7 @@ import huks from '@ohos.security.huks' 表示导入加密密钥的算法套件。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 名称 | 值 | 说明 | | ---------------------------------------------- | ---- | ----------------------------------------------------- | @@ -270,7 +275,7 @@ import huks from '@ohos.security.huks' 表示导入密钥的密钥类型,默认为导入公钥,导入对称密钥时不需要该字段。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 名称 | 值 | 说明 | | ------------------------- | ---- | ------------------------------ | @@ -278,11 +283,69 @@ import huks from '@ohos.security.huks' | HUKS_KEY_TYPE_PRIVATE_KEY | 1 | 表示导入的密钥类型为私钥。 | | HUKS_KEY_TYPE_KEY_PAIR | 2 | 表示导入的密钥类型为公私钥对。 | +## HuksUserAuthType9+ + +表示用户认证类型。 + +**系统能力**:SystemCapability.Security.Huks + +| 名称 | 值 | 说明 | +| ------------------------------- | ---- | ------------------------- | +| HUKS_USER_AUTH_TYPE_FINGERPRINT | 1 | 表示用户认证类型为指纹。 | +| HUKS_USER_AUTH_TYPE_FACE | 2 | 表示用户认证类型为人脸 。 | +| HUKS_USER_AUTH_TYPE_PIN | 4 | 表示用户认证类型为PIN码。 | + +## HuksAuthAccessType9+ + +表示安全访问控制类型。 + +**系统能力**:SystemCapability.Security.Huks + +| 名称 | 值 | 说明 | +| --------------------------------------- | ---- | ------------------------------------------------ | +| HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD | 1 | 表示安全访问控制类型为清除密码后密钥无效。 | +| HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL | 2 | 表示安全访问控制类型为新录入生物特征后密钥无效。 | + +## HuksChallengeType9+ + +表示密钥使用时生成challenge的类型。 + +**系统能力**:SystemCapability.Security.Huks + +| 名称 | 值 | 说明 | +| ------------------------------- | ---- | ------------------------------ | +| HUKS_CHALLENGE_TYPE_NORMAL | 0 | 表示challenge为普通类型,默认32字节。 | +| HUKS_CHALLENGE_TYPE_CUSTOM | 1 | 表示challenge为用户自定义类型。支持使用多个密钥仅一次认证。 | +| HUKS_CHALLENGE_TYPE_NONE | 2 | 表示免challenge类型。 | + +## HuksChallengePosition9+ + +表示challenge类型为用户自定义类型时,生成的challenge有效长度仅为8字节连续的数据,且仅支持4种位置 。 + +**系统能力**:SystemCapability.Security.Huks + +| 名称 | 值 | 说明 | +| ------------------------------- | ---- | ------------------------------ | +| HUKS_CHALLENGE_POS_0 | 0 | 表示0~7字节为当前密钥的有效challenge。 | +| HUKS_CHALLENGE_POS_1 | 1 | 表示8~15字节为当前密钥的有效challenge。 | +| HUKS_CHALLENGE_POS_2 | 2 | 表示16~23字节为当前密钥的有效challenge。 | +| HUKS_CHALLENGE_POS_3 | 3 | 表示24~31字节为当前密钥的有效challenge。 | + +## HuksSecureSignType9+ + +表示生成或导入密钥时,指定该密钥的签名类型。 + +**系统能力**:SystemCapability.Security.Huks + +| 名称 | 值 | 说明 | +| ------------------------------ | ---- | ------------------------------------------------------------ | +| HUKS_SECURE_SIGN_WITH_AUTHINFO | 1 | 表示签名类型为携带认证信息。生成或导入密钥时指定该字段,则在使用密钥进行签名时,对待签名的数据添加认证信息后进行签名。 | + ## HuksTagType 表示Tag的数据类型。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 名称 | 值 | 说明 | @@ -298,7 +361,7 @@ import huks from '@ohos.security.huks' 表示调用参数的Tag。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 名称 | 值 | 说明 | | -------------------------------------------- | ---------------------------------------- | -------------------------------------- | @@ -336,9 +399,13 @@ import huks from '@ohos.security.huks' | HUKS_TAG_ALL_USERS | ksTagType.HUKS_TAG_TYPE_BOOL \| 301 | 预留。 | | HUKS_TAG_USER_ID | HuksTagType.HUKS_TAG_TYPE_UINT \| 302 | 预留。 | | HUKS_TAG_NO_AUTH_REQUIRED | HuksTagType.HUKS_TAG_TYPE_BOOL \| 303 | 预留。 | -| HUKS_TAG_USER_AUTH_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 304 | 预留。 | +| HUKS_TAG_USER_AUTH_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 304 | 表示用户认证类型。从[HuksUserAuthType](#huksuserauthtype9)中选择,需要与安全访问控制类型同时设置。支持同时指定两种用户认证类型,如:安全访问控制类型指定为HKS_SECURE_ACCESS_INVALID_NEW_BIO_ENROLL时,密钥访问认证类型可以指定以下三种: HKS_USER_AUTH_TYPE_FACE 、HKS_USER_AUTH_TYPE_FINGERPRINT、HKS_USER_AUTH_TYPE_FACE \| HKS_USER_AUTH_TYPE_FINGERPRINT | | HUKS_TAG_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | 预留。 | | HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | 预留。 | +| HUKS_TAG_KEY_AUTH_ACCESS_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 307 | 表示安全访问控制类型。从[HuksAuthAccessType](#huksauthaccesstype9)中选择,需要和用户认证类型同时设置。 | +| HUKS_TAG_KEY_SECURE_SIGN_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 308 | 表示生成或导入密钥时,指定该密钥的签名类型。 | +| HUKS_TAG_CHALLENGE_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 309 | 表示密钥使用时生成的challenge类型。从[HuksChallengeType](#hukschallengetype9)中选择 | +| HUKS_TAG_CHALLENGE_POS9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 310 | 表示challenge类型为用户自定义类型时,huks产生的challenge有效长度仅为8字节连续的数据。从[HuksChallengePosition](#hukschallengeposition9)中选择。 | | HUKS_TAG_ATTESTATION_CHALLENGE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 501 | 表示attestation时的挑战值。 | | HUKS_TAG_ATTESTATION_APPLICATION_ID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 502 | 表示attestation时拥有该密钥的application的Id。 | | HUKS_TAG_ATTESTATION_ID_BRAND | HuksTagType.HUKS_TAG_TYPE_BYTES \| 503 | 表示设备的品牌。 | @@ -387,7 +454,7 @@ generateKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\ 生成密钥,使用Promise方式异步返回结果。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks **参数:** @@ -488,7 +555,7 @@ deleteKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\ 删除密钥,使用Promise方式异步返回结果。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks **参数:** @@ -547,7 +614,7 @@ getSdkVersion(options: HuksOptions) : string 获取当前系统sdk版本。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks **参数:** @@ -577,7 +644,7 @@ importKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\ 导入明文密钥,使用Promise方式异步返回结果。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks **参数:** @@ -700,7 +767,7 @@ importWrappedKey(keyAlias: string, wrappingKeyAlias: string, options: HuksOption 导入加密密钥,使用Callback方式回调异步返回结果 。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks **参数:** @@ -804,8 +871,8 @@ async function TestImportWrappedKeyFunc( * 假设待导入的密钥为keyA * 1.生成ECC公私钥keyB,公钥为keyB_pub, 私钥为keyB_pri * 2.使用keyB_pri和wrappingAlias密钥中获取的公钥进行密钥协商,协商出共享密钥share_key - * 3.随机生成密钥kek,用于加密keyA,采用AES-GCM加密,加密过程中需要记录:nonce1/aad1/加密后的密文keyA_enc/加密后的tag1。 - * 4.使用share_key加密kek,采用AES-GCM加密,加密过程中需要记录:nonce2/aad2/加密后的密文kek_enc/加密后的tag2。 + * 3.随机生成密钥kek,用于加密keyA,采用AES-GCM加密,加密过程中需要记录:nonce1、aad1、加密后的密文keyA_enc、加密后的tag1。 + * 4.使用share_key加密kek,采用AES-GCM加密,加密过程中需要记录:nonce2、aad2、加密后的密文kek_enc、加密后的tag2。 * 5.拼接importOptions.inData字段,满足以下格式: * keyB_pub的长度(4字节) + keyB_pub的数据 + aad2的长度(4字节) + aad2的数据 + * nonce2的长度(4字节) + nonce2的数据 + tag2的长度(4字节) + tag2的数据 + @@ -888,7 +955,7 @@ importWrappedKey(keyAlias: string, wrappingKeyAlias: string, options: HuksOption 导入加密密钥,使用Promise方式异步返回结果。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks **参数:** @@ -924,7 +991,7 @@ exportKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\ 导出密钥,使用Promise方式回调异步返回的结果。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks **参数:** @@ -983,7 +1050,7 @@ getKeyProperties(keyAlias: string, options: HuksOptions, callback: AsyncCallback 获取密钥属性,使用Callback回调异步返回结果。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks **参数:** @@ -1010,7 +1077,7 @@ getKeyProperties(keyAlias: string, options: HuksOptions) : Promise\ 获取密钥属性,使用Promise回调异步返回结果。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks **参数:** @@ -1042,7 +1109,7 @@ isKeyExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback\ 判断密钥是否存在,使用Promise回调异步返回结果 。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks **参数:** @@ -1103,7 +1170,7 @@ init(keyAlias: string, options: HuksOptions, callback: AsyncCallback\ init操作密钥接口,使用Promise方式异步返回结果。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks **参数:** @@ -1131,41 +1198,94 @@ init操作密钥接口,使用Promise方式异步返回结果。 | promise | Promise\<[HuksHandle](#hukshandle)> | 是 | 将Init操作返回的handle添加到密钥管理系统的回调。 | -## huks.update +## huks.update(deprecated) update(handle: number, token?: Uint8Array, options: HuksOptions, callback: AsyncCallback\) : void update操作密钥接口,使用Callback回调异步返回结果 。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +> **说明:** 从API Version 9开始废弃,建议使用[huks.update9+](#huksupdate9)替代。 -**参数:** +**系统能力**: SystemCapability.Security.Huks -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ---------------------- | ---- | ------------------------------------- | -| handle | number | 是 | Update操作的handle。 | -| token | Uint8Array | 否 | Update操作的token。 | -| options | [HuksOptions](#huksoptions) | 是 | Update的参数集合。 | -| callback | AsyncCallback\<[HuksResult](#huksresult)> | 是 | 将Update操作的结果添加到密钥管理系统的回调。 | +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------- | ---- | -------------------------------------------- | +| handle | number | 是 | Update操作的handle。 | +| token | Uint8Array | 否 | Update操作的token。 | +| options | [HuksOptions](#huksoptions) | 是 | Update操作的参数集合。 | +| callback | AsyncCallback\<[HuksResult](#huksresult)> | 是 | 将Update操作的结果添加到密钥管理系统的回调。 | -## huks.update +## huks.update(deprecated) update(handle: number, token?: Uint8Array, options: HuksOptions) : Promise\ update操作密钥接口,使用Promise方式异步返回结果。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +> **说明:** 从API Version 9开始废弃,建议使用[huks.update9+](#huksupdate9)替代。 + +**系统能力**: SystemCapability.Security.Huks **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ---------------------- | ---- | ------------------------------------- | -| handle | number | 是 | Update操作的handle。 | -| token | Uint8Array | 否 | Update操作的token。 | -| options | [HuksOptions](#huksoptions) | 是 | Update操作的参数集合。 | -| promise | Promise\<[HuksResult](#huksresult)> | 是 | 将Update操作的结果添加到密钥管理系统的回调。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------- | ---- | -------------------------------------------- | +| handle | number | 是 | Update操作的handle。 | +| token | Uint8Array | 否 | Update操作的token。 | +| options | [HuksOptions](#huksoptions) | 是 | Update操作的参数集合。 | +| promise | Promise\<[HuksResult](#huksresult)> | 是 | 将Update操作的结果添加到密钥管理系统的回调。 | + +## huks.update9+ + +update(handle: number, options: HuksOptions, callback: AsyncCallback\) : void + +update操作密钥接口,使用Callback回调异步返回结果 。 + +**系统能力**:SystemCapability.Security.Huks + +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------- | ---- | -------------------------------------------- | +| handle | number | 是 | Update操作的handle。 | +| options | [HuksOptions](#huksoptions) | 是 | Update的参数集合。 | +| callback | AsyncCallback\<[HuksResult](#huksresult)> | 是 | 将Update操作的结果添加到密钥管理系统的回调。 | + + +## huks.update9+ + +update(handle: number, options: HuksOptions, token: Uint8Array, callback: AsyncCallback\) : void + +update操作密钥接口,使用Callback回调异步返回结果 。 + +**系统能力**:SystemCapability.Security.Huks + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------- | ---- | -------------------------------------------- | +| handle | number | 是 | Update操作的handle。 | +| options | [HuksOptions](#huksoptions) | 是 | Update操作的参数集合。 | +| token | Uint8Array | 是 | Update操作的token。 | +| callback | AsyncCallback\<[HuksResult](#huksresult)> | 是 | 将Update操作的结果添加到密钥管理系统的回调。 | + +## huks.update9+ + +update(handle: number, options: HuksOptions, token?: Uint8Array) : Promise\ + +update操作密钥接口,使用Promise方式异步返回结果。 + +**系统能力**:SystemCapability.Security.Huks + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------- | ---- | -------------------------------------------- | +| handle | number | 是 | Update操作的handle。 | +| options | [HuksOptions](#huksoptions) | 是 | Update操作的参数集合。 | +| token | Uint8Array | 否 | Update操作的token。 | +| promise | Promise\<[HuksResult](#huksresult)> | 是 | 将Update操作的结果添加到密钥管理系统的回调。 | ## huks.finish @@ -1173,7 +1293,7 @@ finish(handle: number, options: HuksOptions, callback: AsyncCallback\ finish操作密钥接口,使用Promise方式异步返回结果。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks **参数:** @@ -1198,8 +1318,42 @@ finish操作密钥接口,使用Promise方式异步返回结果。 | -------- | ---------------------- | ---- | ------------------------------------- | | handle | number | 是 | Finish操作的handle。 | | options | [HuksOptions](#huksoptions) | 是 | Finish操作的参数集合。 | -| promise | Promise\<[HuksResult](#HuksResult)> | 是 | promise实例,用于获取异步返回结果。 | +| promise | Promise\<[HuksResult](#huksresult)> | 是 | promise实例,用于获取异步返回结果。 | + +## huks.finish9+ + +finish(handle: number, options: HuksOptions, token: Uint8Array, callback: AsyncCallback\) : void + +finish操作密钥接口,使用Callback回调异步返回结果 。 + +**系统能力**:SystemCapability.Security.Huks + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------- | ---- | -------------------------------------------- | +| handle | number | 是 | Finish操作的handle。 | +| options | [HuksOptions](#huksoptions) | 是 | Finish的参数集合。 | +| token | Uint8Array | 是 | Finish操作的token。 | +| callback | AsyncCallback\<[HuksResult](#huksresult)> | 是 | 将Finish操作的结果添加到密钥管理系统的回调。 | + + +## huks.finish9+ + +finish(handle: number, options: HuksOptions, token?: Uint8Array) : Promise\ + +finish操作密钥接口,使用Promise方式异步返回结果。 + +**系统能力**:SystemCapability.Security.Huks + +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------- | ---- | ----------------------------------- | +| handle | number | 是 | Finish操作的handle。 | +| options | [HuksOptions](#huksoptions) | 是 | Finish操作的参数集合。 | +| token | Uint8Array | 否 | Finish操作的token。 | +| promise | Promise\<[HuksResult](#Huksresult)> | 是 | promise实例,用于获取异步返回结果。 | ## huks.abort @@ -1207,7 +1361,7 @@ abort(handle: number, options: HuksOptions, callback: AsyncCallback\ abort操作密钥接口,使用Callback回调异步返回结果 。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks **参数:** @@ -1427,7 +1581,7 @@ abort(handle: number, options: HuksOptions) : Promise\; abort操作密钥接口,使用Promise方式异步返回结果。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks **参数:** @@ -1651,49 +1805,49 @@ struct Index { 调用接口使用的options中的properties数组中的param。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ----------------------------------- | ---- | ---------- | -| tag | HuksTag | 是 | 标签 | -| value | boolean\|number\|bigint\|Uint8Array | 是 | 标签对应值 | +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ----------------------------------- | ---- | ------------ | +| tag | [HuksTag](#hukstag) | 是 | 标签。 | +| value | boolean\|number\|bigint\|Uint8Array | 是 | 标签对应值。 | ## HuksOptions 调用接口使用的options。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 参数名 | 类型 | 必填 | 说明 | | ---------- | ----------------- | ---- | ------------------------ | -| properties | Array\ | 否 | 属性,存HuksParam的数组。 | +| properties | Array\<[HuksParam](#huksparam)> | 否 | 属性,用于存HuksParam的数组。 | | inData | Uint8Array | 否 | 输入数据。 | ## HuksHandle huks Handle结构体。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks | 参数名 | 类型 | 必填 | 说明 | | ---------- | ---------------- | ---- | -------- | -| errorCode | number | 是 | 错误码 | -| handle | number | 是 | handle值 | -| token | Uint8Array | 否 | 预留字段 | +| errorCode | number | 是 | 表示错误码。 | +| handle | number | 是 | 表示handle值。 | +| token | Uint8Array | 否 | 表示[init](#huksinit)操作之后获取到的challenge信息。 | ## HuksResult 调用接口返回的result。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Security.Huks。 +**系统能力**:SystemCapability.Security.Huks -| 参数名 | 类型 | 必填 | 说明 | -| ---------- | ----------------- | ---- | -------- | -| errorCode | number | 是 | 错误码 | -| outData | Uint8Array | 否 | 输出数据 | -| properties | Array\ | 否 | 属性 | -| certChains | Array\ | 否 | 证书链 | +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ------------------------------- | ---- | ---------------- | +| errorCode | number | 是 | 表示错误码。 | +| outData | Uint8Array | 否 | 表示输出数据。 | +| properties | Array\<[HuksParam](#huksparam)> | 否 | 表示属性信息。 | +| certChains | Array\ | 否 | 表示证书链数据。 | 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 99dce4e19d6327cee1d07f73605d99f6200a5749..f4aeef3b877acfc2634927e33743d707f60a7c07 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-image.md +++ b/zh-cn/application-dev/reference/apis/js-apis-image.md @@ -936,7 +936,7 @@ createImageSource(uri: string, options: SourceOptions): ImageSource | 参数名 | 类型 | 必填 | 说明 | | ------- | ------------------------------- | ---- | ----------------------------------- | | uri | string | 是 | 图片路径,当前仅支持应用沙箱路径。 | -| options | [SourceOptions](#SourceOptions) | 是 | 图片属性,包括图片序号与默认属性值。| +| options | [SourceOptions](#sourceoptions9) | 是 | 图片属性,包括图片序号与默认属性值。| **返回值:** @@ -989,7 +989,7 @@ createImageSource(fd: number, options: SourceOptions): ImageSource | 参数名 | 类型 | 必填 | 说明 | | ------- | ------------------------------- | ---- | ----------------------------------- | | fd | number | 是 | 文件描述符fd。 | -| options | [SourceOptions](#SourceOptions) | 是 | 图片属性,包括图片序号与默认属性值。| +| options | [SourceOptions](#sourceoptions9) | 是 | 图片属性,包括图片序号与默认属性值。| **返回值:** @@ -1037,7 +1037,7 @@ createImageSource(buf: ArrayBuffer, options: SourceOptions): ImageSource | 参数名 | 类型 | 必填 | 说明 | | ------ | -------------------------------- | ---- | ------------------------------------ | | buf | ArrayBuffer | 是 | 图像缓冲区数组。 | -| options | [SourceOptions](#SourceOptions) | 是 | 图片属性,包括图片序号与默认属性值。 | +| options | [SourceOptions](#sourceoptions9) | 是 | 图片属性,包括图片序号与默认属性值。 | **返回值:** @@ -1092,7 +1092,7 @@ CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource | 参数名 | 类型 | 必填 | 说明 | | ------- | ------------------------------- | ---- | ------------------------------------ | | buf | ArrayBuffer | 是 | 增量数据。 | -| options | [SourceOptions](#SourceOptions) | 否 | 图片属性,包括图片序号与默认属性值。 | +| options | [SourceOptions](#sourceoptions9) | 否 | 图片属性,包括图片序号与默认属性值。 | **返回值:** @@ -2135,11 +2135,12 @@ img.release().then(() =>{ **系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Core -| 名称 | 默认值 | 描述 | -| --------- | ------ | ----------------- | -| UNKNOWN | 0 | 未知格式。 | -| RGB_565 | 2 | 格式为RGB_565。 | -| RGBA_8888 | 3 | 格式为RGBA_8888。 | +| 名称 | 默认值 | 描述 | +| ---------------------- | ------ | ----------------- | +| UNKNOWN | 0 | 未知格式。 | +| RGB_565 | 2 | 格式为RGB_565 | +| RGBA_8888 | 3 | 格式为RGBA_8888。 | +| BGRA_88889+ | 4 | 格式为BGRA_8888。 | ## AlphaType9+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md index c395dc04ac0700cd5ca2ca218f5383c79aa8cf78..a11614d149bfd2db3c3b8370aeba57ea906f880d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md @@ -39,7 +39,7 @@ import inputMethod from '@ohos.inputmethod'; getInputMethodController(): InputMethodController -获取客户端实例[InputMethodController](#InputMethodController)。 +获取客户端实例[InputMethodController](#inputmethodcontroller)。 **系统能力**:SystemCapability.MiscServices.InputMethodFramework @@ -47,7 +47,7 @@ getInputMethodController(): InputMethodController | 类型 | 说明 | | -------- | -------- | - | [InputMethodController](#InputMethodController) | 回调返回当前客户端实例。 | + | [InputMethodController](#inputmethodcontroller) | 回调返回当前客户端实例。 | **示例:** @@ -59,7 +59,7 @@ getInputMethodController(): InputMethodController getInputMethodSetting(): InputMethodSetting -获取客户端设置实例[InputMethodSetting](#InputMethodSetting)。 +获取客户端设置实例[InputMethodSetting](#inputmethodsetting8)。 **系统能力**: SystemCapability.MiscServices.InputMethodFramework @@ -67,7 +67,7 @@ getInputMethodSetting(): InputMethodSetting | 类型 | 说明 | | ----------------------------------------- | ---------------------------- | -| [InputMethodSetting](#InputMethodSetting) | 回调返回当前客户端设置实例。 | +| [InputMethodSetting](#inputmethodsetting8) | 回调返回当前客户端设置实例。 | **示例:** @@ -127,7 +127,7 @@ switchInputMethod(target: InputmethodProperty): Promise<boolean> ``` ## InputMethodController -下列API示例中都需使用[getInputMethodController](#getinputmethodcontroller)回调获取到InputMethodController实例,再通过此实例调用对应方法。 +下列API示例中都需使用[getInputMethodController](#inputmethodgetinputmethodcontroller)回调获取到InputMethodController实例,再通过此实例调用对应方法。 ### stopInput @@ -175,7 +175,7 @@ stopInput(): Promise<boolean> ## InputMethodSetting8+ -下列API示例中都需使用[getInputMethodSetting](#getinputmethodsetting)回调获取到InputMethodSetting实例,再通过此实例调用对应方法。 +下列API示例中都需使用[getInputMethodSetting](#inputmethodgetinputmethodcontroller)回调获取到InputMethodSetting实例,再通过此实例调用对应方法。 ### listInputMethod @@ -188,7 +188,7 @@ listInputMethod(callback: AsyncCallback<Array<InputMethodProperty>>) **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------------------- | ---- | ---------------------- | -| callback | Array<[InputMethodProperty](#InputMethodProperty)> | 是 | 返回已安装输入法列表。 | +| callback | Array<[InputMethodProperty](#inputmethodproperty8)> | 是 | 返回已安装输入法列表。 | **示例:** @@ -212,7 +212,7 @@ listInputMethod(): Array<InputMethodProperty> **返回值:** | 类型 | 说明 | | ----------------------------------------------------------- | ---------------------- | -| Promise> | 返回已安装输入法列表。 | +| Promise> | 返回已安装输入法列表。 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-media.md b/zh-cn/application-dev/reference/apis/js-apis-media.md index 99a973e7cbb6bc7e04286dcad8417c8e4acdbb22..4c0a3d2cac9d0341f4edc8d77bc0a3cdd9fc1627 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-media.md +++ b/zh-cn/application-dev/reference/apis/js-apis-media.md @@ -276,7 +276,7 @@ Codec MIME类型枚举。 | 名称 | 类型 | 可读 | 可写 | 说明 | | ------------------------------- | ----------------------------------- | ---- | ---- | ------------------------------------------------------------ | -| src | string | 是 | 是 | 音频媒体URI,支持当前主流的视频格式(m4a、aac、mp3、ogg、wav)。
**支持路径示例**:
1. fd类型播放:fd://xx
![](figures/zh-cn_image_url.png)
2. http网络播放: http://xx
3. https网络播放: https://xx
4. hls网络播放路径:http://xx或者https://xx
**需要权限:** ohos.permission.READ_MEDIA;如果需要使用网络素材,还需要申请ohos.permission.INTERNET。 | +| src | string | 是 | 是 | 音频媒体URI,支持当前主流的音频格式(m4a、aac、mp3、ogg、wav)。
**支持路径示例**:
1. fd类型播放:fd://xx
![](figures/zh-cn_image_url.png)
2. http网络播放: http://xx
3. https网络播放: https://xx
4. hls网络播放路径:http://xx或者https://xx
**需要权限:** ohos.permission.READ_MEDIA;如果需要使用网络素材,还需要申请ohos.permission.INTERNET。 | | fdSrc9+ | [AVFileDescriptor](#interruptmode9) | 是 | 是 | 音频媒体文件描述,使用场景:应用中的音频资源被连续存储在同一个文件中。
**使用示例**:
假设一个连续存储的音乐文件:
音乐1(地址偏移:0,字节长度:100)
音乐2(地址偏移:101,字节长度:50)
音乐3(地址偏移:151,字节长度:150)
1. 播放音乐1:AVFileDescriptor { fd = 资源句柄; offset = 0; lengt = 100; }
2. 播放音乐2:AVFileDescriptor { fd = 资源句柄; offset = 101; length = 50; }
3. 播放音乐3:AVFileDescriptor { fd = 资源句柄; offset = 151; length = 150; }
假设是一个独立的音乐文件: 请使用src=fd://xx
**注意事项**:
**需要权限:** ohos.permission.READ_MEDIA | | loop | boolean | 是 | 是 | 音频循环播放属性,设置为'true'表示循环播放。 | | audioInterruptMode9+ | [InterruptMode](#interruptmode9) | 是 | 是 | 音频焦点模型。 | @@ -651,7 +651,7 @@ audioPlayer.setVolume(3); //设置volume为无效值,触发'error'事件 | 名称 | 类型 | 描述 | | ------------------ | ------ | ---------------------------------------------- | -| idle | string | 音频播放空闲,dateload/reset成功后处于此状态。 | +| idle | string | 音频播放空闲,dataload/reset成功后处于此状态。 | | playing | string | 音频正在播放,play成功后处于此状态。 | | paused | string | 音频暂停播放,pause成功后处于此状态。 | | stopped | string | 音频播放停止,stop/播放结束后处于此状态。 | @@ -695,7 +695,7 @@ audioPlayer.setVolume(3); //设置volume为无效值,触发'error'事件 | 名称 | 类型 | 可读 | 可写 | 说明 | | ------------------------ | ---------------------------------- | ---- | ---- | ------------------------------------------------------------ | | url8+ | string | 是 | 是 | 视频媒体URL,支持当前主流的视频格式(mp4、mpeg-ts、webm、mkv)。
**支持路径示例**:
1. fd类型播放:fd://xx
![](figures/zh-cn_image_url.png)
2. http网络播放: http://xx
3. https网络播放: https://xx
4. hls网络播放路径:http://xx或者https://xx
**需要权限:** ohos.permission.READ_MEDIA;如果需要使用网络素材,还需要申请ohos.permission.INTERNET。 | -| fdSrc9+ | [AVFileDescriptor](#interruptmode9) | 是 | 是 | 音频媒体文件描述,使用场景:应用中的音频资源被连续存储在同一个文件中。
**使用示例**:
假设一个连续存储的音乐文件:
音乐1(地址偏移:0,字节长度:100)
音乐2(地址偏移:101,字节长度:50)
音乐3(地址偏移:151,字节长度:150)
1. 播放音乐1:AVFileDescriptor { fd = 资源句柄; offset = 0; lengt = 100; }
2. 播放音乐2:AVFileDescriptor { fd = 资源句柄; offset = 101; length = 50; }
3. 播放音乐3:AVFileDescriptor { fd = 资源句柄; offset = 151; length = 150; }
假设是一个独立的音乐文件: 请使用src=fd://xx
**注意事项**:
**需要权限:** ohos.permission.READ_MEDIA | +| fdSrc9+ | [AVFileDescriptor](#interruptmode9) | 是 | 是 | 视频媒体文件描述,使用场景:应用中的视频资源被连续存储在同一个文件中。
**使用示例**:
假设一个连续存储的音乐文件:
视频1(地址偏移:0,字节长度:100)
视频2(地址偏移:101,字节长度:50)
视频3(地址偏移:151,字节长度:150)
1. 播放视频1:AVFileDescriptor { fd = 资源句柄; offset = 0; lengt = 100; }
2. 播放视频2:AVFileDescriptor { fd = 资源句柄; offset = 101; length = 50; }
3. 播放视频3:AVFileDescriptor { fd = 资源句柄; offset = 151; length = 150; }
假设是一个独立的视频文件: 请使用src=fd://xx
**注意事项**:
**需要权限:** ohos.permission.READ_MEDIA | | loop8+ | boolean | 是 | 是 | 视频循环播放属性,设置为'true'表示循环播放。 | | videoScaleType9+ | [VideoScaleType](#videoscaletype9) | 是 | 是 | 视频缩放模式。 | | audioInterruptMode9+ | [InterruptMode](#interruptmode9) | 是 | 是 | 音频焦点模型。 | @@ -1537,7 +1537,7 @@ videoPlayer.on('error', (error) => { // 设置'error'事件回调 console.info(`video error called, errCode is ${error.code}`); // 打印错误码 console.info(`video error called, errMessage is ${error.message}`);// 打印错误类型详细描述 }); -videoPlayer.setVolume(3); //设置volume为无效值,触发'error'事件 +videoPlayer.url = 'fd://error'; //设置错误的播放地址,触发'error'事件 ``` ### on('availableBitratesCollect')9+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md b/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md index c0663bf4f58c0c68ec1ed140a0092f0350cf5316..79e539d30e5f18e0a468e6e05cc000ba66115c20 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md +++ b/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md @@ -257,17 +257,12 @@ createAsset(mediaType: MediaType, displayName: string, relativePath: string): Pr **示例:** ``` -async function example() { - // 使用Promise方式创建Image类型文件 - let mediaType = mediaLibrary.MediaType.IMAGE; - let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; - const path = await media.getPublicDirectory(DIR_IMAGE); - media.createAsset(mediaType, "image01.jpg", path + 'myPicture/').then (function (asset) { - console.info("createAsset successfully:"+ JSON.stringify(asset)); - }).catch(function(err){ - console.info("createAsset failed with error:"+ err); - }); -} +let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA; +media.getPublicDirectory(DIR_CAMERA).then(function(dicResult){ + console.info("getPublicDirectory successfully:"+ JSON.stringify(dicResult)); +}).catch(function(err){ + console.info("getPublicDirectory failed with error:"+ err); +}); ``` ### getPublicDirectory8+ @@ -1917,13 +1912,11 @@ async function example() { extendArgs: "", }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getPositionObject(1, (err, fileAsset) => { - if (err) { - console.error('Failed '); - return; - } - console.log('fileAsset.displayName : ' + fileAsset.displayName); - }) + fetchFileResult.getPositionObject(1) .then(function (fileAsset){ + console.log('[Demo] fileAsset.displayName : ' + fileAsset.displayName); + }).catch(function (err) { + console.info("[Demo] getFileAssets failed with error:" + err); + }); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-osAccount.md b/zh-cn/application-dev/reference/apis/js-apis-osAccount.md index fded000bb04ddead66a536442fc34f30d176eb12..ae0ade3187e9075470956d16854e688dadd0e1d7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-osAccount.md +++ b/zh-cn/application-dev/reference/apis/js-apis-osAccount.md @@ -1912,6 +1912,1289 @@ queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promis console.info("queryOsAccountConstraintSourceType sourceTypeInfos:" + JSON.stringify(sourceTypeInfos)); ``` +## UserAuth8+ + +用户认证类。 + +### constructor8+ + +constructor() + +创建用户认证的实例。 + +**系统能力**:SystemCapability.Account.OsAccount + +**示例:** + ```js + let userAuth = new osAccount.UserAuth(); + console.info('====>test for examples constructor success'); + ``` + + +### getVersion8+ + +getVersion(): number; + +返回版本信息。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**返回值:** + +| 类型 | 说明 | +| :----- | :----------- | +| number | 返回版本信息。| + +**示例:** + ```js + let userAuth = new osAccount.UserAuth(); + console.info('====>test for examples constructor success'); + var version = userAuth.getVersion(); + console.info('====>test for examples version is : ' + JSON.stringify(version)); + ``` + +### getAvailableStatus8+ + +getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number; + +检查身份认证功能是否可用。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | -----------------------------------------------| ---- | ------------------------- | +| authType | [AuthType](#AuthType8+) | 是 | 指示用于认证的凭据类型。 | +| authTrustLevel | [AuthTrustLevel](#AuthTrustLevel8+) | 是 | 表示身份验证结果的信任级别。 | + +**返回值:** + +| 类型 | 说明 | +| :----- | :---------------------------------------- | +| number | 返回验证[结果](#ResultCode8+)。 | + +**示例:** + ```js + let userAuth = new osAccount.UserAuth(); + let authType = osAccount.AuthType.PIN; + let authTrustLevel = osAccount.AuthTrustLevel.ATL1; + console.info('====>test for examples constructor success'); + let availableStatus = userAuth.getAvailableStatus(authType, authTrustLevel); + console.info('====>test for examples AvailabeStatus is : ' + JSON.stringify(availableStatus)); + ``` + +### getProperty8+ + +getProperty(request: GetPropertyRequest, callback: AsyncCallback<ExecutorProperty>): void; + +基于指定的请求信息获取属性,使用callback回调异步返回结果。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------------------------- | ---- | ---------------------------------- | +| request | [GetPropertyRequest](#GetPropertyRequest8+) | 是 | 请求信息,包括认证类型和属性类型列表。 | +| callback | AsyncCallback<[ExecutorProperty](#ExecutorProperty8+)> | 是 | 回调结果,返回的是调用者属性。 | + +**示例:** + ```js + let userAuth = new osAccount.UserAuth(); + let authType = osAccount.AuthType.PIN; + let keys = new Array(); + keys[0] = osAccount.GetPropertyType.AUTH_SUB_TYPE; + keys[1] = osAccount.GetPropertyType.REMAIN_TIMES; + keys[2] = osAccount.GetPropertyType.FREEZING_TIME; + let getPropertyRequest = {authType, keys}; + userAuth.getProperty(getPropertyRequest,function (propReq) { + console.log("====>test for examples getallAuthInfo AsyncCallback = " + JSON.stringify(propReq)); + }) + ``` + +### getProperty8+ + +getProperty(request: GetPropertyRequest): Promise; + +基于指定的请求信息获取属性,使用Promise方式异步返回结果。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------ | ---- | ---------------------------------- | +| request | [GetPropertyRequest](#GetPropertyRequest8+) | 是 | 请求信息,包括认证类型和属性类型列表。 | + +**返回值:** + +| 类型 | 说明 | +| :---------------------------------------------------------------- | :-------------------------------------------------- | +| Promise<[ExecutorProperty](#ExecutorProperty8+)> | Promise实例,用于获取异步返回结果,返回的是调用者属性。 | + +**示例:** + ```js + let userAuth = new osAccount.UserAuth(); + let authType = osAccount.AuthType.PIN; + let keys = new Array(); + keys[0] = osAccount.GetPropertyType.AUTH_SUB_TYPE; + keys[1] = osAccount.GetPropertyType.REMAIN_TIMES; + keys[2] = osAccount.GetPropertyType.FREEZING_TIME; + let getPropertyRequest = {authType, keys}; + userAuth.getProperty(getPropertyRequest).then((propReq) => { + console.log("====>test for examples getallAuthInfo AsyncCallback = " + JSON.stringify(propReq)); + }); + ``` + +### setProperty8+ + +setProperty(request: SetPropertyRequest, callback: AsyncCallback): void; + +设置可用于初始化算法的属性,使用callback回调异步返回结果。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------- | ---- | ---------------------------------------------------------------------- | +| request | [SetPropertyRequest](#SetPropertyRequest8+)| 是 | 请求信息,包括认证类型和要设置的密钥值。 | +| callback | AsyncCallback<number> | 是 | 回调结果,返回一个[数值](#ResultCode8+),指示属性设置是否成功。 | + +**示例:** + ```js + let userAuth = new osAccount.UserAuth(); + let authType = osAccount.AuthType.PIN; + let key = osAccount.SetPropertyType.INIT_ALGORITHM; + let setInfo = new Uint8Array(); + let setPropertyRequest = {authType, key, setInfo}; + userAuth.setProperty(setPropertyRequest,function (setProp) { + console.log("====>test for examples setProperty AsyncCallback = " + JSON.stringify(setProp)); + }); + ``` + +### setProperty8+ + +setProperty(request: SetPropertyRequest): Promise; + +设置可用于初始化算法的属性,使用Promise方式异步返回结果。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------ | ---- | ---------------------------------------- | +| request | [SetPropertyRequest](#SetPropertyRequest8+) | 是 | 请求信息,包括身份验证类型和要设置的密钥值。 | + +**返回值:** + +| 类型 | 说明 | +| :-------------------- | :-------------------------------------------------------------------------------------------- | +| Promise<number> | Promise实例,用于获取异步返回结果,返回一个[数值](#ResultCode8+),指示属性设置是否成功。 | + +**示例:** + ```js + let userAuth = new osAccount.UserAuth(); + let authType = osAccount.AuthType.PIN; + let key = osAccount.SetPropertyType.INIT_ALGORITHM; + let setInfo = new Uint8Array(); + let setPropertyRequest = {authType, key, setInfo}; + userAuth.setProperty(setPropertyRequest).then((setProp) => { + console.log("====>test for examples setProperty AsyncCallback = " + JSON.stringify(setProp)); + }); + ``` + +### auth8+ + +auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array; + +执行认证,使用callback回调异步返回结果。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ---------------------------------------------------- | --- | ------------------------------------ | +| challenge | Uint8Array | 是 | 指示挑战值,挑战值为一个随机数,用于提升安全性。| +| authType | [AuthType](#AuthType8+) | 是 | 指示认证类型。 | +| authTrustLevel | [AuthTrustLevel](#AuthTrustLevel8+) | 是 | 指示认证结果的信任级别。 | +| callback | [IUserAuthCallback](#IUserAuthCallback8+) | 是 | 回调结果,返回的是结果和所获取的信息。 | + + +**返回值:** + +| 类型 | 说明 | +| :--------- | :----------------- | +| Uint8Array | 返回取消的上下文ID。 | + +**示例:** + ```js + let userAuth = new osAccount.UserAuth(); + let authType = osAccount.AuthType.PIN; + let challenge = 1; + let authTrustLevel = osAccount.AuthTrustLevel.ATL1; + let onresult = { + authresult: null, + authextr: null, + } + userAuth.auth(challenge, authType,authTrustLevel,{ + onResult: function(result,extraInfo){ + console.log("====>test for examples auth result = " + result); + onresult.authresult = result; + console.log("====>test for examples auth extraInfo = " + JSON.stringify(extraInfo)); + onresult.authextr = extraInfo; + console.info('====>test for examples auth onResult = ' + JSON.stringify(onresult)); + } + }); + ``` + +### authUser8+ + +authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array; + +执行用户认证,使用callback回调异步返回结果。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ---------------------------------------------------- | --- | ------------------------------------ | +| userId | number | 是 | 指示用户身份。 | +| challenge | Uint8Array | 是 | 指示挑战值,挑战值为一个随机数,用于提升安全性。 | +| authType | [AuthType](#AuthType8+) | 是 | 指示认证类型。 | +| authTrustLevel | [AuthTrustLevel](#AuthTrustLevel8+) | 是 | 指示认证结果的信任级别。 | +| callback | [IUserAuthCallback](#IUserAuthCallback8+) | 是 | 回调结果,返回的是结果和所获取的信息。 | + + +**返回值:** + +| 类型 | 说明 | +| :--------- | :----------------- | +| Uint8Array | 返回取消的上下文ID。 | + +**示例:** + ```js + let userAuth = new osAccount.UserAuth(); + let authType = osAccount.AuthType.PIN; + let challenge = 1; + let authTrustLevel = osAccount.AuthTrustLevel.ATL1; + let userID = 100; + let onresult = { + authresult: null, + authextr: null, + } + userAuth.authUser(userID, challenge, authType, authTrustLevel, { + onResult: function(result,extraInfo){ + console.log("====>test for examples authUser result = " + result); + onresult.authresult = result; + console.log("====>test for examples authUser extraInfo = " + JSON.stringify(extraInfo)); + onresult.authextr = extraInfo; + console.info('====>test for examples authUser onResult = ' + JSON.stringify(onresult)); + } + }); + ``` + +### cancelAuth8+ + +cancelAuth(contextID: Uint8Array): number; + +取消特定的认证。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------| ---------- | ---- | ------------------------------------------ | +| contextID | Uint8Array | 是 | 指示身份验证上下文ID,此ID动态生成没有具体值。 | + +**返回值:** + +| 类型 | 说明 | +| :----- | :-------------------------------------------------------- | +| number | 返回一个[数字](#ResultCode8+),指示取消是否成功。 | + +**示例:** + ```js + let userAuth = new osAccount.UserAuth(); + let contextID = null; + let cancelAuthresult = null; + cancelAuthresult = userAuth.cancelAuth(contextID); + console.log("====>test for examples cancelAuthresult result = " + JSON.stringify(cancelAuthresult)); + ``` + +## PINAuth8+ + +Pin码认证功能基类。 + +### constructor8+ + +constructor() + +创建Pin码认证的实例。 + +**系统能力**:SystemCapability.Account.OsAccount + +**示例:** + ```js + var pinAuth = new osAccount.PINAuth(); + console.info('====>test for examples constructor success'); + ``` + +### registerInputer + +registerInputer(inputer: IInputer): boolean; + +注册输入器。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.ACCESS_PIN_AUTH + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------| ----------------------------------- | --- | ------------------ | +| inputer | [IInputer](#IInputer8+) | 是 | 指示密码输入框回调。 | + +**返回值:** + +| 类型 | 说明 | +| :------ | :-------------------------------------------- | +| boolean | 返回布尔值,true表示注册成功,false表示注册失败。 | + +**示例:** + ```js + var pinAuth = new osAccount.PINAuth(); + var GetAuthSubType = 0; + var AuthSubType = osAccount.AuthSubType.PIN_SIX; + var Inputerdata = [0,1,3]; + var registerresult = pinAuth.registerInputer({ + onGetData: (GetAuthSubType, IInputData) => { + if (GetAuthSubType == 0) { + IInputData.onSetData(AuthSubType, Inputerdata) + } else { + IInputData.onSetData(GetAuthSubType, Inputerdata); + } + } + }) + console.log("====>test for examples RegisterInputer result is: " + registerresult); + ``` + +### unregisterInputer + +unregisterInputer(): void; + +卸载输入器。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.ACCESS_PIN_AUTH + +**示例:** + ```js + var pinAuth = new osAccount.PinAuth(); + pinAuth.unregisterInputer(); + ``` + +## UserIdentityManager8+ + +获取用户身份管理类。 + +### constructor8+ + +constructor() + +创建用户认证的实例。 + +**系统能力**:SystemCapability.Account.OsAccount + +**示例:** + ```js + var userIDM = new osAccount.UserIdentityManager(); + console.info('====>test for examples constructor success'); + ``` + +### openSession8+ + +openSession(callback: AsyncCallback<Uint8Array>): void; + +打开会话,启动IDM操作以获取挑战值,使用callback回调异步返回结果。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.MANAGE_USER_IDM + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------------------- | ---- | -------------------------------- | +| callback | AsyncCallback<Uint8Array> | 是 | 回调结果,返回的是挑战值,非0即成功,为0则失败。| + +**示例:** + ```js + var userIDM = new osAccount.UserIdentityManager(); + var challenge; + userIDM.openSession(function(err, data){ + try{ + console.log("====>test for examples before get challenge"); + console.log("====>test for examples + " + data); + challenge = data; + console.log("====>test for examples end "); + console.log("====>test for examples after get challenge"); + } + catch(e) { + console.info('====>test for examples openSession error = ' + JSON.stringify(e)); + } + }); + ``` + +### openSession8+ + +openSession(): Promise<Uint8Array>; + +打开会话,启动IDM操作以获取挑战值,使用Promise方式异步返回结果。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.MANAGE_USER_IDM + +**返回值:** + +| 类型 | 说明 | +| :------------------------ | :------------------------------------------------------- | +| Promise<Uint8Array> | Promise实例,用于获取异步返回结果,返回的是挑战值,非0即成功,为0则失败。| + +**示例:** + ```js + var userIDM = new osAccount.UserIdentityManager(); + var challenge; + userIDM.openSession().then((data) => { + try{ + console.log("====>test for examples before get challenge"); + console.log("====>test for examples + " + data); + challenge = data; + console.log("====>test for examples end "); + console.log("====>test for examples after get challenge"); + } + catch(err) { + console.info('====>test for examples faceDemo openSession error1 = ' + JSON.stringify(err)); + } + }) + .catch((err) => { + console.info('====>test for examples faceDemo openSession error2 = ' + JSON.stringify(err)); + }) + ``` + +### addCredential8+ + +addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; + +添加凭据,添加用户凭据信息,传入凭据添加方法和凭据信息(凭据类型,子类,如果添加用户的非密码凭据,则传入密码身份验证令牌),并获取结果/获取信息,使用callback回调异步返回结果。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.MANAGE_USER_IDM + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ------------------------------------------------ | --- | -------------------------------- | +| credentialInfo | [CredentialInfo](#CredentialInfo8+) | 是 | 指示凭据信息。 | +| callback | [IIdmCallback](#IIdmCallback8+) | 是 | 回调结果,返回的是结果和获取信息。 | + +**示例:** + ```js + var userIDM = new osAccount.UserIdentityManager(); + let CredentialInfo = null; + let onresult = { + addCredresult: null, + credentialId: null, + } + userIDM.addCredential(CredentialInfo, { + onResult: function(result,extraInfo){ + console.info('====>test for examples aaaaaaaaaaaaa'); + console.info("====>test for examples addCredential result = " + result); + console.info("====>test for examples addCredential extraInfo = " + JSON.stringify(extraInfo)); + console.log(result) + onresult.addCredresult= result; + if(extraInfo != undefined) { + onresult.credentialId = extraInfo.credentialId + } else { + onresult.credentialId = null; + } + } + }) + ``` + +### updateCredential8+ + +updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; + +更新凭据,使用callback回调异步返回结果。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.MANAGE_USER_IDM + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ------------------------------------------------- | --- | -------------------------------- | +| credentialInfo | [CredentialInfo](#CredentialInfo8+) | 是 | 指示凭据信息。 | +| callback | [IIdmCallback](#IIdmCallback8+) | 是 | 回调结果,返回的是结果和获取信息。 | + +**示例:** + ```js + var userIDM = new osAccount.UserIdentityManager(); + let CredentialInfo = null; + let onresult = { + addCredresult: null, + credentialId: null, + } + userIDM.updateCredential(CredentialInfo, { + onResult: function(result,extraInfo){ + console.log("====>test for examples faceDemo updateCredential result = " + result) + onresult.updateCredresult = result + console.log("====>test for examples faceDemo updateCredential credentialId = " + extraInfo.credentialId) + if(extraInfo != undefined) { + onresult.CredentialId = extraInfo.credentialId + } else { + onresult.CredentialId = null; + } + console.info('====>test for examples publicupdateCred updateCredential onResult = ' + JSON.stringify(onresult)); + } + }) + ``` + +### closeSession8+ + +closeSession(): void; + +关闭会话,结束IDM操作 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.MANAGE_USER_IDM + +**示例:** + ```js + var userIDM = new osAccount.UserIdentityManager(); + userIDM.closeSession(); + ``` + +### cancel8+ + +cancel(challenge: Uint8Array): number; + +根据挑战值取消条目。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.MANAGE_USER_IDM + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------- | ---- | ----- | +| challenge | Uint8Array | 是 | 挑战值。 | + +**返回值:** + +| 类型 | 说明 | +| :----- | :-------------------------------------------------------- | +| number | 返回一个[数字](#ResultCode8+),指示取消是否成功。 | + +**示例:** + ```js + var userIDM = new osAccount.UserIdentityManager(); + let challenge = 1; + let cancelresult = userIDM.cancel(challenge); + ``` + +### delUser8+ + +delUser(token: Uint8Array, callback: IIdmCallback): void; + +删除具有身份验证令牌的用户,使用callback方式异步返回结果。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.MANAGE_USER_IDM + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------ | --- | ------------------------- | +| token | Uint8Array | 是 | 身份验证令牌。 | +| callback | [IIdmCallback](#IIdmCallback8+) | 是 | 回调结果,返回的是删除结果。| + +**示例:** + ```js + var userIDM = new osAccount.UserIdentityManager(); + let onresult = { + delUserresult: null, + CredentialId: null, + } + let token = null; + userIDM.delUser(token, { + onResult: function(result,extraInfo){ + console.log("====>test for examples delUser result = " + result) + onresult.delUserresult = result + if(extraInfo != undefined) { + onresult.CredentialId = extraInfo.credentialId + } else { + onresult.CredentialId = null; + } + console.info('====>test for examples publicdelUser delUser = ' + JSON.stringify(onresult)); + } + }) + ``` + +### delCred8+ + +delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): void; + +删除用户凭据信息,使用callback方式异步返回结果。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.MANAGE_USER_IDM + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ----------------------------------------------- | --- | ---------------------------| +| credentialId | Uint8Array | 是 | 凭证索引。 | +| token | Uint8Array | 是 | 身份验证令牌。 | +| callback | [IIdmCallback](#IIdmCallback8+) | 是 | 回调结果,返回的是删除结果。 | + +**示例:** + ```js + var userIDM = new osAccount.UserIdentityManager(); + let onresult = { + delUserresult: null, + CredentialId: null, + } + let credentialId = 1; + let token = null; + userIDM.delCred(credentialId, token,{ + onResult: function(result,extraInfo){ + console.log("====>test for examples delCred result = " + result) + onresult.delCredresult = result + console.log("====>test for examples delCred extraInfo = " + extraInfo) + if(extraInfo != undefined) { + onresult.CredentialId = extraInfo.credentialId + } else { + onresult.CredentialId = null; + } + console.log("====>test for examples delCred onresult = " + JSON.stringify(onresult)); + } + }) + ``` + +### getAuthInfo8+ + +getAuthInfo(callback: AsyncCallback<Array<EnrolledCredInfo>>, authType?: AuthType): void; + +获取认证信息,使用callback回调异步返回结果。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.MANAGE_USER_IDM + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------------------------------------- | ---- | -------------------------------------------------- | +| callback | AsyncCallback<Array<[EnrolledCredInfo](#EnrolledCredInfo8+)>> | 是 | 回调结果,返回的是当前用户指定类型的所有已注册凭据信息。| +| authType | [AuthType](#AuthType8+) | 否 | 认证类型。 | + +**示例:** + ```js + var userIDM = new osAccount.UserIdentityManager(); + var authType = osAccount.AuthType.PIN; + userIDM.getAuthInfo(authType, function (authInfo) { + console.log("====>test for examples getAuthInfo AsyncCallback = " + JSON.stringify(authInfo)) + }) + ``` + +### getAuthInfo8+ + +getAuthInfo(authType?: AuthType): Promise<Array<EnrolledCredInfo>>; + +获取认证信息,使用Promise方式异步返回结果。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.MANAGE_USER_IDM + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------- | ---- | -------- | +| authType | [AuthType](#AuthType8+) | 否 | 认证类型。| + +**返回值:** + +| 类型 | 说明 | +| :------------------------------------------- | :------------------------------------------------------------------------ | +| Promise<Array<[EnrolledCredInfo](#EnrolledCredInfo8+)>> | Promise实例,用于获取异步返回结果,返回的是当前用户指定类型的所有已注册凭据信息。| + +**示例:** + ```js + var userIDM = new osAccount.UserIdentityManager(); + var authType = osAccount.AuthType.PIN; + userIDM.getAuthInfo(authType).then((authInfo) => { + console.log("====>test for examples getAuthInfo AsyncCallback = " + JSON.stringify(authInfo)) + }) + ``` + +## IInputData8+ + +密码数据回调。 + +### onSetData8+ + +onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void; + +通知设置数据。 + +**系统能力:** SystemCapability.Account.OsAccount + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ---------------------------------------- | ---- | ----------------------------------------------- | +| pinSubType | [AuthSubType](#AuthSubType8+) | 是 | 用于认证的凭据子类型。 | +| data | Uint8Array | 是 | 要设置的数据是凭据,用来在认证、添加、修改凭据操作。 | + +**示例:** + ```js + console.log("====>test for examples onCreate start "); + var pinAuth = new osAccount.PINAuth(); + var GetAuthSubType = 0; + var AuthSubType = osAccount.AuthSubType.PIN_SIX; + console.log("====>test for examples GetAuthSubType " + GetAuthSubType); + console.log("====>test for examples AuthSubType " + AuthSubType); + var Inputerdata = [0,1,3]; + var registerresult = pinAuth.registerInputer({ + onGetData: (GetAuthSubType, IInputData) => { + console.log("====>test for examples by GetAuthSubType " +GetAuthSubType ); + if (GetAuthSubType == 0) { + console.log("====>test for examples GetAuthSubType == 0 "); + IInputData.onSetData(AuthSubType, Inputerdata) + } else { + console.log("====>test for examples GetAuthSubType == 1 "); + IInputData.onSetData(GetAuthSubType, Inputerdata); + } + } + }) + console.log("====>test for examples RegisterInputer result is: " + registerresult); + ``` + +## IInputer8+ + +密码输入框回调。 + +### onGetData8+ + +onGetData: (callback: IInputData) => void; + +通知获取数据。 + +**系统能力:** SystemCapability.Account.OsAccount + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| callback | [IInputData](#IInputData8+) | 是 | 指示密码数据回调。| + +**示例:** + ```js + console.log("====>test for examples onCreate start "); + var pinAuth = new osAccount.PINAuth(); + var GetAuthSubType = 0; + var AuthSubType = osAccount.AuthSubType.PIN_SIX; + console.log("====>test for examples GetAuthSubType " + GetAuthSubType); + console.log("====>test for examples AuthSubType " + AuthSubType); + var Inputerdata = [0,1,3]; + var registerresult = pinAuth.registerInputer({ + onGetData: (GetAuthSubType, IInputData) => { + console.log("====>test for examples by GetAuthSubType " +GetAuthSubType ); + if (GetAuthSubType == 0) { + console.log("====>test for examples GetAuthSubType == 0 "); + IInputData.onSetData(AuthSubType, Inputerdata) + } else { + console.log("====>test for examples GetAuthSubType == 1 "); + IInputData.onSetData(GetAuthSubType, Inputerdata); + } + } + }) + console.log("====>test for examples RegisterInputer result is: " + registerresult); + ``` + +## IUserAuthCallback8+ + +用户认证回调。 + +### onResult8+ + +onResult: (result: number, extraInfo: AuthResult) => void; + +身份认证结果代码通过回调返回。 + +**系统能力:** SystemCapability.Account.OsAccount + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | --------------------------------------- | ---- | ------------------- | +| result | number | 是 | 表示身份认证结果代码。| +| extraInfo | [AuthResult](#AuthResult8+) | 是 | 表示不同情况下的具体信息,如果认证通过,则在extrainfo中返回认证令牌,如果身份验证失败,则在extrainfo中返回剩余的身份验证时间,如果身份验证执行器被锁定,冻结时间将在extrainfo中返回。| + +**示例:** + ```js + let userAuth = new osAccount.UserAuth(); + let authType = osAccount.AuthType.PIN; + let challenge = 1; + let authTrustLevel = osAccount.AuthTrustLevel.ATL1; + let onresult = { + authresult: null, + authextr: null, + } + userAuth.auth(challenge, authType,authTrustLevel,{ + onResult: function(result,extraInfo){ + console.log("====>test for examples auth result = " + result); + onresult.authresult = result; + console.log("====>test for examples auth extraInfo = " + JSON.stringify(extraInfo)); + onresult.authextr = extraInfo; + console.info('====>test for examples auth onResult = ' + JSON.stringify(onresult)); + } + }); + ``` + +### onAcquireInfo?8+ + +onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void; + +在身份验证期间,TipsCode通过回调返回。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------- | ---- | ----------------------------- | +| module | number | 是 | 指示用于身份验证的执行器类型。 | +| acquire | number | 是 | 指示不同身份验证执行器的tip代码。| +| extraInfo | any | 是 | 保留参数。 | + +**示例:** + ```js + let userAuth = new osAccount.UserAuth(); + let authType = osAccount.AuthType.PIN; + let challenge = 1; + let authTrustLevel = osAccount.AuthTrustLevel.ATL1; + let onresult = { + authresult: null, + authextr: null, + } + let onacquireinfo = { + authmodule : null, + authacquire : null, + authextr : null + } + userAuth.auth(challenge, authType,authTrustLevel,{ + onResult: function(result,extraInfo){ + console.log("====>test for examples auth result = " + result) + onresult.authresult = result + console.log("====>test for examples auth extraInfo = " + JSON.stringify(extraInfo)); + onresult.authextr = extraInfo; + console.info('====>test for examples auth onResult = ' + JSON.stringify(onresult)); + }, + onAcquireInfo:function (modulea,acquire,extr){ + console.info('====>test for examples publicauth auth onAcquireInfo in'); + onacquireinfo.authmodule = modulea; + onacquireinfo.authacquire = acquire; + onacquireinfo.authextr = extr; + console.log("====>test for examples auth module = " + JSON.stringify(modulea)); + console.info('====>test for examples publicauth auth onAcquireInfo = ' + JSON.stringify(onacquireinfo)); + } + }); + ``` + +## IIdmCallback8+ + +身份管理回调。 + +### onResult8+ + +onResult: (result: number, extraInfo: AuthResult) => void; + +身份认证结果代码通过回调返回。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | --------------------------------------- | ---- | ----------------------- | +| result | number | 是 | 表示身份认证结果代码。 | +| extraInfo | [AuthResult](#AuthResult8+) | 是 | 针对不同情况传递具体信息。| + +**示例:** + ```js + var userIDM = new osAccount.UserIdentityManager(); + let CredentialInfo = null; + let onresult = { + addCredresult: null, + credentialId: null, + } + userIDM.updateCredential(CredentialInfo, { + onResult: function(result,extraInfo){ + console.log("====>test for examples updateCredential result = " + result) + onresult.updateCredresult = result + console.log("====>test for examples updateCredential credentialId = " + extraInfo.credentialId) + if(extraInfo != undefined) { + onresult.CredentialId = extraInfo.credentialId + } else { + onresult.CredentialId = null; + } + console.info('====>test for examples publicupdateCred updateCredential onResult = ' + JSON.stringify(onresult)); + } + }) + ``` + +### onAcquireInfo?8+ + +onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void; + +在身份验证期间,TipsCode通过回调返回。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.Account.OsAccount + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------- | ---- | ----------------------------- | +| module | number | 是 | 指示用于身份验证的执行器类型。 | +| acquire | number | 是 | 指示不同身份验证执行器的tip代码。| +| extraInfo | any | 是 | 保留参数。 | + +**示例:** + ```js + var userIDM = new osAccount.UserIdentityManager(); + let CredentialInfo = null; + let onresult = { + addCredresult: null, + credentialId: null, + } + let onacquireinfo = { + updateCredmodule : null, + updateCredacquire : null, + updateCredextr : null + } + userIDM.updateCredential(CredentialInfo, { + onResult: function(result,extraInfo){ + console.log("====>test for examples updateCredential result = " + result) + onresult.updateCredresult = result + console.log("====>test for examples updateCredential credentialId = " + extraInfo.credentialId) + if(extraInfo != undefined) { + onresult.CredentialId = extraInfo.credentialId + } else { + onresult.CredentialId = null; + } + console.info('====>test for examples publicupdateCred updateCredential onResult = ' + JSON.stringify(onresult)); + }, + onAcquireInfo:function (modulea,acquire,extr){ + console.info('====>test for examples publicupdateCred updateCredential onAcquireInfo in '); + onacquireinfo.updateCredmodule = modulea + onacquireinfo.updateCredacquire = acquire + onacquireinfo.updateCredextr = extr + console.info('====>test for examples updateCredential onacquireinfo = ' + JSON.stringify(onacquireinfo)); + console.log("====>test for examples updateCredential module = " + modulea) + } + }) + ``` + +## GetPropertyRequest8+ + +提供获取属性请求的信息。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------- | ----- | ----------------------- | +| authType | [AuthType](#AuthType8+) | 是 | 身份验证凭据类型。 | +| keys | Array<[GetPropertyType](#GetPropertyType8+)> | 是 | 指示要获取的属性类型数组。 | + +## SetPropertyRequest8+ + +提供设置属性请求的信息。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------ | ----- | -------------------- | +| authType | [AuthType](#AuthType8+) | 是 | 身份验证凭据类型。 | +| keys | [SetPropertyType](#SetPropertyType8+) | 是 | 指示要设置的属性类型。 | +| setInfo | Uint8Array | 是 | 指示要设置的信息。 | + +## ExecutorProperty8+ + +提供执行器的属性。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | ---------------------------------------- | ----- | ----------------- | +| result | number | 是 | 指示结果。 | +| authSubType | [AuthSubType](#AuthSubType8+) | 是 | 指示认证凭据子类型。| +| remainTimes | number | 否 | 指示剩余时间。 | +| freezingTime | number | 否 | 指示冻结时间。 | + +## AuthResult8+ + +指示认证结果的信息。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | ----------- | ----- | ----------------- | +| token | Uint8Array | 否 | 指示认证令牌。 | +| remainTimes | number | 否 | 指示剩余时间。 | +| freezingTime | number | 否 | 指示冻结时间。 | + +## CredentialInfo8+ + +指示凭证信息。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | ---------------------------------------- | ----- | ----------------- | +| credType | [AuthType](#AuthType8+) | 是 | 指示凭据类型。 | +| credSubType | [AuthSubType](#AuthSubType8+) | 是 | 指示凭据子类型。 | +| token | Uint8Array | 是 | 指示认证令牌。 | + +## RequestResult8+ + +指示请求结果的信息。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | ----------- | ----- | ----------------- | +| credentialId | Uint8Array | 否 | 指示凭据索引。 | + +## EnrolledCredInfo8+ + +指示已注册凭据的信息。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | ---------------------------------------- | ----- | ------------------- | +| credentialId | Uint8Array | 是 | 指示凭据索引。 | +| authType | [AuthType](#AuthType8+) | 是 | 指示认证凭据类型。 | +| authSubType | [AuthSubType](#AuthSubType8+) | 是 | 指示认证凭据子类型。 | +| templateId | Uint8Array | 是 | 指示凭据模板ID。 | + +## GetPropertyType8+ + +枚举,指示要获取的属性类型。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数 | 默认值 | 说明 | +| ------------- | ------ | --------- | +| AUTH_SUB_TYPE | 1 | 认证子类型。 | +| REMAIN_TIMES | 2 | 剩余时间。 | +| FREEZING_TIME | 3 | 冻结时间。 | + +## SetPropertyType8+ + +枚举,指示要设置的属性类型。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数 | 默认值 | 说明 | +| -------------- | ----- | ----------- | +| INIT_ALGORITHM | 1 | 初始化算法。 | + +## AuthType8+ + +枚举,指示身份验证的凭据类型。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数 | 默认值 | 说明 | +| ----- | ----- | ---------------- | +| PIN | 1 | 指示PIN认证类型。 | +| FACE | 2 | 指示脸部认证类型。| + +## AuthSubType8+ + +枚举,指示用于认证的凭据子类型。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数 | 默认值 | 说明 | +| ---------- | ----- | ------------------ | +| PIN_SIX | 10000 | 表示6位凭证。 | +| PIN_NUMBER | 10001 | 表示自定义数字凭证。 | +| PIN_MIXED | 10002 | 表示自定义混合凭据。 | +| FACE_2D | 20000 | 指示2D 人脸凭证。 | +| FACE_3D | 20001 | 指示3D 人脸凭证。 | + +## AuthTrustLevel8+ + +枚举,指示认证结果的受信任级别。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数 | 默认值 | 说明 | +| ---- | ------ | ----------- | +| ATL1 | 10000 | 信任级别 1。 | +| ATL2 | 20000 | 信任级别 2。 | +| ATL3 | 30000 | 信任级别 3。 | +| ATL4 | 40000 | 信任级别 4。 | + +## Module8+ + +枚举,表示获取信息的模块。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数 | 默认值 | 说明 | +| --------- | ------ | ------------------------ | +| FACE_AUTH | 1 | 表示从人脸认证获取的信息。 | + +## ResultCode8+ + +枚举,指示身份验证结果代码。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数 | 默认值 | 说明 | +| ----------------------- | ----- | ---------------------------------------- | +| SUCCESS | 0 | 表示身份验证成功或支持此功能。 | +| FAIL | 1 | 表示验证器无法识别用户。 | +| GENERAL_ERROR | 2 | 表示其他错误。 | +| CANCELED | 3 | 表示身份验证已取消。 | +| TIMEOUT | 4 | 表示身份验证已超时。 | +| TYPE_NOT_SUPPORT | 5 | 表示不支持此身份验证类型。 | +| TRUST_LEVEL_NOT_SUPPORT | 6 | 表示不支持身份验证信任级别。 | +| BUSY | 7 | 表示身份验证任务正忙。等待几秒钟,然后重试。 | +| INVALID_PARAMETERS | 8 | 表示参数不正确。 | +| LOCKED | 9 | 指示身份验证器已锁定。 | +| NOT_ENROLLED | 10 | 表示用户尚未注册验证器。 | + +## FaceTipsCode8+ + +枚举,指示人脸验证过程中提示代码。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数 | 默认值 | 说明 | +| ----------------------------- | ----- | ---------------------------------------- | +| FACE_AUTH_TIP_TOO_BRIGHT | 1 | 表示由于高照明,获得的面部图像太亮。 | +| FACE_AUTH_TIP_TOO_DARK | 2 | 表示由于照明度低,获得的面部图像太暗。 | +| FACE_AUTH_TIP_TOO_CLOSE | 3 | 表示面部离设备太近。 | +| FACE_AUTH_TIP_TOO_FAR | 4 | 表示面部离设备太远。 | +| FACE_AUTH_TIP_TOO_HIGH | 5 | 表示设备太高,仅捕捉面部上部。 | +| FACE_AUTH_TIP_TOO_LOW | 6 | 表示设备太低,仅捕捉面部下部。 | +| FACE_AUTH_TIP_TOO_RIGHT | 7 | 指示设备向右偏移,并且仅捕捉面部的右侧部分。 | +| FACE_AUTH_TIP_TOO_LEFT | 8 | 指示设备向左偏移,并且仅捕捉面部的左侧部分。 | +| FACE_AUTH_TIP_TOO_MUCH_MOTION | 9 | 表示面部信息收集过程中面部移动过快。 | +| FACE_AUTH_TIP_POOR_GAZE | 10 | 表示面未朝向设备。 | +| FACE_AUTH_TIP_NOT_DETECTED | 11 | 表示未检测到人脸。 | + +## ingerprintTips8+ + +枚举,指示指纹身份验证过程中提示代码。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount + +| 参数 | 默认值 | 说明 | +| ----------------------------- | ----- | ----------------------------------------------- | +| FINGERPRINT_TIP_GOOD | 0 | 表明采集的图像良好。 | +| FINGERPRINT_TIP_IMAGER_DIRTY | 1 | 表示由于传感器上可疑或检测到污垢,指纹图像噪声过大。 | +| FINGERPRINT_TIP_INSUFFICIENT | 2 | 表示由于检测到的情况,指纹图像噪声太大,无法处理。 | +| FINGERPRINT_TIP_PARTIAL | 3 | 指示仅检测到部分指纹图像。 | +| FINGERPRINT_TIP_TOO_FAST | 4 | 表示指纹图像由于快速运动而不完整。 | +| FINGERPRINT_TIP_TOO_SLOW | 5 | 表示由于缺少运动,指纹图像无法读取。 | + ## OsAccountInfo 系统帐号信息。 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 f3f3ba733bc56301ba22021a4fbd3edfaa1c92e2..e41944c75170b6c9d36d451a2500dcb77c7586e7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md +++ b/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @@ -1,5 +1,6 @@ # 剪贴板 + 剪贴板服务主要组件包括剪贴板管理客户端和剪贴板服务。剪贴板管理客户端负责剪贴板接口管理,提供剪贴板北向JS API给应用;在应用框架侧创建剪贴板数据、请求剪贴板SA执行剪贴板的新建、删除、查询、转换文本、配置等。剪贴板服务负责剪贴板事件管理,管理剪贴板SA的生命周期,为系统复制、粘贴功能提供支持。 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-privacyManager.md b/zh-cn/application-dev/reference/apis/js-apis-privacyManager.md index 38c1f1c7be9d1814ef5990dc61516e93975d04de..cadfc12098a6e85805136f8bf78d76705179f657 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-privacyManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-privacyManager.md @@ -191,7 +191,7 @@ privacyManager.getPermissionUsedRecords(request, (err, data) => { | -------- | -------------- | ---- | ---------------------------------------- | | beginTime | number | 否 | 查询记录的起始时间,单位:ms。 | | endTime | number | 否 | 查询记录的终止时间,单位:ms。 | -| bundleRecords | Array<[BundleUsedRecord](#BundleUsedRecord)> | 否 | 应用的权限使用记录集合。 | +| bundleRecords | Array<[BundleUsedRecord](#bundleusedrecord)> | 否 | 应用的权限使用记录集合。 | ## BundleUsedRecord @@ -205,7 +205,7 @@ privacyManager.getPermissionUsedRecords(request, (err, data) => { | isRemote | boolean | 否 | 默认值false。 | | deviceId | string | 否 | 目标应用所在设备的ID。 | | bundleName | string | 否 | 目标应用的包名。 | -| permissionRecords | Array<[PermissionUsedRecord](#PermissionUsedRecord)> | 否 | 每个应用的权限使用记录集合。 | +| permissionRecords | Array<[PermissionUsedRecord](#permissionusedrecord)> | 否 | 每个应用的权限使用记录集合。 | ## PermissionUsedRecord diff --git a/zh-cn/application-dev/reference/apis/js-apis-request.md b/zh-cn/application-dev/reference/apis/js-apis-request.md index b8d0060ec1db845e8e757d40cc11cd3f14c31435..6bed24b80575830c7ddb0d84ea4e1edcb2b856f6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-request.md +++ b/zh-cn/application-dev/reference/apis/js-apis-request.md @@ -1118,6 +1118,7 @@ resume(callback: AsyncCallback<void>): void | filePath7+ | string | 否 | 设置下载路径(默认在'internal://cache/'路径下)。
- filePath:'workspace/test.txt':默认路径下创建workspace路径,并将文件存储在workspace路径下。
- filePath:'test.txt':将文件存储在默认路径下。
- filePath:'workspace/':默认路径下创建workspace路径,并将文件存储在workspace路径下。 | | networkType | number | 否 | 设置允许下载的网络类型。 | | title | string | 否 | 设置下载会话标题。 | +| background | boolean | 否 | 后台任务通知开关,开启后可在通知中显示下载状态。 | ## DownloadInfo7+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-rpc.md b/zh-cn/application-dev/reference/apis/js-apis-rpc.md index 2456ffa333aecefb4ef88ae0862ee8206325aeda..d45b3934bcdf596a5736864c81a19ef5fa7d5c94 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-rpc.md +++ b/zh-cn/application-dev/reference/apis/js-apis-rpc.md @@ -1322,7 +1322,7 @@ writeFloatArray(floatArray: number[]): boolean **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | floatArray | number[] | 是 | 要写入的浮点数组。 | + | floatArray | number[] | 是 | 要写入的浮点数组。由于系统内部对float类型的数据是按照double处理的,使用时对于数组所占的总字节数应按照double类型来计算。 | **返回值:** | 类型 | 说明 | @@ -1349,7 +1349,7 @@ readFloatArray(dataIn: number[]) : void **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | dataIn | number[] | 是 | 要读取的浮点数组。 | + | dataIn | number[] | 是 | 要读取的浮点数组。由于系统内部对float类型的数据是按照double处理的,使用时对于数组所占的总字节数应按照double类型来计算。 | **示例:** @@ -1764,20 +1764,20 @@ readException(): void let reply = rpc.MessageParcel.create(); data.writeInt(1); data.writeString("hello"); - proxy.sendRequest(1, data, reply, option) + proxy.sendRequestAsync(1, data, reply, option) .then(function(errCode) { if (errCode === 0) { - console.log("sendRequest got result"); + console.log("sendRequestAsync got result"); reply.readException(); let msg = reply.readString(); console.log("RPCTest: reply msg: " + msg); } else { - console.log("RPCTest: sendRequest failed, errCode: " + errCode); + console.log("RPCTest: sendRequestAsync failed, errCode: " + errCode); } }).catch(function(e) { - console.log("RPCTest: sendRequest got exception: " + e.message); + console.log("RPCTest: sendRequestAsync got exception: " + e.message); }).finally (() => { - console.log("RPCTest: sendRequest ends, reclaim parcel"); + console.log("RPCTest: sendRequestAsync ends, reclaim parcel"); data.reclaim(); reply.reclaim(); }); @@ -2504,7 +2504,7 @@ queryLocalInterface(descriptor: string): IRemoteBroker ### sendRequest(deprecated) > **说明:** -> 从 API Version 8 开始废弃,建议使用[sendRequest8+](#sendrequest8)替代。 +> 从 API Version 8 开始废弃,建议使用[sendRequestAsync9+](#sendrequestasync9)替代。 sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): boolean @@ -2526,7 +2526,10 @@ sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options | boolean | 返回一个布尔值,true表示成功,false表示失败。| -### sendRequest8+ +### sendRequest8+(deprecated) + +> **说明:** +> 从 API Version 9 开始废弃,建议使用[sendRequestAsync9+](#sendrequestasync9)替代。 sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise<SendRequestResult> @@ -2534,6 +2537,27 @@ sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options **系统能力**:SystemCapability.Communication.IPC.Core +**参数:** + | 参数名 | 类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | data | [MessageParcel](#messageparcel) | 是 | 保存待发送数据的 MessageParcel对象。 | + | reply | [MessageParcel](#messageparcel) | 是 | 接收应答数据的MessageParcel对象。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + +**返回值:** + | 类型 | 说明 | + | -------- | -------- | + | Promise<SendRequestResult> | 返回一个期约,兑现值是sendRequestResult实例。| + +### sendRequestAsync9+ + +sendRequestAsync(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise<SendRequestResult> + +以同步或异步方式向对端进程发送MessageParcel消息。如果为选项设置了异步模式,则期约立即兑现,reply报文里没有内容。如果为选项设置了同步模式,则期约将在sendRequestAsync返回时兑现,回复内容在reply报文里。 + +**系统能力**:SystemCapability.Communication.IPC.Core + **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | @@ -2653,7 +2677,7 @@ isObjectDead(): boolean ### sendRequest(deprecated) > **说明:** -> 从 API Version 8 开始废弃,建议使用[sendRequest8+](#sendrequest8-2)替代。 +> 从 API Version 8 开始废弃,建议使用[sendRequestAsync9+](#sendrequestasync9-1)替代。 sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): boolean @@ -2715,7 +2739,10 @@ sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options reply.reclaim(); ``` -### sendRequest8+ +### sendRequest8+(deprecated) + +> **说明:** +> 从 API Version 9 开始废弃,建议使用[sendRequestAsync9+](#sendrequestasync9-1)替代。 sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise<SendRequestResult> @@ -2782,6 +2809,72 @@ sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options }); ``` +### sendRequestAsync9+ + +sendRequestAsync(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise<SendRequestResult> + +以同步或异步方式向对端进程发送MessageParcel消息。如果为选项设置了异步模式,则期约立即兑现,reply报文里没有内容。如果为选项设置了同步模式,则期约将在sendRequestAsync返回时兑现,回复内容在reply报文里。 + +**系统能力**:SystemCapability.Communication.IPC.Core + +**参数:** + | 参数名 | 类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | data | [MessageParcel](#messageparcel) | 是 | 保存待发送数据的 MessageParcel对象。 | + | reply | [MessageParcel](#messageparcel) | 是 | 接收应答数据的MessageParcel对象。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + +**返回值:** + | 类型 | 说明 | + | -------- | -------- | + | Promise<SendRequestResult> | 返回一个期约,兑现值是sendRequestResult实例。| + +**示例:** + + ``` + import FA from "@ohos.ability.featureAbility"; + let proxy; + let connect = { + onConnect: function(elementName, remoteProxy) { + console.log("RpcClient: js onConnect called."); + proxy = remoteProxy; + }, + onDisconnect: function(elementName) { + console.log("RpcClient: onDisconnect"); + }, + onFailed: function() { + console.log("RpcClient: onFailed"); + } + }; + let want = { + "bundleName": "com.ohos.server", + "abilityName": "com.ohos.server.MainAbility", + }; + FA.connectAbility(want, connect); + let option = new rpc.MessageOption(); + let data = rpc.MessageParcel.create(); + let reply = rpc.MessageParcel.create(); + data.writeInt(1); + data.writeString("hello"); + proxy.sendRequestAsync(1, data, reply, option) + .then(function(result) { + if (result.errCode === 0) { + console.log("sendRequestAsync got result"); + result.reply.readException(); + let msg = result.reply.readString(); + console.log("RPCTest: reply msg: " + msg); + } else { + console.log("RPCTest: sendRequestAsync failed, errCode: " + result.errCode); + } + }).catch(function(e) { + console.log("RPCTest: sendRequestAsync got exception: " + e.message); + }).finally (() => { + console.log("RPCTest: sendRequestAsync ends, reclaim parcel"); + data.reclaim(); + reply.reclaim(); + }); + ``` ### sendRequest8+ @@ -3082,7 +3175,7 @@ isObjectDead(): boolean | -------- | -------- | -------- | | TF_SYNC | 0 | 同步调用。 | | TF_ASYNC | 1 | 异步调用。 | -| TF_ACCEPT_FDS | 0x10 | 指示[sendRequest](#sendrequest8)接口可以返回文件描述符。 | +| TF_ACCEPT_FDS | 0x10 | 指示[sendRequestAsync](#sendrequestasync9)接口可以返回文件描述符。 | | TF_WAIT_TIME | 8 | 等待时间。单位秒。 | @@ -3471,7 +3564,7 @@ RemoteObject构造函数。 ### sendRequest(deprecated) > **说明:** -> 从 API Version 8 开始废弃,建议使用[sendRequest8+](#sendrequest8-4)替代。 +> 从 API Version 8 开始废弃,建议使用[sendRequestAsync9+](#sendrequestasync9-2)替代。 sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): boolean @@ -3535,7 +3628,10 @@ sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options ``` -### sendRequest8+ +### sendRequest8+(deprecated) + +> **说明:** +> 从 API Version 9 开始废弃,建议使用[sendRequestAsync9+](#sendrequestasync9-2)替代。 sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise<SendRequestResult> @@ -3604,6 +3700,73 @@ sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options }); ``` +### sendRequestAsync9+ + +sendRequestAsync(code : number, data : MessageParcel, reply : MessageParcel, options : MessageOption): Promise<SendRequestResult> + +以同步或异步方式向对端进程发送MessageParcel消息。如果为选项设置了异步模式,则期约立即兑现,reply报文里没有内容。如果为选项设置了同步模式,则期约将在sendRequestAsync返回时兑现,回复内容在reply报文里。 + +**系统能力**:SystemCapability.Communication.IPC.Core + +**参数:** + | 参数名 | 类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | data | [MessageParcel](#messageparcel) | 是 | 保存待发送数据的 MessageParcel对象。 | + | reply | [MessageParcel](#messageparcel) | 是 | 接收应答数据的MessageParcel对象。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + +**返回值:** + | 类型 | 说明 | + | -------- | -------- | + | Promise<SendRequestResult> | 返回一个期约,兑现值是sendRequestResult实例。| + +**示例:** + + ``` + class MyDeathRecipient { + onRemoteDied() { + console.log("server died"); + } + } + class TestRemoteObject extends rpc.RemoteObject { + constructor(descriptor) { + super(descriptor); + } + addDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean { + return true; + } + removeDeathRecipient(recipient: MyDeathRecipient, flags: number): boolean { + return true; + } + isObjectDead(): boolean { + return false; + } + } + let testRemoteObject = new TestRemoteObject("testObject"); + let option = new rpc.MessageOption(); + let data = rpc.MessageParcel.create(); + let reply = rpc.MessageParcel.create(); + data.writeInt(1); + data.writeString("hello"); + testRemoteObject.sendRequestAsync(1, data, reply, option) + .then(function(result) { + if (result.errCode === 0) { + console.log("sendRequestAsync got result"); + result.reply.readException(); + let msg = result.reply.readString(); + console.log("RPCTest: reply msg: " + msg); + } else { + console.log("RPCTest: sendRequestAsync failed, errCode: " + result.errCode); + } + }).catch(function(e) { + console.log("RPCTest: sendRequestAsync got exception: " + e.message); + }).finally (() => { + console.log("RPCTest: sendRequestAsync ends, reclaim parcel"); + data.reclaim(); + reply.reclaim(); + }); + ``` ### sendRequest8+ @@ -3672,7 +3835,7 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me onRemoteRequest(code : number, data : MessageParcel, reply: MessageParcel, options : MessageOption): boolean -sendRequest请求的响应处理函数,服务端在该函数里处理请求,回复结果。 +sendRequestAsync请求的响应处理函数,服务端在该函数里处理请求,回复结果。 **系统能力**:SystemCapability.Communication.IPC.Core diff --git a/zh-cn/application-dev/reference/apis/js-apis-screen.md b/zh-cn/application-dev/reference/apis/js-apis-screen.md index 714cfacfe0b4214c68d8d7f739f2fecb3d6f23bd..9472f9f6d445586231e7bbb44ec1c87b1cc1dc52 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-screen.md +++ b/zh-cn/application-dev/reference/apis/js-apis-screen.md @@ -223,6 +223,8 @@ createVirtualScreen(options:VirtualScreenOption, callback: AsyncCallback<Scre **系统能力:** SystemCapability.WindowManager.WindowManager.Core +**需要权限**:ohos.permission.CAPTURE_SCREEN,如果VirtualScreenOption.surfaceId有效,此权限是必需的。仅系统应用可用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -256,6 +258,8 @@ createVirtualScreen(options:VirtualScreenOption): Promise<Screen> **系统能力:** SystemCapability.WindowManager.WindowManager.Core +**需要权限**:ohos.permission.CAPTURE_SCREEN,如果VirtualScreenOption.surfaceId有效,此权限是必需的。仅系统应用可用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | | ------- | ------------------------------------------- | ---- | ------------------------ | @@ -343,6 +347,8 @@ setVirtualScreenSurface(screenId:number, surfaceId: string, callback: AsyncCallb **系统能力:** SystemCapability.WindowManager.WindowManager.Core +**需要权限**:ohos.permission.CAPTURE_SCREEN,仅系统应用可用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -372,6 +378,8 @@ setVirtualScreenSurface(screenId:number, surfaceId: string): Promise<void> **系统能力:** SystemCapability.WindowManager.WindowManager.Core +**需要权限**:ohos.permission.CAPTURE_SCREEN,仅系统应用可用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | ------------- | @@ -696,9 +704,6 @@ promise.then((data) => { | HORIZONTAL | 2 | 表示指定屏幕为水平方向。 | | REVERSE_VERTICAL | 3 | 表示指定屏幕为反向垂直方向。 | | REVERSE_HORIZONTAL | 4 | 表示指定屏幕为反向水平方向。 | -| SENSOR | 5 | 表示屏幕方向跟随传感器方向。 | -| SENSOR_VERTICAL | 6 | 表示屏幕方向垂直跟随传感器方向。 | -| SENSOR_HORIZONTAL | 7 | 表示屏幕方向水平跟随传感器方向。 | ## ScreenModeInfo 屏幕显示模式信息。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-service-extension-context.md b/zh-cn/application-dev/reference/apis/js-apis-service-extension-context.md index a7df410fcbcd25868c4b0fbb216e7d8916ff7790..8588e9c796974d98ff51c0ce1278b32b15b777c2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-service-extension-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-service-extension-context.md @@ -210,6 +210,12 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): | accountId | number | 是 | 需要启动的accountId。 | | options | [StartOptions](js-apis-application-StartOptions.md) | 否 | 启动Ability所携带的参数。 | +**返回值:** + + | 类型 | 说明 | + | -------- | -------- | + | Promise<void> | 返回一个Promise,包含接口的结果。 | + **示例:** ```js @@ -277,6 +283,12 @@ startServiceExtensionAbility(want: Want): Promise\; | -------- | -------- | -------- | -------- | | want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +**返回值:** + + | 类型 | 说明 | + | -------- | -------- | + | Promise<void> | 返回一个Promise,包含接口的结果。 | + **示例:** ```js @@ -347,6 +359,12 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\ | want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | | accountId | number | 是 | 需要启动的accountId。 | +**返回值:** + + | 类型 | 说明 | + | -------- | -------- | + | Promise<void> | 返回一个Promise,包含接口的结果。 | + **示例:** ```js @@ -379,8 +397,8 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | -| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | +| want | [Want](js-apis-application-Want.md) | 是 | 停止Ability的want信息。 | +| callback | AsyncCallback\ | 是 | 停止Ability的回调函数。 | **示例:** @@ -409,7 +427,13 @@ stopServiceExtensionAbility(want: Want): Promise\; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | +| want | [Want](js-apis-application-Want.md) | 是 | 停止Ability的want信息。 | + +**返回值:** + + | 类型 | 说明 | + | -------- | -------- | + | Promise<void> | 返回一个Promise,包含接口的结果。 | **示例:** @@ -444,9 +468,9 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | -| accountId | number | 是 | 需要启动的accountId。 | -| callback | AsyncCallback\ | 是 | 启动Ability的回调函数。 | +| want | [Want](js-apis-application-Want.md) | 是 | 停止Ability的want信息。 | +| accountId | number | 是 | 需要停止的accountId。 | +| callback | AsyncCallback\ | 是 | 停止Ability的回调函数。 | **示例:** @@ -478,8 +502,14 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\< | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| want | [Want](js-apis-application-Want.md) | 是 | 启动Ability的want信息。 | -| accountId | number | 是 | 需要启动的accountId。 | +| want | [Want](js-apis-application-Want.md) | 是 | 停止Ability的want信息。 | +| accountId | number | 是 | 需要停止的accountId。 | + +**返回值:** + + | 类型 | 说明 | + | -------- | -------- | + | Promise<void> | 返回一个Promise,包含接口的结果。 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-time.md b/zh-cn/application-dev/reference/apis/js-apis-system-time.md index 40e5f6498283fd9625f251508de80b7e2b0d8faa..47ced8209ebc0e4508c4f56535041cc9d3004baa 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-time.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-time.md @@ -3,8 +3,8 @@ 本模块主要由时间、时区和定时三大功能组成。其中,定时服务用来管理和使用时间、时区。开发者可以通过对系统进行设置、获取等操作管理系统时间、时区,也可以通过定时功能实现定时服务如闹钟服务等。 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 - +>- 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +>- 本模块接口为系统接口,三方应用不支持调用。 ## 导入模块 @@ -22,7 +22,7 @@ setTime(time : number, callback : AsyncCallback<void>) : void **需要权限:** ohos.permission.SET_TIME -**系统能力:** SystemCapability.Miscservices.Time +**系统能力:** SystemCapability.MiscServices.Time **参数:** @@ -201,7 +201,7 @@ getRealActiveTime(isNano?: boolean): Promise<number> ## systemTime.getRealTime8+ -getRealTime(callback: AsyncCallback<number>): void +getRealTime(isNano?: boolean, callback: AsyncCallback<number>): void 获取自系统启动以来经过的时间,包括深度睡眠时间,使用callback形式返回结果。 @@ -229,7 +229,7 @@ getRealTime(callback: AsyncCallback<number>): void ## systemTime.getRealTime8+ -getRealTime(): Promise<number> +getRealTime(isNano?: boolean): Promise<number> 获取自系统启动以来经过的时间,包括深度睡眠时间,使用Promise形式返回结果。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-timer.md b/zh-cn/application-dev/reference/apis/js-apis-system-timer.md new file mode 100644 index 0000000000000000000000000000000000000000..6f16a4b45aa4c92ac1e5a3d3b617ccfa0def1799 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-system-timer.md @@ -0,0 +1,287 @@ +# 设置系统时间 + +本模块主要由时间、时区和定时三大功能组成。其中,定时服务用来管理和使用时间、时区。开发者可以通过对系统进行设置、获取等操作管理系统时间、时区,也可以通过定时功能实现定时服务如闹钟服务等。 + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +>- 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +>- 本模块接口为系统接口,三方应用不支持调用。 + +## 导入模块 + + +``` +import systemTimer from '@ohos.systemTimer'; +``` + + +## systemTime.createTimer + +createTimer(options: TimerOptions, callback: AsyncCallback<number>): void + +创建定时器。 + +**系统能力:** SystemCapability.MiscServices.Time + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------| ---- | --------------------------------------------------------------------------------------- | +| options | TimerOptions | 是 | const TIMER_TYPE_REALTIME: 设置为系统启动时间定时器,否则为walltime定时器;
const TIMER_TYPE_WAKEUP: 设置为唤醒定时器,否则为非唤醒;
const TIMER_TYPE_EXACT: 设置为精准定时器,否则为非精准定时器;
const TIMER_TYPE_IDLE: number: 设置为IDLE模式定时器,否则为非IDLE模式定时器(暂不支持) | +| repeat | boolean | 是 | true 为循环定时器,false为单次定时器。 | +| interval | number | 否 | 如果是循环定时器,repeat值应大于5000毫秒,非重复定时器置为0。 | +| wantAgent| wantAgent | 否 | 设置通知的wantagent,定时器到期后通知。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------- | ------------------------------------------------------------ | +| syncCallback<number>| 以回调函数的形式返回定时器的ID。 | + +**示例:** + + ```js + var options = TimerOptions { + type:TIMER_TYPE_REALTIME, + repeat:false + } + systemTime.createTimer(options, (error, data) => { + if (error) { + console.error(`failed to systemTime.createTimer ` + JSON.stringify(error)); + return; + } + console.log(`systemTime.createTimer success data : ` + JSON.stringify(data)); + }); + ``` + + +## systemTime.createTimer + +createTimer(options: TimerOptions): Promise<number> + +创建定时器。 + +**系统能力:** SystemCapability.MiscServices.Time + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------| ---- | --------------------------------------------------------------------------------------- | +| options | TimerOptions | 是 | const TIMER_TYPE_REALTIME: 设置为系统启动时间定时器,否则为walltime定时器;
const TIMER_TYPE_WAKEUP: 设置为唤醒定时器,否则为非唤醒;
const TIMER_TYPE_EXACT: 设置为精准定时器,否则为非精准定时器;
const TIMER_TYPE_IDLE: number: 设置为IDLE模式定时器,否则为非IDLE模式定时器(暂不支持) | +| repeat | boolean | 是 | true 为循环定时器,false为单次定时器。 | +| interval | number | 否 | 如果是循环定时器,repeat值应大于5000毫秒,非重复定时器置为0。 | +| wantAgent| wantAgent | 否 | 设置通知的wantagent,定时器到期后通知。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------- | ------------------------------------------------------------ | +| Promise<number> | 以Promise形式返回定时器的ID。 | + +**示例:** + + ```js + var options = TimerOptions { + type:TIMER_TYPE_REALTIME, + repeat:false + } + systemTime.createTimer(options).then((data) => { + console.log(`systemTime.createTimer success data : ` + JSON.stringify(data)); + }).catch((error) => { + console.error(`failed to systemTime.createTimer because ` + JSON.stringify(error)); + }); + ``` + + +## systemTime.startTimer + +startTimer(timer: number, triggerTime: number, callback: AsyncCallback<void>): void + +开始定时器。 + +**系统能力:** SystemCapability.MiscServices.Time + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | --------------------------- | ---- | ------------------------------------------------------------ | +| timer | number | 是 | 定时器的ID。 | +| triggerTime | number | 是 | 定时器的触发时间,单位:毫秒。 | + + +**示例:** + + ```js + var options = TimerOptions { + type:TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = systemTimer.Timer(options) + systemTime.startTimer(timerId, 10000, (error, data) => { + if (error) { + console.error(`failed to systemTime.startTimer ` + JSON.stringify(error)); + return; + } + console.log(`systemTime.startTimer success data : ` + JSON.stringify(data)); + }); + ``` + +## systemTime.startTimer + +startTimer(timer: number, triggerTime: number): Promise<void> + +开始定时器。 + +**系统能力:** SystemCapability.MiscServices.Time + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | --------------------------- | ---- | ------------------------------------------------------------ | +| timer | number | 是 | 定时器的ID。 +| triggerTime | number | 是 | 定时器的触发时间,单位:毫秒。 | + + +**示例:** + + ```js + var options = TimerOptions { + type:TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = systemTimer.Timer(options) + systemTime.startTimer(timerId, 10000).then((data) => { + console.log(`systemTime.startTimer success data : ` + JSON.stringify(data)); + }).catch((error) => { + console.error(`failed to systemTime.startTimer because ` + JSON.stringify(error)); + }); + ``` + + +## systemTime.stopTimer + +stopTimer(timer: number, callback: AsyncCallback<void>): void + +停止定时器。 + +**系统能力:** SystemCapability.MiscServices.Time + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------- | ---- | ------------------------------------------------------------ | +| timer | number | 是 | 定时器的ID。 | + +**示例:** + + ```js + var options = TimerOptions { + type:TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = systemTimer.Timer(options) + let startTimerRes = systemTimer.startTimer(timerId, 100000) + systemTime.stopTimer(timerId, (error, data) => { + if (error) { + console.error(`failed to systemTime.stopTimer ` + JSON.stringify(error)); + return; + } + console.log(`systemTime.stopTimer success data : ` + JSON.stringify(data)); + }); + ``` + + +## systemTime.stopTimer + +stopTimer(timer: number): Promise<void> + +停止定时器。 + +**系统能力:** SystemCapability.MiscServices.Time + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | ------------------------------------------------------------ | +| timer | number | 是 | 定时器的ID。 | + +**示例:** + + ```js + var options = TimerOptions { + type:TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = systemTimer.Timer(options) + let startTimerRes = systemTimer.startTimer(timerId, 100000) + systemTime.stopTimer(timerId).then((data) => { + console.log(`systemTime.stopTimer success data : ` + JSON.stringify(data)); + }).catch((error) => { + console.error(`failed to systemTime.stopTimer because ` + JSON.stringify(error)); + }); + ``` + + +## systemTime.destroyTimer + +destroyTimer(timer: number, callback: AsyncCallback<void>): void + +销毁定时器。 + +**系统能力:** SystemCapability.MiscServices.Time + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------- | ---- | ------------------------------------------------------------ | +| timer | number | 是 | 定时器的ID。 | + +**示例:** + + ```js + var options = TimerOptions { + type:TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = systemTimer.Timer(options) + let startTimerRes = systemTimer.startTimer(timerId, 100000) + let stopTimerRes = systemTimer.stopTimer(timerId) + systemTime.destroyTimer(timerId, (error, data) => { + if (error) { + console.error(`failed to systemTime.destroyTimer ` + JSON.stringify(error)); + return; + } + console.log(`systemTime.destroyTimer success data : ` + JSON.stringify(data)); + }); + ``` + + +## systemTime.destroyTimer + +destroyTimer(timer: number): Promise<void> + +销毁定时器。 + +**系统能力:** SystemCapability.MiscServices.Time + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | ------------------------------------------------------------ | +| timer | number | 是 | 定时器的ID。 | + +**示例:** + + ```js + var options = TimerOptions { + type:TIMER_TYPE_REALTIME, + repeat:false + } + let timerId = systemTimer.Timer(options) + let startTimerRes = systemTimer.startTimer(timerId, 100000) + let stopTimerRes = systemTimer.stopTimer(timerId) + systemTime.destroyTimer(timerId).then((data) => { + console.log(`systemTime.destroyTimer success data : ` + JSON.stringify(data)); + }).catch((error) => { + console.error(`failed to systemTime.destroyTimer because ` + JSON.stringify(error)); + }); + ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md b/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md index 06786292b2191a13172f00181d9047d86ed64153..a8a2ef957fda55a51383f73127df8edb805ba0b7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md +++ b/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md @@ -1,5 +1,7 @@ # 壁纸 +壁纸管理服务是OpenHarmony中系统服务,是主题框架的部分组成,主要为系统提供壁纸管理服务能力,支持系统显示、设置、切换壁纸等功能。 + > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-wifi.md b/zh-cn/application-dev/reference/apis/js-apis-wifi.md index 1e1b0112344c5ef4c9b18dc62e292ea1d48413f9..36ca5c551e9b39b493de56f16df955595ea9a687 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-wifi.md +++ b/zh-cn/application-dev/reference/apis/js-apis-wifi.md @@ -162,14 +162,14 @@ WLAN热点信息。 | ssid | string | 只读 | 热点的SSID,编码格式为UTF-8。 | | bssid | string | 只读 | 热点的BSSID。 | | capabilities | string | 只读 | 热点能力。 | -| securityType | [WifiSecurityType](#WifiSecurityType) | 只读 | WLAN加密类型。 | +| securityType | [WifiSecurityType](#wifisecuritytype) | 只读 | WLAN加密类型。 | | rssi | number | 只读 | 热点的信号强度(dBm)。 | | band | number | 只读 | WLAN接入点的频段。 | | frequency | number | 只读 | WLAN接入点的频率。 | | channelWidth | number | 只读 | WLAN接入点的带宽。 | | centerFrequency09+ | number | 只读 | 中心频点。 | | centerFrequency19+ | number | 只读 | 中心频点。 | -| infoElems9+ | Array<[WifiInfoElem](#WifiInfoElem)> | 只读 | 信息元素。 | +| infoElems9+ | Array<[WifiInfoElem](#wifiinfoelem9)> | 只读 | 信息元素。 | | timestamp | number | 只读 | 时间戳。 | @@ -251,7 +251,7 @@ addDeviceConfig(config: WifiDeviceConfig): Promise<number> **参数:** | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | 是 | WLAN配置信息。 | + | config | [WifiDeviceConfig](#wifideviceconfig) | 是 | WLAN配置信息。 | **返回值:** | **类型** | **说明** | @@ -270,15 +270,15 @@ WLAN配置信息。 | bssid | string | 只读 | 热点的BSSID。 | | preSharedKey | string | 只读 | 热点的密钥。 | | isHiddenSsid | boolean | 只读 | 是否是隐藏网络。 | -| securityType | [WifiSecurityType](#WifiSecurityType) | 只读 | 加密类型。 | +| securityType | [WifiSecurityType](#wifisecuritytype) | 只读 | 加密类型。 | | creatorUid | number | 只读 | 创建用户的ID,仅系统应用可用。 | | disableReason | number | 只读 | 禁用原因,仅系统应用可用。 | | netId | number | 只读 | 分配的网络ID, 仅系统应用可用。 | | randomMacType | number | 只读 | 随机MAC类型,仅系统应用可用。 | | randomMacAddr | string | 只读 | 随机MAC地址,仅系统应用可用。 | -| ipType | [IpType](#IpType) | 只读 | IP地址类型,仅系统应用可用。 | -| staticIp | [IpConfig](#IpConfig) | 只读 | 静态IP配置信息,仅系统应用可用。 | -| eapConfig9+ | [WifiEapConfig](#WifiEapConfig) | 只读 | 可扩展身份验证协议配置,仅系统应用可用。 | +| ipType | [IpType](#iptype7) | 只读 | IP地址类型,仅系统应用可用。 | +| staticIp | [IpConfig](#ipconfig7) | 只读 | 静态IP配置信息,仅系统应用可用。 | +| eapConfig9+ | [WifiEapConfig](#wifieapconfig9) | 只读 | 可扩展身份验证协议配置,仅系统应用可用。 | ## IpType7+ @@ -316,8 +316,8 @@ IP配置信息。 | **参数名** | **类型** | **读写属性** | **说明** | | -------- | -------- | -------- | -------- | -| eapMethod | [EapMethod](#EapMethod) | 只读 | EAP认证方式。 | -| phase2Method | [Phase2Method](#Phase2Method) | 只读 | 第二阶段认证方式。 | +| eapMethod | [EapMethod](#eapmethod9) | 只读 | EAP认证方式。 | +| phase2Method | [Phase2Method](#phase2method9) | 只读 | 第二阶段认证方式。 | | identity | string | 只读 | 身份信息。 | | anonymousIdentity | string | 只读 | 匿名身份。 | | password | string | 只读 | 密码。 | @@ -382,7 +382,7 @@ addDeviceConfig(config: WifiDeviceConfig, callback: AsyncCallback<number>) **参数:** | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | 是 | WLAN配置信息。 | + | config | [WifiDeviceConfig](#wifideviceconfig) | 是 | WLAN配置信息。 | | callback | AsyncCallback<number> | 是 | 回调函数。当操作成功时,err为0,data为添加的网络配置ID,如果data值为-1,表示添加失败。当error为非0,表示处理出现错误。 | @@ -399,7 +399,7 @@ addUntrustedConfig(config: WifiDeviceConfig): Promise<boolean> **参数:** | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | 是 | WLAN配置信息。 | + | config | [WifiDeviceConfig](#wifideviceconfig) | 是 | WLAN配置信息。 | **返回值:** | **类型** | **说明** | @@ -420,7 +420,7 @@ addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boolean& **参数:** | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | 是 | WLAN配置信息。 | + | config | [WifiDeviceConfig](#wifideviceconfig) | 是 | WLAN配置信息。 | | callback | AsyncCallback<boolean> | 是 | 回调函数。当操作成功时,err为0,data表示操作结果,true: 成功, false: 失败。如果error为非0,表示处理出现错误。 | @@ -437,7 +437,7 @@ removeUntrustedConfig(config: WifiDeviceConfig): Promise<boolean> **参数:** | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | 是 | WLAN配置信息。 | + | config | [WifiDeviceConfig](#wifideviceconfig) | 是 | WLAN配置信息。 | **返回值:** | **类型** | **说明** | @@ -458,7 +458,7 @@ removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback<boole **参数:** | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | 是 | WLAN配置信息。 | + | config | [WifiDeviceConfig](#wifideviceconfig) | 是 | WLAN配置信息。 | | callback | AsyncCallback<boolean> | 是 | 回调函数。当操作成功时,err为0,data表示操作结果,true: 成功, false: 失败。如果error为非0,表示处理出现错误。 | @@ -475,7 +475,7 @@ addCandidateConfig(config: WifiDeviceConfig): Promise<number> **参数:** | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | 是 | WLAN配置信息。 | + | config | [WifiDeviceConfig](#wifideviceconfig) | 是 | WLAN配置信息。 | **返回值:** | **类型** | **说明** | @@ -496,7 +496,7 @@ addCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback<number&g **参数:** | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | 是 | WLAN配置信息。 | + | config | [WifiDeviceConfig](#wifideviceconfig) | 是 | WLAN配置信息。 | | callback | AsyncCallback<number> | 是 | 回调函数。当操作成功时,err为0,data为添加的网络配置ID,如果data值为-1,表示添加失败。如果操作出现错误,err为非0值。 | @@ -513,7 +513,7 @@ removeCandidateConfig(config: WifiDeviceConfig): Promise<boolean> **参数:** | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | 是 | WLAN配置信息。 | + | config | [WifiDeviceConfig](#wifideviceconfig) | 是 | WLAN配置信息。 | **返回值:** | **类型** | **说明** | @@ -534,13 +534,13 @@ removeCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback<boole **参数:** | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | 是 | WLAN配置信息。 | + | config | [WifiDeviceConfig](#wifideviceconfig) | 是 | WLAN配置信息。 | | callback | AsyncCallback<void> | 是 | 回调函数。当操作成功时,err为0,data表示操作结果,true: 成功, false: 失败。如果error为非0,表示处理出现错误。 | ## wifi.getCandidateConfigs9+ -getCandidateConfigs():  Array<[WifiDeviceConfig](#WifiDeviceConfig)> +getCandidateConfigs():  Array<[WifiDeviceConfig](#wifideviceconfig)> 获取候选网络配置。 @@ -551,7 +551,7 @@ getCandidateConfigs():  Array<[WifiDeviceConfig](#WifiDeviceConfig)> **返回值:** | **类型** | **说明** | | -------- | -------- | - |  Array<[WifiDeviceConfig](#WifiDeviceConfig)> | 候选网络配置数组。 | + |  Array<[WifiDeviceConfig](#wifideviceconfig)> | 候选网络配置数组。 | ## wifi.connectToCandidateConfig9+ @@ -613,7 +613,7 @@ connectToDevice(config: WifiDeviceConfig): boolean **参数:** | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | 是 | WLAN配置信息。 | + | config | [WifiDeviceConfig](#wifideviceconfig) | 是 | WLAN配置信息。 | **返回值:** | **类型** | **说明** | @@ -675,7 +675,7 @@ getLinkedInfo(): Promise<WifiLinkedInfo> **返回值:** | 类型 | 说明 | | -------- | -------- | - | Promise<[WifiLinkedInfo](#WifiLinkedInfo)> | Promise对象。表示WLAN连接信息。 | + | Promise<[WifiLinkedInfo](#wifilinkedinfo)> | Promise对象。表示WLAN连接信息。 | ## wifi.getLinkedInfo @@ -691,7 +691,7 @@ getLinkedInfo(callback: AsyncCallback<WifiLinkedInfo>): void **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[WifiLinkedInfo](#WifiLinkedInfo)> | 是 | 回调函数。当获取成功时,err为0,data表示WLAN连接信息。如果error为非0,表示处理出现错误。 | + | callback | AsyncCallback<[WifiLinkedInfo](#wifilinkedinfo)> | 是 | 回调函数。当获取成功时,err为0,data表示WLAN连接信息。如果error为非0,表示处理出现错误。 | **示例:** ```js @@ -735,8 +735,8 @@ getLinkedInfo(callback: AsyncCallback<WifiLinkedInfo>): void | macType9+ | number | 只读 | MAC地址类型。 | | macAddress | string | 只读 | 设备的MAC地址。 | | ipAddress | number | 只读 | WLAN连接的IP地址。 | -| suppState | [SuppState](#SuppState) | 只读 | 请求状态,仅系统应用可用。| -| connState | [ConnState](#ConnState) | 只读 | WLAN连接状态。 | +| suppState | [SuppState](#suppstate) | 只读 | 请求状态,仅系统应用可用。| +| connState | [ConnState](#connstate) | 只读 | WLAN连接状态。 | ## ConnState @@ -879,7 +879,7 @@ getIpInfo(): IpInfo **返回值:** | **类型** | **说明** | | -------- | -------- | - | [IpInfo](#IpInfo) | IP信息。 | + | [IpInfo](#ipinfo7) | IP信息。 | ## IpInfo7+ @@ -951,7 +951,7 @@ reconnect(): boolean ## wifi.getDeviceConfigs7+ -getDeviceConfigs():  Array<[WifiDeviceConfig](#WifiDeviceConfig)> +getDeviceConfigs():  Array<[WifiDeviceConfig](#wifideviceconfig)> 获取网络配置。 此接口为系统接口。 @@ -963,7 +963,7 @@ getDeviceConfigs():  Array<[WifiDeviceConfig](#WifiDeviceConfig)> **返回值:** | **类型** | **说明** | | -------- | -------- | - |  Array<[WifiDeviceConfig](#WifiDeviceConfig)> | 网络配置信息的数组。 | + |  Array<[WifiDeviceConfig](#wifideviceconfig)> | 网络配置信息的数组。 | ## wifi.updateNetwork7+ @@ -980,7 +980,7 @@ updateNetwork(config: WifiDeviceConfig): boolean **参数:** | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | - | config | [WifiDeviceConfig](#WifiDeviceConfig) | 是 | WLAN配置信息。 | + | config | [WifiDeviceConfig](#wifideviceconfig) | 是 | WLAN配置信息。 | **返回值:** | **类型** | **说明** | @@ -1131,7 +1131,7 @@ setHotspotConfig(config: HotspotConfig): boolean **参数:** | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | - | config | [HotspotConfig](#HotspotConfig) | 是 | 热点配置信息。 | + | config | [HotspotConfig](#hotspotconfig7) | 是 | 热点配置信息。 | **返回值:** | **类型** | **说明** | @@ -1148,7 +1148,7 @@ setHotspotConfig(config: HotspotConfig): boolean | **参数名** | **类型** | **读写属性** | **说明** | | -------- | -------- | -------- | -------- | | ssid | string | 只读 | 热点的SSID,编码格式为UTF-8。 | -| securityType | [WifiSecurityType](#WifiSecurityType) | 只读 | 加密类型。 | +| securityType | [WifiSecurityType](#wifisecuritytype) | 只读 | 加密类型。 | | band | number | 只读 | 热点的带宽。1: 2.4G, 2: 5G, 3: 双模频段 | | preSharedKey | string | 只读 | 热点的密钥。 | | maxConn | number | 只读 | 最大设备连接数。 | @@ -1168,12 +1168,12 @@ getHotspotConfig(): HotspotConfig **返回值:** | **类型** | **说明** | | -------- | -------- | - | [HotspotConfig](#HotspotConfig) | 热点的配置信息。 | + | [HotspotConfig](#hotspotconfig7) | 热点的配置信息。 | ## wifi.getStations7+ -getStations():  Array<[StationInfo](#StationInfo)> +getStations():  Array<[StationInfo](#stationinfo7)> 获取连接的设备。 此接口为系统接口。 @@ -1185,7 +1185,7 @@ getStations():  Array<[StationInfo](#StationInfo)> **返回值:** | **类型** | **说明** | | -------- | -------- | - |  Array<[StationInfo](#StationInfo)> | 连接的设备数组。 | + |  Array<[StationInfo](#stationinfo7)> | 连接的设备数组。 | ## StationInfo7+ @@ -1214,7 +1214,7 @@ getP2pLinkedInfo(): Promise<WifiP2pLinkedInfo> **返回值:** | 类型 | 说明 | | -------- | -------- | - | Promise<[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)> | Promise对象。表示P2P连接信息。 | + | Promise<[WifiP2pLinkedInfo](#wifip2plinkedinfo8)> | Promise对象。表示P2P连接信息。 | @@ -1226,7 +1226,7 @@ getP2pLinkedInfo(): Promise<WifiP2pLinkedInfo> | 参数名 | 类型 | 读写属性 | 说明 | | -------- | -------- | -------- | -------- | -| connectState | [P2pConnectState](#P2pConnectState) | 只读 | P2P连接状态。 | +| connectState | [P2pConnectState](#p2pconnectstate8) | 只读 | P2P连接状态。 | | isGroupOwner | boolean | 只读 | 是否是群主。 | | groupOwnerAddr | string | 只读 | 群组MAC地址。 @@ -1256,7 +1256,7 @@ getP2pLinkedInfo(callback: AsyncCallback<WifiP2pLinkedInfo>): void **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)> | 是 | 回调函数。当操作成功时,err为0,data表示P2P连接信息。如果error为非0,表示处理出现错误。 | + | callback | AsyncCallback<[WifiP2pLinkedInfo](#wifip2plinkedinfo8)> | 是 | 回调函数。当操作成功时,err为0,data表示P2P连接信息。如果error为非0,表示处理出现错误。 | ## wifi.getCurrentGroup8+ @@ -1272,7 +1272,7 @@ getCurrentGroup(): Promise<WifiP2pGroupInfo> **返回值:** | 类型 | 说明 | | -------- | -------- | - | Promise<[WifiP2pGroupInfo](#WifiP2pGroupInfo)> | Promise对象。表示当前组信息。 | + | Promise<[WifiP2pGroupInfo](#wifip2pgroupinfo8)> | Promise对象。表示当前组信息。 | ## wifi.getCurrentGroup8+ @@ -1288,7 +1288,7 @@ getCurrentGroup(callback: AsyncCallback<WifiP2pGroupInfo>): void **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[WifiP2pGroupInfo](#WifiP2pGroupInfo)> | 是 | 回调函数。当操作成功时,err为0,data表示当前组信息。如果error为非0,表示处理出现错误。 | + | callback | AsyncCallback<[WifiP2pGroupInfo](#wifip2pgroupinfo8)> | 是 | 回调函数。当操作成功时,err为0,data表示当前组信息。如果error为非0,表示处理出现错误。 | ## wifi.getP2pPeerDevices8+ @@ -1304,7 +1304,7 @@ getP2pPeerDevices(): Promise<WifiP2pDevice[]> **返回值:** | 类型 | 说明 | | -------- | -------- | - | Promise<[WifiP2pDevice[]](#WifiP2pDevice)> | Promise对象。表示对端设备列表信息。 | + | Promise<[WifiP2pDevice[]](#wifip2pdevice8)> | Promise对象。表示对端设备列表信息。 | ## wifi.getP2pPeerDevices8+ @@ -1320,7 +1320,7 @@ getP2pPeerDevices(callback: AsyncCallback<WifiP2pDevice[]>): void **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[WifiP2pDevice[]](#WifiP2pDevice)> | 是 | 回调函数。当操作成功时,err为0,data表示对端设备列表信息。如果error为非0,表示处理出现错误。 | + | callback | AsyncCallback<[WifiP2pDevice[]](#wifip2pdevice8)> | 是 | 回调函数。当操作成功时,err为0,data表示对端设备列表信息。如果error为非0,表示处理出现错误。 | ## WifiP2pDevice8+ @@ -1334,7 +1334,7 @@ getP2pPeerDevices(callback: AsyncCallback<WifiP2pDevice[]>): void | deviceName | string | 只读 | 设备名称。 | | deviceAddress | string | 只读 | 设备MAC地址。 | | primaryDeviceType | string | 只读 | 主设备类型。 | -| deviceStatus | [P2pDeviceStatus](#P2pDeviceStatus) | 只读 | 设备状态。 | +| deviceStatus | [P2pDeviceStatus](#p2pdevicestatus8) | 只读 | 设备状态。 | | groupCapabilitys | number | 只读 | 群组能力。 | @@ -1366,7 +1366,7 @@ getP2pLocalDevice(): Promise<WifiP2pDevice> **返回值:** | 类型 | 说明 | | -------- | -------- | - | Promise<[WifiP2pDevice](#WifiP2pDevice)> | Promise对象。表示本端设备信息。 | + | Promise<[WifiP2pDevice](#wifip2pdevice8)> | Promise对象。表示本端设备信息。 | ## wifi.getP2pLocalDevice9+ @@ -1382,7 +1382,7 @@ getP2pLocalDevice(callback: AsyncCallback<WifiP2pDevice>): void **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[WifiP2pDevice](#WifiP2pDevice)> | 是 | 回调函数。当操作成功时,err为0,data表示本端设备信息。如果error为非0,表示处理出现错误。 | + | callback | AsyncCallback<[WifiP2pDevice](#wifip2pdevice8)> | 是 | 回调函数。当操作成功时,err为0,data表示本端设备信息。如果error为非0,表示处理出现错误。 | ## wifi.createGroup8+ @@ -1399,7 +1399,7 @@ createGroup(config: WifiP2PConfig): boolean | **参数名** | **类型** | 必填 | **说明** | | -------- | -------- | -------- | -------- | - | config | [WifiP2PConfig](#WifiP2PConfig) | 是 | 群组配置信息。 | + | config | [WifiP2PConfig](#wifip2pconfig8) | 是 | 群组配置信息。 | **返回值:** | 类型 | 说明 | @@ -1419,7 +1419,7 @@ createGroup(config: WifiP2PConfig): boolean | netId | number | 只读 | 网络ID。创建群组时-1表示创建临时组,-2表示创建永久组。 | | passphrase | string | 只读 | 群组密钥。 | | groupName | string | 只读 | 群组名称。 | -| goBand | [GroupOwnerBand](#GroupOwnerBand) | 只读 | 群组带宽。 | +| goBand | [GroupOwnerBand](#groupownerband8) | 只读 | 群组带宽。 | ## GroupOwnerBand8+ @@ -1465,7 +1465,7 @@ p2pConnect(config: WifiP2PConfig): boolean | **参数名** | **类型** | 必填 | **说明** | | -------- | -------- | -------- | -------- | - | config | [WifiP2PConfig](#WifiP2PConfig) | 是 | 连接配置信息。 | + | config | [WifiP2PConfig](#wifip2pconfig8) | 是 | 连接配置信息。 | **返回值:** | 类型 | 说明 | @@ -1624,7 +1624,7 @@ getP2pGroups(): Promise<Array<WifiP2pGroupInfo>> **返回值:** | 类型 | 说明 | | -------- | -------- | - | Promise< Array<[WifiP2pGroupInfo](#WifiP2pGroupInfo)> > | Promise对象。表示所有群组信息。 | + | Promise< Array<[WifiP2pGroupInfo](#wifip2pgroupinfo8)> > | Promise对象。表示所有群组信息。 | ## WifiP2pGroupInfo8+ @@ -1636,13 +1636,13 @@ getP2pGroups(): Promise<Array<WifiP2pGroupInfo>> | 参数名 | 类型 | 读写属性 | 说明 | | -------- | -------- | -------- | -------- | | isP2pGo | boolean | 只读 | 是否是群主。 | -| ownerInfo | [WifiP2pDevice](#WifiP2pDevice) | 只读 | 群组的设备信息。 | +| ownerInfo | [WifiP2pDevice](#wifip2pdevice8) | 只读 | 群组的设备信息。 | | passphrase | string | 只读 | 群组密钥。 | | interface | string | 只读 | 接口名称。 | | groupName | string | 只读 | 群组名称。 | | networkId | number | 只读 | 网络ID。 | | frequency | number | 只读 | 群组的频率。 | -| clientDevices | [WifiP2pDevice[]](#WifiP2pDevice) | 只读 | 接入的设备列表信息。 | +| clientDevices | [WifiP2pDevice[]](#wifip2pdevice8) | 只读 | 接入的设备列表信息。 | | goIpAddress | string | 只读 | 群组IP地址。 | @@ -1659,7 +1659,7 @@ getP2pGroups(callback: AsyncCallback<Array<WifiP2pGroupInfo>>): void **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | callback | AsyncCallback< Array<[WifiP2pGroupInfo](#WifiP2pGroupInfo)>> | 是 | 回调函数。当操作成功时,err为0,data表示所有群组信息。如果error为非0,表示处理出现错误。 | + | callback | AsyncCallback< Array<[WifiP2pGroupInfo](#wifip2pgroupinfo8)>> | 是 | 回调函数。当操作成功时,err为0,data表示所有群组信息。如果error为非0,表示处理出现错误。 | ## wifi.setDeviceName8+ @@ -1961,7 +1961,7 @@ on(type: "p2pConnectionChange", callback: Callback<WifiP2pLinkedInfo>): vo | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | | type | string | 是 | 固定填"p2pConnectionChange"字符串。 | - | callback | Callback<[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)> | 是 | 状态改变回调函数。 | + | callback | Callback<[WifiP2pLinkedInfo](#wifip2plinkedinfo8)> | 是 | 状态改变回调函数。 | ## wifi.off('p2pConnectionChange')8+ @@ -1978,7 +1978,7 @@ off(type: "p2pConnectionChange", callback?: Callback<WifiP2pLinkedInfo>): | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | | type | string | 是 | 固定填"p2pConnectionChange"字符串。 | - | callback | Callback<[WifiP2pLinkedInfo](#WifiP2pLinkedInfo)> | 否 | 状态改变回调函数。如果callback不填,将去注册该事件关联的所有回调函数。 | + | callback | Callback<[WifiP2pLinkedInfo](#wifip2plinkedinfo8)> | 否 | 状态改变回调函数。如果callback不填,将去注册该事件关联的所有回调函数。 | ## wifi.on('p2pDeviceChange')8+ @@ -1995,7 +1995,7 @@ on(type: "p2pDeviceChange", callback: Callback<WifiP2pDevice>): void | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | | type | string | 是 | 固定填"p2pDeviceChange"字符串。 | - | callback | Callback<[WifiP2pDevice](#WifiP2pDevice)> | 是 | 状态改变回调函数。 | + | callback | Callback<[WifiP2pDevice](#wifip2pdevice8)> | 是 | 状态改变回调函数。 | ## wifi.off('p2pDeviceChange')8+ @@ -2012,7 +2012,7 @@ off(type: "p2pDeviceChange", callback?: Callback<WifiP2pDevice>): void | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | | type | string | 是 | 固定填"p2pDeviceChange"字符串。 | - | callback | Callback<[WifiP2pDevice](#WifiP2pDevice)> | 否 | 状态改变回调函数。如果callback不填,将去注册该事件关联的所有回调函数。 | + | callback | Callback<[WifiP2pDevice](#wifip2pdevice8)> | 否 | 状态改变回调函数。如果callback不填,将去注册该事件关联的所有回调函数。 | ## wifi.on('p2pPeerDeviceChange')8+ @@ -2029,7 +2029,7 @@ on(type: "p2pPeerDeviceChange", callback: Callback<WifiP2pDevice[]>): void | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | | type | string | 是 | 固定填"p2pPeerDeviceChange"字符串。 | - | callback | Callback<[WifiP2pDevice[]](#WifiP2pDevice)> | 是 | 状态改变回调函数。 | + | callback | Callback<[WifiP2pDevice[]](#wifip2pdevice8)> | 是 | 状态改变回调函数。 | ## wifi.off('p2pPeerDeviceChange')8+ @@ -2046,7 +2046,7 @@ off(type: "p2pPeerDeviceChange", callback?: Callback<WifiP2pDevice[]>): vo | **参数名** | **类型** | **必填** | **说明** | | -------- | -------- | -------- | -------- | | type | string | 是 | 固定填"p2pPeerDeviceChange"字符串。 | - | callback | Callback<[WifiP2pDevice[]](#WifiP2pDevice)> | 否 | 状态改变回调函数。如果callback不填,将去注册该事件关联的所有回调函数。 | + | callback | Callback<[WifiP2pDevice[]](#wifip2pdevice8)> | 否 | 状态改变回调函数。如果callback不填,将去注册该事件关联的所有回调函数。 | ## wifi.on('p2pPersistentGroupChange')8+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-wifiext.md b/zh-cn/application-dev/reference/apis/js-apis-wifiext.md index 886be03f294d441acb7ef308fdaa0bf78f24f373..9afdcf23bfa5127d0477d8543d0dbeb855f1d29b 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-wifiext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-wifiext.md @@ -57,7 +57,7 @@ getSupportedPowerModel(): Promise<Array<PowerModel>> **返回值:** | 类型 | 说明 | | -------- | -------- | - | Promise<Array<[PowerModel](#PowerModel)>> | Promise对象。表示功率模式。 | + | Promise<Array<[PowerModel](#powermodel)>> | Promise对象。表示功率模式。 | ## PowerModel @@ -86,7 +86,7 @@ getSupportedPowerModel(callback: AsyncCallback<Array<PowerModel>>): **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[PowerModel](#PowerModel)> | 是 | 回调函数。当操作成功时,err为0,data表示支持的功率模式。如果error为非0,表示处理出现错误。 | + | callback | AsyncCallback<[PowerModel](#powermodel)> | 是 | 回调函数。当操作成功时,err为0,data表示支持的功率模式。如果error为非0,表示处理出现错误。 | ## wifiext.getPowerModel @@ -102,7 +102,7 @@ getPowerModel(): Promise<PowerModel> **返回值:** | 类型 | 说明 | | -------- | -------- | - | Promise<[PowerModel](#PowerModel)> | Promise对象。表示功率模式。 | + | Promise<[PowerModel](#powermodel)> | Promise对象。表示功率模式。 | ## wifiext.getPowerModel @@ -118,7 +118,7 @@ getPowerModel(callback: AsyncCallback<PowerModel>): void **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[PowerModel](#PowerModel)> | 是 | 回调函数。当操作成功时,err为0,data表示功率模式。如果error为非0,表示处理出现错误。 | + | callback | AsyncCallback<[PowerModel](#powermodel)> | 是 | 回调函数。当操作成功时,err为0,data表示功率模式。如果error为非0,表示处理出现错误。 | ## wifiext.setPowerModel @@ -134,7 +134,7 @@ setPowerModel(model: PowerModel) : boolean; **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | model | AsyncCallback<[PowerModel](#PowerModel)> | 是 | 功率模式。 | + | model | AsyncCallback<[PowerModel](#powermodel)> | 是 | 功率模式。 | **返回值:** | **类型** | **说明** | 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 21f94b1970b8371ad03a1ae5de2b03e256b5a2c7..7d2f22cda2700b35b1ac1fb4867c87adc4ec9e62 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-window.md +++ b/zh-cn/application-dev/reference/apis/js-apis-window.md @@ -1856,8 +1856,8 @@ on(type: 'avoidAreaChange', callback: Callback<{[AvoidAreaType](#avoidareatyp **示例:** ```js -windowClass.on('avoidAreaChange', (type, data) => { - console.info('Succeeded in enabling the listener for system avoid area changes. type:' + JSON.stringify(type) + 'Data: ' + JSON.stringify(data)); +windowClass.on('avoidAreaChange', (data) => { + console.info('Succeeded in enabling the listener for system avoid area changes. type:' + JSON.stringify(data.type) + ', area: ' + JSON.stringify(data.area)); }); ``` @@ -2385,6 +2385,29 @@ promise.then((data)=> { }); ``` +### setWakeUpScreen()9+ + +setWakeUpScreen(wakeUp: boolean): void; + +窗口唤醒屏幕。 + +此接口为系统接口,三方应用不支持调用。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------------- | ------- | ---- | ---------------------------- | +| wakeUp | boolean | 是 | 是否设置唤醒屏幕。 | + +**示例:** + +```ts +var wakeUp = true; +windowClass.setWakeUpScreen(wakeUp); +``` + ### setBrightness setBrightness(brightness: number, callback: AsyncCallback<void>): void @@ -2451,9 +2474,9 @@ setDimBehind(dimBehindValue: number, callback: AsyncCallback<void>): void 窗口叠加时,设备有子窗口的情况下设置靠后的窗口的暗度值,使用callback异步回调。 -> **说明:** 从API version 9开始废弃。该API不支持使用。 -> -> 从 API version 7开始支持。 +> **说明:** 该接口不支持使用。 +> +> 从API version 9开始废弃。从API Version 7开始支持。 **系统能力:** SystemCapability.WindowManager.WindowManager.Core @@ -2482,9 +2505,9 @@ setDimBehind(dimBehindValue: number): Promise<void> 窗口叠加时,设备有子窗口的情况下设置靠后的窗口的暗度值,使用Promise异步回调。 -> **说明:** 从API version 9开始废弃。该API不支持使用。 +> **说明:** 该接口不支持使用。 > -> 从 API version 7开始支持。 +> 从API version 9开始废弃。从API Version 7开始支持。 **系统能力:** SystemCapability.WindowManager.WindowManager.Core @@ -2637,9 +2660,9 @@ setOutsideTouchable(touchable: boolean, callback: AsyncCallback<void>): vo 设置是否允许可点击子窗口之外的区域,使用callback异步回调。 -> **说明:** 从API version 9开始废弃。该API不支持使用。 +> **说明:** 该接口不支持使用。 > -> 从 API version 7开始支持。 +> 从API version 9开始废弃。从API Version 7开始支持。 **系统能力:** SystemCapability.WindowManager.WindowManager.Core @@ -2668,9 +2691,9 @@ setOutsideTouchable(touchable: boolean): Promise<void> 设置是否允许可点击子窗口之外的区域,使用Promise异步回调。。 -> **说明:** 从API version 9开始废弃。该API不支持使用。 +> **说明:** 该接口不支持使用。 > -> 从 API version 7开始支持。 +> 从API version 9开始废弃。从 API version 7开始支持。 **系统能力:** SystemCapability.WindowManager.WindowManager.Core @@ -2701,7 +2724,7 @@ promise.then((data)=> { setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback<void>): void -设置窗口是否为隐私模式,使用callback异步回调。 +设置窗口是否为隐私模式,使用callback异步回调。设置为隐私模式的窗口,窗口内容将无法被截屏或录屏。 **系统能力:** SystemCapability.WindowManager.WindowManager.Core @@ -2730,7 +2753,7 @@ windowClass.setPrivacyMode(isPrivacyMode, (err, data) => { setPrivacyMode(isPrivacyMode: boolean): Promise<void> -设置窗口是否为隐私模式,使用Promise异步回调。 +设置窗口是否为隐私模式,使用Promise异步回调。设置为隐私模式的窗口,窗口内容将无法被截屏或录屏。 **系统能力:** SystemCapability.WindowManager.WindowManager.Core @@ -2758,6 +2781,25 @@ promise.then((data)=> { }); ``` +### setSnapshotSkip9+ +setSnapshotSkip(isSkip: boolean): void + +截屏录屏是否忽略当前窗口。 + +此接口为系统接口。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------- | ------- | ---- | -------------------- | +| isSkip | boolean | 是 | 截屏录屏是否忽略当前窗口,默认为false。
true表示忽略当前窗口,false表示不忽略当前窗口。
| +```js +var isSkip = true; +windowClass.setSnapshotSkip(isSkip); +``` + ### setTouchable7+ setTouchable(isTouchable: boolean, callback: AsyncCallback<void>): void @@ -3381,6 +3423,7 @@ class myAbility extends Ability { setShowOnLockScreen(showOnLockScreen: boolean): void 设置应用显示在锁屏之上。 +此接口为系统接口,三方应用不支持调用。 此接口仅可在Stage模型下使用。 diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001236876377.jpg b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001236876377.jpg index b12c5fb6563c7ee9d8dfa7e6af1cfe1dcfa1361c..e5af4f50ebd9bdab6af30219f30fdf948a019a52 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001236876377.jpg and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001236876377.jpg differ diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md index ed99d0137cd965b927013eda6897a0ee0040d528..1eb4e1283c1c98c888489b5dbfa1e75ae33d488d 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md @@ -53,45 +53,47 @@ CheckboxGroup( group?: string ) @Entry @Component struct CheckboxExample { - build() { Scroll() { Column() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){ - CheckboxGroup({group : 'checkboxGroup'}) - .selectedColor(0xed6f21) - .onChange((itemName:CheckboxGroupResult) => { - console.info("TextPicker::dialogResult is" + JSON.stringify(itemName)) - }) - Text('select all').fontSize(20) - } - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){ - Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) - .select(true) - .selectedColor(0x39a2db) - .onChange((value: boolean) => { - console.info('Checkbox1 change is' + value) - }) - Text('Checkbox1').fontSize(20) - } - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){ - Checkbox({ name: 'checkbox2', group: 'checkboxGroup' }) - .select(false) - .selectedColor(0x39a2db) - .onChange((value: boolean) => { - console.info('Checkbox2 change is' + value) - }) - Text('Checkbox2').fontSize(20) - } - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){ - Checkbox({ name: 'checkbox3', group: 'checkboxGroup' }) - .select(true) - .selectedColor(0x39a2db) - .onChange((value: boolean) => { - console.info('Checkbox3 change is' + value) - }) - Text('Checkbox3').fontSize(20) - } + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + CheckboxGroup({ group: 'checkboxGroup' }) + .selectedColor(0xed6f21) + .onChange((itemName: CheckboxGroupResult) => { + console.info("TextPicker::dialogResult is" + JSON.stringify(itemName)) + }) + Text('select all').fontSize(20) + } + + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) + .select(true) + .selectedColor(0x39a2db) + .onChange((value: boolean) => { + console.info('Checkbox1 change is' + value) + }) + Text('Checkbox1').fontSize(20) + } + + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Checkbox({ name: 'checkbox2', group: 'checkboxGroup' }) + .select(false) + .selectedColor(0x39a2db) + .onChange((value: boolean) => { + console.info('Checkbox2 change is' + value) + }) + Text('Checkbox2').fontSize(20) + } + + Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { + Checkbox({ name: 'checkbox3', group: 'checkboxGroup' }) + .select(true) + .selectedColor(0x39a2db) + .onChange((value: boolean) => { + console.info('Checkbox3 change is' + value) + }) + Text('Checkbox3').fontSize(20) + } } } } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-select.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-select.md index 290c065e01ab19dda9b62fda3739171d764f6d86..b7b0543679eab4ca33d6d88e88f3ab3144f977d0 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-select.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-select.md @@ -53,16 +53,16 @@ Select(options: Array\) struct SelectExample { build() { Column() { - Select([{value:'aaa',icon: "/common/1.png"}, - {value:'bbb',icon: "/common/2.png"}, - {value:'ccc',icon: "/common/3.png"}, - {value:'ddd',icon: "/common/4.png"}]) + Select([{ value: 'aaa', icon: "/common/1.png" }, + { value: 'bbb', icon: "/common/2.png" }, + { value: 'ccc', icon: "/common/3.png" }, + { value: 'ddd', icon: "/common/4.png" }]) .selected(2) .value('TTT') - .font({size: 30, weight:400, family: 'serif', style: FontStyle.Normal }) - .selectedOptionFont({size: 40, weight: 500, family: 'serif', style: FontStyle.Normal }) - .optionFont({size: 30, weight: 400, family: 'serif', style: FontStyle.Normal }) - .onSelect((index:number)=>{ + .font({ size: 30, weight: 400, family: 'serif', style: FontStyle.Normal }) + .selectedOptionFont({ size: 40, weight: 500, family: 'serif', style: FontStyle.Normal }) + .optionFont({ size: 30, weight: 400, family: 'serif', style: FontStyle.Normal }) + .onSelect((index: number) => { console.info("Select:" + index) }) } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md index 36959733612a951be41c2149c7ceca7e4c9a4a8e..8bb8b3941407b4d87c412161d1b0453a75865348 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md @@ -4,7 +4,7 @@ > 该组件从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 -可滑动面板。提供一种轻量的内容展示的窗口,可方便的在不同尺寸中切换,属于弹出式组件。 +可滑动面板,提供一种轻量的内容展示窗口,方便在不同尺寸中切换。 ## 权限列表 @@ -37,6 +37,7 @@ Panel(value:{show:boolean}) | fullHeight | Length | - | 指定PanelMode.Full状态下的高度。 | | halfHeight | Length | - | 指定PanelMode.Half状态下的高度,默认为屏幕尺寸的一半。 | | miniHeight | Length | - | 指定PanelMode.Mini状态下的高度。 | +| backgroundMask9+|(color: ResourceColor)| - |指定Panel的背景蒙层。| - PanelType枚举说明 | 名称 | 描述 | @@ -58,7 +59,7 @@ Panel(value:{show:boolean}) | 名称 | 功能描述 | | -------- | -------- | | onChange(callback: (width: number, height: number, mode: PanelMode) => void) | 当可滑动面板发生状态变化时触发, 返回的height值为内容区高度值,当dragbar属性为true时,panel本身的高度值为dragbar高度加上内容区高度。 | - +| onHeightChange(callback: (value: number) => void)9+ |当可滑动面板发生高度变化时触发,返回的height值为内容区高度值,当dragbar属性为true时,panel本身的高度值为dragbar高度加上内容区高度。因用户体验设计原因,panel最高只能滑到 fullHeight-8vp | ## 示例 @@ -70,7 +71,7 @@ struct PanelExample { @State show: boolean = false build() { - Column() { + Stack() { Text('2021-09-30 Today Calendar: 1.afternoon......Click for details') .width('90%').height(50).borderRadius(10) .backgroundColor(0xFFFFFF).padding({ left: 20 }) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-refresh.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-refresh.md index df2ace39644d48184188f66496ca8e03e40b48ed..4fa205a6d17c448a23c7036382a17dba00f84a21 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-refresh.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-refresh.md @@ -21,7 +21,7 @@ Refresh\(value: \{refreshing: boolean, offset?: Length, friction?: number | stri | 参数 | 参数名 | 必填 | 默认值 | 参数描述 | | -------- | -------- | -------- | -------- | -------- | - | refreshing | boolean | 是 | - | 当前组件是否正在刷新。 | + | refreshing | boolean | 是 | - | 当前组件是否正在刷新。
该参数支持[$$](../../ui/ts-syntactic-sugar.md)双向绑定变量。 | | offset | Length | 否 | 16 | 刷新组件静止时距离父组件顶部的距离。| | friction | number \| string | 否 | 62 | 下拉摩擦系数,取值范围为0到100。
- 0表示下拉刷新容器不跟随手势下拉而下拉。
- 100表示下拉刷新容器紧紧跟随手势下拉而下拉。
- 数值越大,下拉刷新容器跟随手势下拉的反应越灵敏。 | @@ -58,7 +58,7 @@ struct RefreshExample { build() { Column() { - Refresh({refreshing: this.isRefreshing, offset: 120, friction: 100}) { + Refresh({refreshing: $$this.isRefreshing, offset: 120, friction: 100}) { Text('Pull Down and refresh: ' + this.counter) .fontSize(30) .margin(10) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md index 6217c50da6b0fd7d2eec01b7d3b98a59b372ebf9..7bcd121930a08b8e892d31cda640625c455117c4 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md @@ -43,6 +43,7 @@ SideBarContainer( type?: SideBarContainerType ) | minSideBarWidth | number \| [Length9+](../../ui/ts-types.md#长度类型) | 200 | 设置侧边栏最小宽度。 | | maxSideBarWidth | number \| [Length9+](../../ui/ts-types.md#长度类型) | 280 | 设置侧边栏最大宽度。 | | autoHide9+ | boolean | true | 设置当侧边栏拖拽到小于最小宽度后,是否自动隐藏。 | +| sideBarPosition9+ | SideBarPosition | SideBarPosition.Start | 设置侧边栏显示位置。 | - ButtonStyle对象说明 | 名称 | 参数类型 | 必填 | 默认值 | 描述 | @@ -53,6 +54,11 @@ SideBarContainer( type?: SideBarContainerType ) | height | number | 否 | 32 | 设置侧边栏控制按钮的高度。 | | icons | {
shown: string \| PixelMap \| [Resource](../../ui/ts-types.md) ,
hidden: string \| PixelMap \| [Resource](../../ui/ts-types.md) ,
switching?: string \| PixelMap \| [Resource](../../ui/ts-types.md)
} | 否 | - | 设置侧边栏控制按钮的图标:

- shown: 设置侧边栏显示时控制按钮的图标。
- hidden: 设置侧边栏隐藏时控制按钮的图标。
- switching:设置侧边栏显示和隐藏状态切换时控制按钮的图标。 | +- SideBarPosition9+枚举说明 + | 名称 | 描述 | + | -------- | -------- | + | Start | 侧边栏位于容器左侧。 | + | End | 侧边栏位于容器右侧。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border.md index 57e660947ef0d81e680f46434190181e91da34ae..4232e4edc4edef65815bfc289f63d6f81ff98b0d 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-border.md @@ -24,16 +24,16 @@ | borderStyle | BorderStyle |  BorderStyle.Solid | 设置元素的边框样式。 | | borderWidth | Length | 0 | 设置元素的边框宽度。 | | borderColor | [ResourceColor](../../ui/ts-types.md) | - | 设置元素的边框颜色。 | -| borderRadius | Length | 0 | 设置元素的边框圆角半径。 | +| borderRadius | Length \| BorderRadiuses9+ | 0 | 设置元素的边框圆角半径。 | - BorderOptions属性说明 | 参数名称 | 参数类型 | 默认值 | 必填 | 参数描述 | | -------- | ------------------------------------------------------------ | ----------------- | ---- | ---------- | - | width | [Length](../../ui/ts-types.md#长度类型)\|EdgeWidth9+ | 0 | 否 | 边框宽度。 | - | color | [ResourceColor](../../ui/ts-types.md)\|EdgeColor9+ | 'Black' | 否 | 边框颜色。 | - | radius | [Length](../../ui/ts-types.md#长度类型)\| EdgeRadiuses9+ | 0 | 否 | 边框角度。 | - | style | BorderStyle\|EdgeStyle9+ | BorderStyle.Solid | 否 | 边框样式。 | + | width | [Length](../../ui/ts-types.md#长度类型) \| EdgeWidth9+ | 0 | 否 | 边框宽度。 | + | color | [ResourceColor](../../ui/ts-types.md) \| EdgeColor9+ | 'Black' | 否 | 边框颜色。 | + | radius | [Length](../../ui/ts-types.md#长度类型) \| BorderRadiuses9+ | 0 | 否 | 边框角度。 | + | style | BorderStyle \| EdgeStyle9+ | BorderStyle.Solid | 否 | 边框样式。 | - EdgeWidth9+对象说明 @@ -58,7 +58,7 @@ | top | [ResourceColor](../../ui/ts-types.md) | 否 | 'Black' | 上侧边框颜色。 | | bottom | [ResourceColor](../../ui/ts-types.md) | 否 | 'Black' | 下侧边框颜色。 | -- EdgeRadiuses9+对象说明 +- BorderRadiuses9+对象说明 引用该对象时,至少传入一个参数。 diff --git a/zh-cn/application-dev/reference/native-apis/annotated.md b/zh-cn/application-dev/reference/native-apis/annotated.md deleted file mode 100644 index b4b83d5bb7a4e1fe605a00b1c4af4bba8b540b57..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/reference/native-apis/annotated.md +++ /dev/null @@ -1,13 +0,0 @@ -# 结构体 - - - -- **[OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md)** - -- **[OH_NativeXComponent_Callback](_o_h___native_x_component___callback.md)** - -- **[OH_NativeXComponent_TouchEvent](_o_h___native_x_component___touch_event.md)** - -- **[OH_NativeXComponent_TouchPoint](_o_h___native_x_component___touch_point.md)** - -- **[RawFileDescriptor](_raw_file_descriptor.md)** \ No newline at end of file diff --git a/zh-cn/application-dev/reference/native-apis/files.md b/zh-cn/application-dev/reference/native-apis/files.md deleted file mode 100644 index f4beb38e74356c62ccb498720313d2fd6a879a9f..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/reference/native-apis/files.md +++ /dev/null @@ -1,35 +0,0 @@ -# 头文件 - - - -- **[drawing_bitmap.h](drawing__bitmap_8h.md)** - -- **[drawing_brush.h](drawing__brush_8h.md)** - -- **[drawing_canvas.h](drawing__canvas_8h.md)** - -- **[drawing_color.h](drawing__color_8h.md)** - -- **[drawing_font_collection.h](drawing__font__collection_8h.md)** - -- **[drawing_path.h](drawing__path_8h.md)** - -- **[drawing_pen.h](drawing__pen_8h.md)** - -- **[drawing_text_declaration.h](drawing__text__declaration_8h.md)** - -- **[drawing_text_typography.h](drawing__text__typography_8h.md)** - -- **[drawing_types.h](drawing__types_8h.md)** - -- **[external_window.h](external__window_8h.md)** - -- **[log.h](log_8h.md)** - -- **[native_interface_bundle.h](native__interface__bundle_8h.md)** - -- **[native_interface_xcomponent.h](native__interface__xcomponent_8h.md)** - -- **[raw_dir.h](raw__dir_8h.md)** - -- **[raw_file.h](raw__file_8h.md)** \ No newline at end of file diff --git a/zh-cn/application-dev/reference/native-apis/index.md b/zh-cn/application-dev/reference/native-apis/index.md deleted file mode 100644 index f04f11fd3ba729aa2e871108fbf1679511b026dc..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/reference/native-apis/index.md +++ /dev/null @@ -1,15 +0,0 @@ -# MyProject - - - -- **[Native XComponent](_o_h___native_x_component.md)** - -- **[Native_Bundle](_native___bundle.md)** - -- **[HiLog](_hi_log.md)** - -- **[NativeWindow](_native_window.md)** - -- **[Drawing](_drawing.md)** - -- **[Rawfile](rawfile.md)** \ No newline at end of file diff --git a/zh-cn/application-dev/reference/native-apis/total.md b/zh-cn/application-dev/reference/native-apis/total.md deleted file mode 100644 index bac50766065bf942c00fe3d98e89e1772b2b5087..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/reference/native-apis/total.md +++ /dev/null @@ -1,7 +0,0 @@ -# 头文件和结构体 - - - -- **[头文件](files.md)** - -- **[结构体](annotated.md)** \ No newline at end of file diff --git a/zh-cn/application-dev/security/huks-overview.md b/zh-cn/application-dev/security/huks-overview.md index b6bfae7f5a0be1cfb7bce7fa381a5b4e0b641032..3711420d9b14dba3709cddfe07a58741760173f5 100755 --- a/zh-cn/application-dev/security/huks-overview.md +++ b/zh-cn/application-dev/security/huks-overview.md @@ -16,13 +16,13 @@ HUKS对密钥的使用主要通过Init、Update、Finish操作来实现。 - **Init操作**:读取密钥,并为其创建Session Id返回给调用者。 -- **Udate操作**:根据Init操作获取的Session Id对数据进行分段update处理。 +- **Update操作**:根据Init操作获取的Session Id对数据进行分段update处理。 -- **Fnish操作**:当所有待处理的数据均传入HUKS后,调用Finish操作完成最终数据处理,释放资源。 +- **Finish操作**:当所有待处理的数据均传入HUKS后,调用Finish操作完成最终数据处理,释放资源。 > **须知:**
> 当Init、Update、Finish操作中的任一阶段发生错误时,都需要调用Abort操作来终止密钥的使用。 ## 约束与限制 -不涉及。 \ No newline at end of file +不涉及。 diff --git a/zh-cn/application-dev/security/permission-list.md b/zh-cn/application-dev/security/permission-list.md index e4fcc0ebb44bc8e68896eab2d8ae44409d1dd717..e661b3eb83a4aa5b195bb8bd9130663a9412ceac 100644 --- a/zh-cn/application-dev/security/permission-list.md +++ b/zh-cn/application-dev/security/permission-list.md @@ -129,4 +129,5 @@ | ohos.permission.ACCESS_IDS | system_core | system_grant | TRUE | 允许应用查询设备的唯一标识符信息。 | | ohos.permission.DUMP | system_core | system_grant | TRUE | 允许导出系统基础信息和SA服务信息。 | | ohos.permission.DISTRIBUTED_SOFTBUS_CENTER | system_basic | system_grant | FALSE | 允许不同设备之间进行组网处理。 | -| ohos.permission.ACCESS_DLP_FILE | system_core | system_grant | TRUE | 允许对DLP文件进行权限配置和管理。 | \ No newline at end of file +| ohos.permission.ACCESS_DLP_FILE | system_core | system_grant | TRUE | 允许对DLP文件进行权限配置和管理。 | +| ohos.permission.PROVISIONING_MESSAGE | system_core | system_grant | TRUE | 允许激活超级设备管理器应用。 | \ No newline at end of file diff --git a/zh-cn/application-dev/security/userauth-guidelines.md b/zh-cn/application-dev/security/userauth-guidelines.md index de8b8987c78ef6e3254b2d26a05113037efba605..d30a71e607a2f8492b134e7ecc843347597ceac8 100644 --- a/zh-cn/application-dev/security/userauth-guidelines.md +++ b/zh-cn/application-dev/security/userauth-guidelines.md @@ -111,9 +111,3 @@ userIAM_userAuth模块提供了用户认证的相关方法,包括检测认证 console.error("cancel auth fail"); } ``` - -## 相关实例 - -针对用户认证开发,有以下相关实例可供参考: - -- [`UserAuth`:用户认证(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/Safety/UserAuth) diff --git a/zh-cn/application-dev/task-management/background-task-dev-guide.md b/zh-cn/application-dev/task-management/background-task-dev-guide.md index 12253f396d09c568d17ed8ce6f2ddd7a924c0bd3..54998ed2986075f4b89942e277ef10a96ea0d6f9 100644 --- a/zh-cn/application-dev/task-management/background-task-dev-guide.md +++ b/zh-cn/application-dev/task-management/background-task-dev-guide.md @@ -198,7 +198,7 @@ ohos.permission.KEEP_BACKGROUND_RUNNING ], // 后台模式类型 } ], - "reqPermissions": [ + "requestPermissions": [ { "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" // 长时任务权限 } diff --git a/zh-cn/application-dev/ui/ts-syntactic-sugar.md b/zh-cn/application-dev/ui/ts-syntactic-sugar.md index 0ce4cad3b5efa6ba2184a88f79649eeda9a133ac..5b824e089fdeec1e38552e7737abff9d9d7b954c 100644 --- a/zh-cn/application-dev/ui/ts-syntactic-sugar.md +++ b/zh-cn/application-dev/ui/ts-syntactic-sugar.md @@ -137,11 +137,11 @@ build() { ``` -## $ +## 变量双向绑定 $$支持变量双向绑定,支持简单变量、@State、@Link、@Prop等类型。 -当前$$仅支持[bindPopup](../reference/arkui-ts/ts-universal-attributes-popup.md)属性的show参数和@State变量之间的渲染,以及Radio组件的checked属性。 +当前$$仅支持[bindPopup](../reference/arkui-ts/ts-universal-attributes-popup.md)属性的show参数和@State变量之间的渲染,以及Radio组件的checked属性和Refresh组件的refreshing参数。 ```ts diff --git a/zh-cn/application-dev/website.md b/zh-cn/application-dev/website.md index 4c0b015c9e43669753a882fa918f722bde263b32..30d39ae55f5ec9ab7cb6d5d8ae142e971ad07862 100644 --- a/zh-cn/application-dev/website.md +++ b/zh-cn/application-dev/website.md @@ -4,10 +4,9 @@ - 快速入门 - [开发准备](quick-start/start-overview.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) + - [使用eTS语言开发(Stage模型)](quick-start/start-with-ets-stage.md) + - [使用eTS语言开发(FA模型)](quick-start/start-with-ets-fa.md) + - [使用JS语言开发(FA模型)](quick-start/start-with-js-fa.md) - 开发基础知识 - [应用包结构说明(FA模型)](quick-start/package-structure.md) @@ -191,7 +190,9 @@ - 窗口管理 - 窗口 - [窗口开发概述](windowmanager/window-overview.md) - - [窗口开发指导](windowmanager/window-guidelines.md) + - [管理应用窗口(Stage模型)](windowmanager/application-window-stage.md) + - [管理应用窗口(FA模型)](windowmanager/application-window-fa.md) + - [管理系统窗口(仅Stage模型支持)](windowmanager/system-window-stage.md) - 屏幕属性 - [屏幕属性开发概述](windowmanager/display-overview.md) - [屏幕属性开发指导](windowmanager/display-guidelines.md) @@ -818,6 +819,7 @@ - [@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) + - [@ohos.systemTimer(设置系统时间)](js-apis-system-timer.md) - [Timer (定时器)](reference/apis/js-apis-timer.md) - 设备管理 - [@ohos.batteryInfo (电量信息)](reference/apis/js-apis-battery-info.md) @@ -933,4 +935,6 @@ - 附录 - [Native api中没有导出的符号列表](reference/native-lib/third_party_libc/musl-peculiar-symbol.md) - [Native api中导出的EGL符号列表](reference/native-lib/third_party_opengl/egl-symbol.md) - - [Native api中导出的OpenGL ES 3.0符号列表](reference/native-lib/third_party_opengl/openglesv3-symbol.md) \ No newline at end of file + - [Native api中导出的OpenGL ES 3.0符号列表](reference/native-lib/third_party_opengl/openglesv3-symbol.md) +- 常见问题 + - [full-SDK替换指南](quick-start/full-sdk-switch-guide.md) \ No newline at end of file diff --git a/zh-cn/application-dev/windowmanager/Readme-CN.md b/zh-cn/application-dev/windowmanager/Readme-CN.md index fcfb79f31d426720360b787f9efba03f1be16849..fff76b863d6b9198dec861f7cffaf7e9025009d2 100644 --- a/zh-cn/application-dev/windowmanager/Readme-CN.md +++ b/zh-cn/application-dev/windowmanager/Readme-CN.md @@ -1,12 +1,16 @@ # 窗口管理 -* 窗口 - * [窗口开发概述](window-overview.md) - * [窗口开发指导](window-guidelines.md) -* 屏幕属性 - * [屏幕属性开发概述](display-overview.md) - * [屏幕属性开发指导](display-guidelines.md) -* 屏幕截图 - * [屏幕截图开发概述](screenshot-overview.md) - * [屏幕截图开发指导](screenshot-guidelines.md) +- 窗口 + - [窗口开发概述](window-overview.md) + - [管理应用窗口(Stage模型)](application-window-stage.md) + - [管理应用窗口(FA模型)](application-window-fa.md) + - [管理系统窗口(仅Stage模型支持)](system-window-stage.md) + +- 屏幕属性 + - [屏幕属性开发概述](display-overview.md) + - [屏幕属性开发指导](display-guidelines.md) + +- 屏幕截图 + - [屏幕截图开发概述](screenshot-overview.md) + - [屏幕截图开发指导](screenshot-guidelines.md) \ No newline at end of file diff --git a/zh-cn/application-dev/windowmanager/application-window-fa.md b/zh-cn/application-dev/windowmanager/application-window-fa.md new file mode 100644 index 0000000000000000000000000000000000000000..20f2f1d3e00c5c44eaa520e8f3bf8a33d05e6771 --- /dev/null +++ b/zh-cn/application-dev/windowmanager/application-window-fa.md @@ -0,0 +1,260 @@ +# 管理应用窗口(FA模型) + +## 基本概念 + +窗口沉浸式能力:指对状态栏、导航栏等系统窗口进行控制,减少状态栏导航栏等系统界面的突兀感,从而使用户获得最佳体验的能力。 +沉浸式能力只在应用主窗口作为全屏窗口时生效。通常情况下,应用子窗口(弹窗、悬浮窗口等辅助窗口)和处于自由窗口下的应用主窗口无法使用沉浸式能力。 + +## 场景介绍 + +在FA模型下,管理应用窗口的典型场景有: + +- 设置应用子窗口属性及目标页面 + +- 体验窗口沉浸式能力 + +以下分别介绍具体开发方式。 + + +## 接口说明 + +上述场景涉及的常用接口如下表所示。更多API说明请参见[API参考](../reference/apis/js-apis-window.md)。 + +| 实例名 | 接口名 | 描述 | +| -------- | -------- | -------- | +| window静态方法 | create(id:string,type:WindowType,callback:AsyncCallback]<Window>):void | 创建子窗口。
此接口仅可在`FA`模型下使用。 | +| window静态方法 | getTopWindow(callback:AsyncCallback<Window>):void | 获取当前应用内最后显示的窗口。
此接口仅可在`FA`模型下使用。 | +| window静态方法 | find(id:string,callback:AsyncCallback<Window>):void | 查找`id`所对应的窗口。 | +| Window | loadContent(path:string,callback:AsyncCallback<void>):void | 为当前窗口加载具体页面内容。 | +| Window | moveTo(x:number,y:number,callback:AsyncCallback<void>):void | 移动当前窗口。 | +| Window | setBackgroundColor(color:string,callback:AsyncCallback<void>):void | 设置窗口的背景色 | +| Window | setBrightness(brightness:number,callback:AsyncCallback<void>):void | 设置屏幕亮度值。 | +| Window | resetSize(width:number,height:number,callback:AsyncCallback<void>):void | 改变当前窗口大小。 | +| Window | setFullScreen(isFullScreen:boolean,callback:AsyncCallback<void>):void | 设置窗口是否全屏显示。 | +| Window | setLayoutFullScreen(isLayoutFullScreen:boolean,callback:AsyncCallback<void>):void | 设置窗口布局是否为全屏布局。 | +| Window | setSystemBarEnable(names:Array<'status'\|'navigation'>):Promise<void> | 设置导航栏、状态栏是否显示。 | +| Window | setSystemBarProperties(systemBarProperties:SystemBarProperties,callback:AsyncCallback<void>):void | 设置窗口内导航栏、状态栏属性。
`systemBarProperties`:导航栏、状态栏的属性集合。 | +| Window | show(callback: AsyncCallback\): void | 显示当前窗口。 | +| Window | on(type:'touchOutside',callback:Callback<void>):void | 开启本窗口区域外的点击事件的监听。 | +| Window | destroy(callback: AsyncCallback<void>):void | 销毁当前窗口。 | + + +## 设置应用子窗口 + +开发者可以按需创建应用子窗口,如弹窗等,并对其进行属性设置等操作。 + + +### 开发步骤 + +1. 创建/获取子窗口对象。 + + - 可以通过`window.create`接口创建子窗口。 + - 可以通过`window.getTopWindow`来获取最后显示的窗口得到子窗口。 + - 也可以通过`window.find`接口来查找已经创建的窗口从而得到子窗口。 + + ```js + import window from '@ohos.window'; + + var windowClass = null; + // 1.方式一:创建子窗口。 + window.create("subWindow", window.WindowType.TYPE_APP, (err, data) => { + if (err.code) { + console.error('Failed to create the subWindow. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in creating subWindow. Data: ' + JSON.stringify(data)); + windowClass = data; + }); + // 1.方式二:获取子窗口。 + window.getTopWindow((err, data) => { + if (err.code) { + console.error('Failed to get the subWindow. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in getting subWindow. Data: ' + JSON.stringify(data)); + windowClass = data; + }); + // 1.方式三:查找得到子窗口。 + window.find("subWindow", (err, data) => { + if (err.code) { + console.error('Failed to find the subWindow. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in finding subWindow. Data: ' + JSON.stringify(data)); + windowClass = data; + }); + ``` + +2. 设置子窗口属性。 + + 子窗口创建成功后,可以改变其大小、位置等,还可以根据应用需要设置窗口背景色、亮度等属性。 + + + ```js + // 2.移动子窗口位置。 + windowClass.moveTo(300, 300, (err, data) => { + if (err.code) { + console.error('Failed to move the window. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in moving the window. Data: ' + JSON.stringify(data)); + }); + // 2.改变子窗口大小。 + windowClass.resetSize(500, 1000, (err, data) => { + if (err.code) { + console.error('Failed to change the window size. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in changing the window size. Data: ' + JSON.stringify(data)); + }); + ``` + +3. 加载显示子窗口的具体内容。 + + 使用`loadContent`和`show`接口加载显示子窗口的具体内容。 + + + ```js + // 3.为子窗口加载对应的目标页面。 + windowClass.loadContent("pages/page2", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)); + // 3.显示子窗口。 + windowClass.show((err, data) => { + if (err.code) { + console.error('Failed to show the window. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in showing the window. Data: ' + JSON.stringify(data)); + }); + }); + ``` + +4. 销毁子窗口。 + + 当不再需要某些子窗口时,可根据场景的具体实现逻辑,使用`destroy`接口销毁子窗口。 + + + ```js + // 4.销毁子窗口。当不再需要某些子窗口时,可根据场景的具体实现逻辑,使用destroy接口销毁子窗口,此处以监听窗口区域外的点击事件实现子窗口的销毁。 + windowClass.on('touchOutside', () => { + console.info('touch outside'); + windowClass.destroy((err, data) => { + if (err.code) { + console.error('Failed to destroy the subwindow. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in destroying the subwindow. Data: ' + JSON.stringify(data)); + }); + }); + ``` + + +## 体验窗口沉浸式能力 + +在看视频、玩游戏等场景下,用户往往希望隐藏状态栏、导航栏等不必要的系统窗口,从而获得更佳的沉浸式体验。此时可以借助窗口沉浸式能力(窗口沉浸式能力都是针对应用主窗口而言的),达到预期效果。 + + +### 开发步骤 + +1. 获取主窗口对象。 + + 沉浸式能力需要在成功获取应用主窗口对象的前提下进行。使用`window.getTopWindow`接口来获取得到主窗口。 + + + ```js + import window from '@ohos.window'; + + var mainWindowClass = null; + // 1.获取主窗口 + window.getTopWindow((err, data) => { + if (err.code) { + console.error('Failed to get the subWindow. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in getting subWindow. Data: ' + JSON.stringify(data)); + mainWindowClass = data; + }); + ``` + +2. 实现沉浸式效果。有以下三种方式: + + - 方式一:调用`setFullScreen`接口,设置应用主窗口为全屏显示,此时导航栏、状态栏将隐藏,从而达到沉浸式效果。 + - 方式二:调用`setSystemBarEnable`接口,设置导航栏、状态栏不显示,从而达到沉浸式效果。 + - 方式三:调用`setLayoutFullScreen`接口,设置应用主窗口为全屏布局;然后调用`setSystemPropertites`接口,设置导航栏、状态栏的透明度、背景/文字颜色以及高亮图标等属性,使之保持与主窗口显示协调一致,从而达到沉浸式效果。 + + ```js + // 2.实现沉浸式效果。方式一:设置窗口全屏显示。 + var isFullScreen = true; + mainWindowClass.setFullScreen(isFullScreen, (err, data) => { + if (err.code) { + console.error('Failed to enable the full-screen mode. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in enabling the full-screen mode. Data: ' + JSON.stringify(data)); + }); + // 2.实现沉浸式效果。方式二:设置导航栏、状态栏不显示。 + var names = null; + mainWindowClass.setSystemBarEnable(names, (err, data) => { + if (err.code) { + console.error('Failed to set the system bar to be visible. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in setting the system bar to be visible. Data: ' + JSON.stringify(data)); + }); + // 2.实现沉浸式效果。 + //方式三:设置窗口为全屏布局,配合设置状态栏、导航栏的透明度、背景/文字颜色及高亮图标等属性,与主窗口显示保持协调一致。 + var isLayoutFullScreen = true; + mainWindowClass.setLayoutFullScreen(isLayoutFullScreen, (err, data) => { + if (err.code) { + console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in setting the window layout to full-screen mode. Data: ' + JSON.stringify(data)); + }); + var SystemBarProperties = { + statusBarColor: '#ff00ff', + navigationBarColor: '#00ff00', + //以下两个属性从API Version7开始支持 + isStatusBarLightIcon: false, + isNavigationBarLightIcon: false, + //以下两个属性从API Version8开始支持 + statusBarContentColor: '#ffffff', + navigationBarContentColor: '#ffffff' + }; + mainWindowClass.setSystemBarProperties(SystemBarProperties, (err, data) => { + if (err.code) { + console.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in setting the system bar properties. Data: ' + JSON.stringify(data)); + }); + ``` + +3. 加载显示沉浸式窗口的具体内容。 + + 使用`loadContent`和`show`接口加载显示沉浸式窗口的具体内容。 + + + ```js + // 3.为沉浸式窗口加载对应的目标页面。 + mainWindowClass.loadContent("pages/page3", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)); + // 3.显示沉浸式窗口。 + mainWindowClass.show((err, data) => { + if (err.code) { + console.error('Failed to show the window. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in showing the window. Data: ' + JSON.stringify(data)); + }); + }); + ``` + diff --git a/zh-cn/application-dev/windowmanager/application-window-stage.md b/zh-cn/application-dev/windowmanager/application-window-stage.md new file mode 100644 index 0000000000000000000000000000000000000000..33fe1385b290ea4b51630d9152f6c3a8341db84d --- /dev/null +++ b/zh-cn/application-dev/windowmanager/application-window-stage.md @@ -0,0 +1,406 @@ +# 管理应用窗口(Stage模型) + + +## 基本概念 + +- 窗口沉浸式能力:指对状态栏、导航栏等系统窗口进行控制,减少状态栏导航栏等系统界面的突兀感,从而使用户获得最佳体验的能力。 + 沉浸式能力只在应用主窗口作为全屏窗口时生效。通常情况下,应用子窗口(弹窗、悬浮窗口等辅助窗口)和处于自由窗口下的应用主窗口无法使用沉浸式能力。 + +- 悬浮窗:全局悬浮窗口是一种特殊的应用窗口,具备在应用主窗口和对应Ability退至后台后仍然可以在前台显示的能力。 + 悬浮窗口可以用于应用退至后台后,使用小窗继续播放视频,或者为特定的应用创建悬浮球等快速入口。应用在创建悬浮窗口前,需要申请对应的权限。 + + +## 场景介绍 + +在`Stage`模型下,管理应用窗口的典型场景有: + +- 设置应用主窗口属性及目标页面 + +- 设置应用子窗口属性及目标页面 + +- 体验窗口沉浸式能力 + +- 设置悬浮窗 + +以下分别介绍具体开发方式。 + + +## 接口说明 + +上述场景涉及的常用接口如下表所示。更多API说明请参见[API参考](../reference/apis/js-apis-window.md)。 + +| 实例名 | 接口名 | 描述 | +| -------- | -------- | -------- | +| WindowStage | getMainWindow(callback:AsyncCallback<Window>):void | 获取`WindowStage`实例下的主窗口。
此接口仅可在`Stage`模型下使用。 | +| WindowStage | loadContent(path:string,callback:AsyncCallback<void>):void | 为当前`WindowStage`的主窗口加载具体页面。
此接口仅可在`Stage`模型下使用。 | +| WindowStage | createSubWindow(name:string,callback:AsyncCallback<Window>):void | 创建子窗口。
此接口仅可在`Stage`模型下使用。 | +| window静态方法 | create(ctx:Context,id:string,type:WindowType,callback:AsyncCallback<Window>):void | 创建子窗口。
-`ctx`:为应用上下文信息。
-`type`:为创建的窗口类型。 | +| Window | loadContent(path:string,callback:AsyncCallback<void>):void | 为当前窗口加载具体页面。 | +| Window | setBackgroundColor(color:string,callback:AsyncCallback<void>):void | 设置窗口的背景色。 | +| Window | setBrightness(brightness:number,callback:AsyncCallback<void>):void | 设置屏幕亮度值。 | +| Window | setTouchable(isTouchable:boolean,callback:AsyncCallback<void>):void | 设置窗口是否为可触状态。 | +| Window | moveTo(x:number,y:number,callback:AsyncCallback<void>):void | 移动当前窗口位置。 | +| Window | resetSize(width:number,height:number,callback:AsyncCallback<void>):void | 改变当前窗口大小。 | +| Window | setFullScreen(isFullScreen:boolean,callback:AsyncCallback<void>):void | 设置窗口是否全屏显示。 | +| Window | setLayoutFullScreen(isLayoutFullScreen:boolean,callback:AsyncCallback<void>):void | 设置窗口布局是否为全屏布局。 | +| Window | setSystemBarEnable(names:Array<'status'\|'navigation'>):Promise<void> | 设置导航栏、状态栏是否显示。 | +| Window | setSystemBarProperties(systemBarProperties:SystemBarProperties,callback:AsyncCallback<void>):void | 设置窗口内导航栏、状态栏属性。
`systemBarProperties`:导航栏、状态栏的属性集合。 | +| Window | show(callback: AsyncCallback\): void | 显示当前窗口。 | +| Window | on(type:'touchOutside',callback:Callback<void>):void | 开启本窗口区域外的点击事件的监听。 | +| Window | destroy(callback: AsyncCallback<void>):void | 销毁当前窗口。 | + + +## 设置应用主窗口 + +在`Stage`模型下,应用主窗口由`Ability`创建并维护生命周期。在`Ability`的`onWindowStageCreate`回调中,通过`WindowStage`获取应用主窗口,即可对其进行属性设置等操作 + + +### 开发步骤 + +1. 获取应用主窗口。 + 通过`getMainWindow`接口获取应用主窗口。 + +2. 设置主窗口属性。 + 可设置主窗口的背景色、亮度值、是否可触等多个属性,开发者可根据需要选择对应的接口。本示例以设置“是否可触”属性为例。 + +3. 为主窗口加载对应的目标页面。 + 通过`loadContent`接口加载主窗口的目标页面。 + + +```ts +import Ability from '@ohos.application.Ability' + +class MainAbility extends Ability { + onWindowStageCreate(windowStage) { + // 1.获取应用主窗口。 + var windowClass = null; + windowStage.getMainWindow((err, data) => { + if (err.code) { + console.error('Failed to obtain the main window. Cause: ' + JSON.stringify(err)); + return; + } + windowClass = data; + console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data)); + // 2.设置主窗口属性。以设置"是否可触"属性为例。 + var isTouchable = true; + windowClass.setTouchable(isTouchable, (err, data) => { + if (err.code) { + console.error('Failed to set the window to be touchable. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in setting the window to be touchable. Data:' + JSON.stringify(data)); + }) + }) + // 3.为主窗口加载对应的目标页面。 + windowStage.loadContent("pages/page2", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)); + }); + } +}; +``` + + +## 设置应用子窗口 + +开发者可以按需创建应用子窗口,如弹窗等,并对其进行属性设置等操作。 + + +### 开发步骤 + +1. 创建/获取应用子窗口。 + 通过`createSubWindow`接口创建应用子窗口。 + + 通过`getSubWindow`接口获取已创建的应用子窗口。 + +2. 设置子窗口属性。 + 子窗口创建成功后,可以改变其大小、位置等,还可以根据应用需要设置窗口背景色、亮度等属性。 + +3. 加载显示子窗口的具体内容。 + 通过`loadContent`和`show`接口加载显示子窗口的具体内容。 + +4. 销毁子窗口。 + 当不再需要某些子窗口时,可根据具体实现逻辑,使用`destroy`接口销毁子窗口。 + + + ```ts + import Ability from '@ohos.application.Ability' + + class MainAbility extends Ability { + onWindowStageCreate(windowStage) { + // 1.创建应用子窗口。 + var sub_windowClass = null; + windowStage.createSubWindow("mySubWindow", (err, data) => { + if (err.code) { + console.error('Failed to create the subwindow. Cause: ' + JSON.stringify(err)); + return; + } + sub_windowClass = data; + console.info('Succeeded in creating the subwindow. Data: ' + JSON.stringify(data)); + // 1.获取已创建的应用子窗口。 + windowStage.getSubWindow((err, data) => { + if (err.code) { + console.error('Failed to obtain the subWindow. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in obtaining the subWindow. Data: ' + JSON.stringify(data)); + sub_windowClass = data; + }); + // 2.子窗口创建成功后,设置子窗口的位置、大小及相关属性等。 + sub_windowClass.moveTo(300, 300, (err, data) => { + if (err.code) { + console.error('Failed to move the window. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in moving the window. Data: ' + JSON.stringify(data)); + }); + sub_windowClass.resetSize(500, 1000, (err, data) => { + if (err.code) { + console.error('Failed to change the window size. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in changing the window size. Data: ' + JSON.stringify(data)); + }); + // 3.为子窗口加载对应的目标页面。 + sub_windowClass.loadContent("pages/page3", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)); + // 3.显示子窗口。 + sub_windowClass.show((err, data) => { + if (err.code) { + console.error('Failed to show the window. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in showing the window. Data: ' + JSON.stringify(data)); + }); + }); + // 4.销毁子窗口。当不再需要子窗口时,可根据具体实现逻辑,使用destroy对其进行销毁,此处以监听窗口区域外的点击事件为例实现子窗口的销毁。 + sub_windowClass.on('touchOutside', () => { + console.info('touch outside'); + sub_windowClass.destroy((err, data) => { + if (err.code) { + console.error('Failed to destroy the window. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in destroying the window. Data: ' + JSON.stringify(data)); + }); + }); + }) + } + }; + ``` + + +## 体验窗口沉浸式能力 + +在看视频、玩游戏等场景下,用户往往希望隐藏状态栏、导航栏等不必要的系统窗口,从而获得更佳的沉浸式体验。此时可以借助窗口沉浸式能力(窗口沉浸式能力都是针对应用主窗口而言的),达到预期效果。 + + +### 开发步骤 + +1. 获取应用主窗口。 + 通过`getMainWindow`接口获取应用主窗口。 + +2. 实现沉浸式效果。有以下三种方式: + - 方式一:调用`setFullScreen`接口,设置应用主窗口为全屏显示,此时导航栏、状态栏将隐藏,从而达到沉浸式效果。 + - 方式二:调用`setSystemBarEnable`接口,设置导航栏、状态栏不显示,从而达到沉浸式效果。 + - 方式三:调用`setLayoutFullScreen`接口,设置应用主窗口为全屏布局;然后调用`setSystemPropertites`接口,设置导航栏、状态栏的透明度、背景/文字颜色以及高亮图标等属性,使之保持与主窗口显示协调一致,从而达到沉浸式效果。 + +3. 加载显示沉浸式窗口的具体内容。 + 通过`loadContent`和`show`接口加载显示沉浸式窗口的具体内容。 + + + ```ts + import Ability from '@ohos.application.Ability' + + class MainAbility extends Ability { + onWindowStageCreate(windowStage) { + // 1.获取应用主窗口。 + var windowClass = null; + windowStage.getMainWindow((err, data) => { + if (err.code) { + console.error('Failed to obtain the main window. Cause: ' + JSON.stringify(err)); + return; + } + windowClass = data; + console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data)); + + // 2.实现沉浸式效果。方式一:设置应用主窗口为全屏显示。 + var isFullScreen = true; + windowClass.setFullScreen(isFullScreen, (err, data) => { + if (err.code) { + console.error('Failed to enable the full-screen mode. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in enabling the full-screen mode. Data: ' + JSON.stringify(data)); + }); + // 2.实现沉浸式效果。方式二:设置导航栏、状态栏不显示。 + var names = null; + windowClass.setSystemBarEnable(names, (err, data) => { + if (err.code) { + console.error('Failed to set the system bar to be visible. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in setting the system bar to be visible. Data: ' + JSON.stringify(data)); + }); + // 2.实现沉浸式效果。方式三:设置窗口为全屏布局,配合设置导航栏、状态栏的透明度、背景/文字颜色及高亮图标等属性,与主窗口显示保持协调一致。 + var isLayoutFullScreen = true; + windowClass.setLayoutFullScreen(isLayoutFullScreen, (err, data) => { + if (err.code) { + console.error('Failed to set the window layout to full-screen mode. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in setting the window layout to full-screen mode. Data: ' + JSON.stringify(data)); + }); + var SystemBarProperties = { + statusBarColor: '#ff00ff', + navigationBarColor: '#00ff00', + // 以下两个属性从API Version 7开始支持 + isStatusBarLightIcon: false, + isNavigationBarLightIcon: false, + // 以下两个属性从API Version 8开始支持 + statusBarContentColor: '#ffffff', + navigationBarContentColor: '#ffffff' + }; + windowClass.setSystemBarProperties(SystemBarProperties, (err, data) => { + if (err.code) { + console.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in setting the system bar properties. Data: ' + JSON.stringify(data)); + }); + }) + // 3.为沉浸式窗口加载对应的目标页面。 + windowStage.loadContent("pages/page2", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)); + // 3.显示沉浸式窗口。 + windowStage.show((err, data) => { + if (err.code) { + console.error('Failed to show the window. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in showing the window. Data: ' + JSON.stringify(data)); + }); + }); + } + }; + ``` + + +## 设置悬浮窗 + +悬浮窗可以在已有的任务基础上,创建一个始终在前台显示的窗口。即使创建悬浮窗的任务退至后台,悬浮窗仍然可以在前台显示。开发者可以创建悬浮窗,并对悬浮窗进行属性设置等操作。 + + +### 开发步骤 + +1. 申请权限。 + 创建`WindowType.TYPE_FLOAT`即悬浮窗类型的窗口,需要在`module.json5`文件的`requestPermissions`对象中配置`ohos.permission.SYSTEM_FLOAT_WINDOW`权限。更多配置信息详见[应用包结构配置文件的说明](../quick-start/stage-structure.md)。 + + > **说明:** + > 虽然悬浮窗具备始终在前台显示的能力,但如果创建悬浮窗的应用任务被系统回收,仍然会导致悬浮窗从界面移除。如果想要保持悬浮窗口始终在前台显示,请申请[长时任务](../task-management/background-task-overview.md)。 + + + ```json + { + "module": { + "requestPermissions":[ + { + "name" : "ohos.permission.SYSTEM_FLOAT_WINDOW", + "usedScene": { + "abilities": [ + "MainAbility" + ], + "when":"inuse" + } + } + ] + } + } + ``` + +2. 创建悬浮窗。 + 通过`window.create`接口创建悬浮窗类型的窗口。 + +3. 对悬浮窗进行属性设置等操作。 + 悬浮窗窗口创建成功后,可以改变其大小、位置等,还可以根据应用需要设置悬浮窗背景色、亮度等属性。 + +4. 加载显示悬浮窗的具体内容。 + 通过`loadContent`和`show`接口加载显示悬浮窗的具体内容。 + +5. 销毁悬浮窗。 + + 当不再需要悬浮窗时,可根据具体实现逻辑,使用`destroy`接口销毁悬浮窗。 + + ```ts + import Ability from '@ohos.application.Ability' + import ExtensionContext from '@ohos.application.ServiceExtensionAbility'; + import window from '@ohos.window'; + + class MainAbility extends Ability { + onWindowStageCreate(windowStage) { + // 2. 创建悬浮窗。 + var windowClass = null; + window.create(this.context, "floatWindow", window.WindowType.TYPE_FlOAT, (err, data) => { + if (err.code) { + console.error('Failed to create the floatWindow. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in creating the floatWindow. Data: ' + JSON.stringify(data)); + windowClass = data; + // 3.悬浮窗窗口创建成功后,设置悬浮窗的位置、大小及相关属性等。 + windowClass.moveTo(300, 300, (err, data) => { + if (err.code) { + console.error('Failed to move the window. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in moving the window. Data: ' + JSON.stringify(data)); + }); + windowClass.resetSize(500, 1000, (err, data) => { + if (err.code) { + console.error('Failed to change the window size. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in changing the window size. Data: ' + JSON.stringify(data)); + }); + // 4.为悬浮窗加载对应的目标页面。 + windowClass.loadContent("pages/page4", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)); + // 4.显示悬浮窗。 + windowClass.show((err, data) => { + if (err.code) { + console.error('Failed to show the window. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in showing the window. Data: ' + JSON.stringify(data)); + }); + }); + //5.销毁悬浮窗。当不再需要悬浮窗时,可根据具体实现逻辑,使用destroy对其进行销毁,此处以监听窗口区域外的点击事件为例实现悬浮窗的销毁。 + windowClass.on('touchOutside', () => { + console.info('touch outside'); + windowClass.destroy((err, data) => { + if (err.code) { + console.error('Failed to destroy the window. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in destroying the window. Data: ' + JSON.stringify(data)); + }); + }); + }); + } + }; + ``` diff --git a/zh-cn/application-dev/windowmanager/figures/windowMode.png b/zh-cn/application-dev/windowmanager/figures/windowMode.png new file mode 100644 index 0000000000000000000000000000000000000000..6d4b793d46343ff33efec41ce90c7418ba2fe779 Binary files /dev/null and b/zh-cn/application-dev/windowmanager/figures/windowMode.png differ diff --git a/zh-cn/application-dev/windowmanager/system-window-stage.md b/zh-cn/application-dev/windowmanager/system-window-stage.md new file mode 100644 index 0000000000000000000000000000000000000000..d602dad84a919ff9a0823616f5b808b6980e3008 --- /dev/null +++ b/zh-cn/application-dev/windowmanager/system-window-stage.md @@ -0,0 +1,112 @@ +# 管理系统窗口(仅Stage模型支持) + +## 管理系统窗口概述 + +在`Stage`模型下, 允许系统应用创建和管理系统窗口,包括音量条、壁纸、通知栏、状态栏、导航栏等。具体支持的系统窗口类型见[API参考-WindowType](../reference/apis/js-apis-window.md)。 + + +## 接口说明 + +更多API说明请参见[API参考](../reference/apis/js-apis-window.md)。 + +| 实例名 | 接口名 | 描述 | +| -------- | -------- | -------- | +| window静态方法 | create(ctx:Context,id:string,type:WindowType,callback:AsyncCallback<Window>):void | 创建窗口。
-`ctx`:为应用上下文信息。当`Context`为[ServiceExtensionContext](../reference/apis/js-apis-service-extension-context.md)时,创建系统窗口。
-`type`:为创建的窗口类型。 | +| Window | resetSize(width:number,height:number,callback:AsyncCallback<void>):void | 改变当前窗口大小。 | +| Window | moveTo(x:number,y:number,callback:AsyncCallback<void>):void | 移动当前窗口位置。 | +| Window | loadContent(path:string,callback:AsyncCallback<void>):void | 为当前窗口加载具体页面。 | +| Window | show(callback: AsyncCallback\): void | 显示当前窗口。 | +| Window | on(type:'touchOutside',callback:Callback<void>):void | 开启本窗口区域外的点击事件的监听。 | +| Window | hide (callback: AsyncCallback\): void | 隐藏当前窗口。此接口为系统接口。 | +| Window | destroy(callback: AsyncCallback<void>):void | 销毁当前窗口。 | + + +## 开发步骤 + + +本文以音量条窗口为例,介绍系统窗口的基本开发和管理步骤。 + + +1. 创建系统窗口。 + + 在[ServiceExtensionContext](../reference/apis/js-apis-service-extension-context.md)下,使用`window.create`接口创建音量条系统窗口。 + +2. 操作或设置系统窗口的属性。 + + 系统窗口创建成功后,可以改变其大小、位置等,还可以根据需要设置系统窗口的背景色、亮度等属性。 + +3. 加载显示系统窗口的具体内容。 + + 通过`loadContent`和`show`接口加载显示音量条窗口的具体内容。 + +4. 隐藏/销毁系统窗口。 + + 当不再需要音量条窗口时,可根据具体实现逻辑,使用`hide`接口或`destroy`接口对其进行隐藏或销毁。 + +```ts +import ExtensionContext from '@ohos.application.ServiceExtensionAbility'; +import window from '@ohos.window'; + +var windowClass = null; + +export default class ServiceExtensionAbility1 extends ExtensionContext { + onCreate(want) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + // 1.创建音量条窗口。 + var windowClass = null; + window.create(this.context, "volume", window.WindowType.TYPE_VOLUME_OVERLAY, (err, data) => { + if (err.code) { + console.error('Failed to create the volume window. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in creating the volume window.') + windowClass = data; + // 2.创建音量条窗口成功之后,可以改变其大小、位置或设置背景色、亮度等属性。 + windowClass.moveTo(300, 300, (err, data) => { + if (err.code) { + console.error('Failed to move the window. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in moving the window. Data: ' + JSON.stringify(data)); + }); + windowClass.resetSize(500, 1000, (err, data) => { + if (err.code) { + console.error('Failed to change the window size. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in changing the window size. Data: ' + JSON.stringify(data)); + }); + // 3.为音量条窗口加载对应的目标页面。 + windowClass.loadContent("pages/page_volume", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)); + // 3.显示音量条窗口。 + windowClass.show((err, data) => { + if (err.code) { + console.error('Failed to show the window. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in showing the window. Data: ' + JSON.stringify(data)); + }); + }); + // 4.隐藏/销毁音量条窗口。当不再需要音量条时,可根据具体实现逻辑,对其进行隐藏或销毁。 + // 此处以监听音量条区域外的点击事件为例实现音量条窗口的隐藏。 + windowClass.on('touchOutside', () => { + console.info('touch outside'); + windowClass.hide((err, data) => { + if (err.code) { + console.error('Failed to hide the window. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in hidinging the window. Data: ' + JSON.stringify(data)); + }); + }); + }); + } +}; +``` + diff --git a/zh-cn/application-dev/windowmanager/window-guidelines.md b/zh-cn/application-dev/windowmanager/window-guidelines.md deleted file mode 100644 index 7758fec39628b8c33c9b6b17f9ccb86e9fec2d60..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/windowmanager/window-guidelines.md +++ /dev/null @@ -1,107 +0,0 @@ -# 窗口开发指导 - -## 场景介绍 -窗口的接口层在应用进程运行,负责对页面布局的加载,和提供应用程序接口。 -通过调用窗口接口可以实现窗口创建与销毁,窗口的位置、大小布局,以及进入沉浸式等。 - -## 接口说明 -窗口开放的能力如下:Window类,具体的API详见[接口文档](../reference/apis/js-apis-window.md)。 - -**表1** 窗口主要接口API - -| 接口名 | 描述 | -| :----------------------------------------------------------- | :--------------------------------------------- | -| create(id: string, type: WindowType, callback: AsyncCallback\): void | 创建子窗口。 | -| moveTo(x: number, y: number): Promise\ | 移动窗口位置,x值为正表示右移,y为正表示下移。 | -| resetSize(width: number, height: number): Promise\ | 改变当前窗口大小。 | -| hide(): Promise\ | 隐藏当前窗口。 | -| destroy(): Promise\ | 销毁当前窗口。 | - -## 开发步骤 - -### 创建主窗口 - -在当前模型下,应用启动时会自动创建主窗口,由应用管理窗口的生命周期,隐藏及销毁由应用管理。 -### 创建子窗口 -当前可以通过`create`接口创建子窗口。具体示例代码如下: - -```js - import window from '@ohos.window'; - var windowClass = null; - let promise = window.create("subWindow", window.WindowType.TYPE_APP); - promise.then((data)=> { - windowClass = data; - console.info('SubWindow created. Data: ' + JSON.stringify(data)) - }).catch((err)=>{ - console.error('Failed to create the subWindow. Cause: ' + JSON.stringify(err)); - }); -``` - -### 获取窗口对象 - -- 应用内可以通过`getTopWindow`来获取当前应用内最后显示的窗口。具体示例代码如下: - -```js - var windowClass = null; - let promise = window.getTopWindow(); - promise.then((data)=> { - windowClass = data; - console.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data)) - }).catch((err)=>{ - console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err)); - }) -``` - -- 应用内也可以通过`Find`来获取已经创建的子窗口。具体示例代码如下: - -```js - var windowClass = null; - let promise = window.find("subWindow"); - promise.then((data)=> { - windowClass = data; - console.info('window found. Data: ' + JSON.stringify(data)) - }).catch((err)=>{ - console.error('Failed to find the Window. Cause: ' + JSON.stringify(err)); - }); -``` - -### 窗口的隐藏和销毁 - -在已经获取到窗口对象的前提下,可以调用`hide`、`destroy`来隐藏和销毁已经创建的窗口对象。具体示例代码如下: - -```js - let promise = windowClass.hide(); - promise.then((data)=> { - console.info('window hidden. Data: ' + JSON.stringify(data)) - windowClass.destroy((err, data) => { - if (err.code) { - console.error('Failed to destroy the window. Cause:' + JSON.stringify(err)); - return; - } - console.info('Succeeded in destroying the window. Data: ' + JSON.stringify(data)) - }) - }).catch((err)=>{ - console.error('Failed to hide the window. Cause: ' + JSON.stringify(err)); - }) -``` - -### 设置沉浸式窗口 - -在已经获取到应用窗口对象的前提下,调用`setFullScreen`来设置窗口进入全屏沉浸式。 - -示例代码如下: - -```js -import window from '@ohos.window'; -try { - const win = await window.getTopWindow() - await win.setFullScreen(true) -} catch (err) { - console.log(`setFullScreen fail, code = ${err.code}`) -} -``` - -## 相关实例 -针对窗口开发,有以下相关实例可供参考: -- [`Window`:窗口(eTS)(API9)](https://gitee.com/openharmony/app_samples/tree/master/Graphics/Window) - diff --git a/zh-cn/application-dev/windowmanager/window-overview.md b/zh-cn/application-dev/windowmanager/window-overview.md index 72f7a17f350a53dc5e56eb3203aa383c1263a306..f3e2ba39243ce42c7052249b967d9467550f8715 100644 --- a/zh-cn/application-dev/windowmanager/window-overview.md +++ b/zh-cn/application-dev/windowmanager/window-overview.md @@ -1,13 +1,75 @@ # 窗口开发概述 -**窗口子系统**提供窗口管理的基础能力,是系统图形界面显示所需的基础子系统。 -窗口系统的作用,是提供一种机制,让多个应用界面复用同一块物理屏幕进行显示和交互。每个应用程序中,需要实现固定窗口区域内的交互界面设计,窗口作用应用界面的显示容器,而窗口系统负责将这些交互界面组织成最终用户见到的形态。 + +## 窗口模块的定义 + +窗口模块用于在同一块物理屏幕上,提供多个应用界面显示、交互的机制。 + +- 对应用开发者而言,窗口模块提供了界面显示和交互能力。 + +- 对终端用户而言,窗口模块提供了控制应用界面的方式。 + +- 对整个操作系统而言,窗口模块提供了不同应用界面的组织管理逻辑。 + + +## 窗口模块的用途 + +在OpenHarmony中,窗口模块主要负责以下职责: + +- 提供应用和系统界面的窗口对象。应用开发者通过窗口加载UI界面,实现界面显示功能。 + +- 组织不同窗口的显示关系,即维护不同窗口间的叠加层次和位置属性。应用和系统的窗口具有多种类型,不同类型的窗口具有不同的默认位置和叠加层次(Z轴高度)。同时,用户操作也可以在一定范围内对窗口的位置和叠加层次进行调整。 + +- 提供窗口装饰。窗口装饰指窗口标题栏和窗口边框。窗口标题栏通常包括窗口最大化、最小化及关闭按钮等界面元素,具有默认的点击行为,方便用户进行操作;窗口边框则方便用户对窗口进行拖拽缩放等行为。窗口装饰是系统的默认行为,开发者可选择启用/禁用,无需关注UI代码层面的实现。 + +- 提供窗口动效。在窗口显示、隐藏及窗口间切换时,窗口模块通常会添加动画效果,以使各个交互过程更加连贯流畅。在OpenHarmony中,应用窗口的动效为默认行为,不需要开发者进行设置或者修改。 + +- 指导输入事件分发。即根据当前窗口的状态或焦点,进行事件的分发。触摸和鼠标事件根据窗口的位置和尺寸进行分发,而键盘事件会被分发至焦点窗口。应用开发者可以通过窗口模块提供的接口设置窗口是否可以触摸和是否可以获焦。 + ## 基本概念 -**沉浸式**:应用窗口跟状态栏与导航栏颜色一致,视觉上融合。 +### 窗口类型 + +OpenHarmony的窗口模块将窗口界面分为系统窗口、应用窗口两种基本类型。 + +- 系统窗口 + 系统窗口指完成系统特定功能的窗口。如音量条、壁纸、通知栏、状态栏、导航栏等。 + +- 应用窗口 + 应用窗口区别于系统窗口,指与应用显示相关的窗口。根据显示内容的不同,应用窗口又分为应用主窗口、应用子窗口两种类型。 + + - 应用主窗口 + 应用主窗口用于显示应用界面,会在"任务管理界面"显示。 + - 应用子窗口 + 应用子窗口用于显示应用的弹窗、悬浮窗等辅助窗口,不会在"任务管理界面"显示。 + + +### 应用窗口模式 + +应用窗口模式指应用主窗口启动时的显示方式。OpenHarmony目前支持全屏、分屏、自由窗口三种应用窗口模式。这种对多种应用窗口模式的支持能力,也称为操作系统的“多窗口能力”。 + + +- 全屏:应用主窗口启动时铺满整个屏幕。 + +- 分屏:应用主窗口启动时占据屏幕的某个部分,当前支持二分屏。两个分屏窗口之间具有分界线,可通过拖拽分界线调整两个部分的窗口尺寸。 + +- 自由窗口:自由窗口的大小和位置可自由改变。同一个屏幕上可同时显示多个自由窗口,这些自由窗口按照打开或者获取焦点的顺序在Z轴排布。当自由窗口被点击或触摸时,将导致其Z轴高度提升,并获取焦点。 + + +![windowMode](figures/windowMode.png) + + +## 实现原理 + +当前窗口的实现和开发与应用开发模型相关联,不同模型下的接口功能略有区别。当前应用开发模型分为FA模型和Stage模型。 + +两个模型的整体架构和设计思想,详见[FA模型综述](../ability/fa-brief.md)和[Stage模型综述](../ability/stage-brief.md)。 + +针对窗口开发,推荐使用Stage模型进行相关开发。 + -## 运作机制 +## 约束与限制 -为了将图形界面显示在屏幕上,应用和系统需要向窗口系统申请窗口对象,这通常代表了屏幕上一块矩形区域,具有位置、宽高、和叠加层次等属性。同时,窗口对象也负责加载界面中UI框架的根节点,应用程序的UI界面就通过这个根节点在窗口中加载显示。 \ No newline at end of file +在FA模型下,不支持系统窗口的相关开发。 diff --git a/zh-cn/contribute/style-guide/style-guide-content-elements.md b/zh-cn/contribute/style-guide/style-guide-content-elements.md index 9c37acd761509c61be5f8d0db3dc1002b7429fdc..b984629d236de6c4015dd4b7769077b4a6842011 100755 --- a/zh-cn/contribute/style-guide/style-guide-content-elements.md +++ b/zh-cn/contribute/style-guide/style-guide-content-elements.md @@ -144,11 +144,11 @@ 【规则】将链接URL写入内容,而不是直接在页面中暴露URL地址。 -- 链接到其他手册、页面内容:\[术语](glossary/glossary.md) +- 链接到其他手册、页面内容:\[术语]\(glossary/glossary.md) -- 链接到本页面内其他内容段落:\[FAQ](#faq) +- 链接到本页面内其他内容段落:\[FAQ]\(#faq) -- 链接到其他站点:\[示例](www.example.com) +- 链接到其他站点:\[示例]\(www.example.com) | **正例** | **反例** | | -------- | -------- | diff --git a/zh-cn/contribute/template/js-template.md b/zh-cn/contribute/template/js-template.md index ccb96104956321a6a1ecefb76aa7cdbd02c6044d..5a38bc05af08e7d08ff96938d3ee4f4567f63a83 100644 --- a/zh-cn/contribute/template/js-template.md +++ b/zh-cn/contribute/template/js-template.md @@ -74,7 +74,7 @@ ArrayList和LinkedList相比,ArrayList的随机访问效率更高。但由于A > 1. 根据实际情况填写导入模块。采用代码段的样式,给出import语句。 > > 2. 如果没有导入模块,将“导入模块”修改为“使用说明”。
使用说明案例:
-> 在使用AbilityContext的功能前,需要通过[getContext()](链接到对应的接口说明文件中.md)先获取Context对象。 +> 在使用AbilityContext的功能前,需要通过\[getContext()]\(链接到对应的接口说明文件中.md)先获取Context对象。 > > ```js > import ability_featureAbility from '@ohos.ability.featureAbility'; diff --git "a/zh-cn/contribute/\350\264\241\347\214\256\346\226\207\346\241\243.md" "b/zh-cn/contribute/\350\264\241\347\214\256\346\226\207\346\241\243.md" index dfcd8a51758adb85cfabaf70b1adc26025f77b68..a5a9bd99d8f20247f68efa03b5e067ee65f2f76c 100755 --- "a/zh-cn/contribute/\350\264\241\347\214\256\346\226\207\346\241\243.md" +++ "b/zh-cn/contribute/\350\264\241\347\214\256\346\226\207\346\241\243.md" @@ -63,8 +63,8 @@ 鼓励开发者在学习、开发过程中,总结经验并创建技术内容帮助更多开发者快速上手。推荐输出各类How to教程、常见问题FAQ等。请参考如下写作模板: -- [How to教程](template/tutorial-template.md):贡献至`contribute/tutorial`文件夹下。 -- [FAQ](template/faq-template.md):贡献至`contribute/faqs`文件夹下。 +- [How to教程](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/template/tutorial-template.md):贡献至`contribute/tutorial`文件夹下。 +- [FAQ](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/template/faq-template.md):贡献至`contribute/faqs`文件夹下。 内容写作模板归档在Docs文档仓下contribute文件夹中。 diff --git a/zh-cn/design/hdi-design-specifications.md b/zh-cn/design/hdi-design-specifications.md index cf0db1e1c0ddd6e8fbc1bf290946cc0ce8e1a9c6..036d191fa13983763271425d39187296306c39b4 100644 --- a/zh-cn/design/hdi-design-specifications.md +++ b/zh-cn/design/hdi-design-specifications.md @@ -24,6 +24,7 @@ | 版本 | 变更说明 | | --- | --------------------- | | v1.0 Beta | 初始试行版本 | +| v1.0 | 发布正式版本 | ## 范围与定义 @@ -85,13 +86,13 @@ interface IVibrator { Table 1 接口评审&管控角色 -| **涉及角色** | **API治理中的职责** | +| **涉及角色** | **HDI接口治理中的职责** | | ----------- | ------------------------------------------------ | -| Contributor | API的设计和交付主体,负责API相关的代码与设计文档提交。 | -| Committer | API相关的代码评审,涉及API提交预审。 | -| 领域SIG | 新增API相关的代码提交评审,领域SIG评审通过即可合入。
变更API相关的代码提交预审。 | -| Driver SIG | 变更API相关的代码提交评审。 | -| PMC | API Version计划发布、API治理章程修订评审发布等。 | +| Contributor | HDI的设计和交付主体,负责HDI相关的代码与设计文档提交。 | +| Committer | HDI相关的代码评审,涉及HDI提交预审。 | +| 领域SIG | 新增/变更HDI相关的代码提交,本领域SIG首先进行评审。 | +| Driver SIG | 新增/变更HDI相关的代码提交评审。 | +| PMC | HDI设计规范修订评审发布等。 | #### 设备接口发布 @@ -101,8 +102,8 @@ Table 1 接口评审&管控角色 主要过程说明: - 1. HDI评审申请、代码提交(Owner:Contributor),所有涉及HDI新增或变更需同步提交相应的API评审文档,详细说明API的需求来源、场景与使用方法、权限设计、隐私保护澄清等,详见后面的API评审申请要素。为避免后续的返工,Contributor可以在正式的API评审申请、代码提交之前,先通过邮件方式将API设计文档提交Committer、领域SIG、API SIG等相关人员预审。 - 2. 代码评审(Owner:Committer),代码评审和API预审,涉及API提交Code Review通过后,还需要进一步领域SIG评审。 + 1. HDI评审申请、代码提交(Owner:Contributor),所有涉及HDI新增或变更需同步提交相应的HDI评审文档,详细说明HDI的需求来源、场景与使用方法、权限设计、隐私保护澄清等,详见后面的评审申请要素。为避免后续的返工,Contributor可以在正式的HDI评审申请、代码提交之前,先通过邮件方式将HDI相关设计文档提交Committer、领域SIG、Driver SIG等相关人员预审。 + 2. 代码评审(Owner:Committer),代码评审和接口预审,涉及HDI的提交Code Review通过后,还需要进一步领域SIG评审。 3. 领域SIG评审(Owner:领域SIG),涉及新增/变更HDI相关接口的代码提交,领域SIG评审通过后,还需要进一步提交Driver SIG。 4. HDI评审(Owner:Driver SIG),对新增/变更HDI相关的代码提交进行接口评审,评审通过即可合入代码。 5. 评审完成。 @@ -131,7 +132,7 @@ Table 1 接口评审&管控角色 - 对废弃接口增加标识废弃标记。 - - 废弃API至少保留4个OpenHarmony API版本 + - 废弃HDI至少保留4个OpenHarmony API版本 ## 接口设计约束 @@ -484,7 +485,3 @@ GetExecutorInfo([out] struct ExecutorInfo executorInfo); | ------- | ------- | ------ | | struct | struct | struct | | enum | enum | enum | - - -## 其他说明 -本文档Beta期为自发布日起1个月,用于接纳社区意见,欢迎积极参与讨论。 \ No newline at end of file diff --git a/zh-cn/readme/figures/location_En-1.png b/zh-cn/readme/figures/location_En-1.png new file mode 100644 index 0000000000000000000000000000000000000000..1ae4bcd7173f2e95004c96fa13d420c09f017f76 Binary files /dev/null and b/zh-cn/readme/figures/location_En-1.png differ diff --git a/zh-cn/readme/figures/location_zh-1.png b/zh-cn/readme/figures/location_zh-1.png new file mode 100644 index 0000000000000000000000000000000000000000..3638a47483ec2e0f0d8443e3ab2410b333886118 Binary files /dev/null and b/zh-cn/readme/figures/location_zh-1.png differ diff --git "a/zh-cn/readme/\344\275\215\347\275\256\346\234\215\345\212\241\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/\344\275\215\347\275\256\346\234\215\345\212\241\345\255\220\347\263\273\347\273\237.md" index f81dde216f81508fa6e245e81875eee8ee97947b..62c1be27a8e6dda14147674172ed944bdd361cbe 100644 --- "a/zh-cn/readme/\344\275\215\347\275\256\346\234\215\345\212\241\345\255\220\347\263\273\347\273\237.md" +++ "b/zh-cn/readme/\344\275\215\347\275\256\346\234\215\345\212\241\345\255\220\347\263\273\347\273\237.md" @@ -15,9 +15,9 @@ 当用户处于这些丰富的使用场景中时,系统的位置能力可以提供实时准确的位置数据。对于开发者,设计基于位置体验的服务,也可以使应用的使用体验更贴近每个用户。 -当应用在实现基于设备位置的功能时,如:驾车导航,记录运动轨迹等,可以调用该模块的API接口,完成位置信息的获取 +当应用在实现基于设备位置的功能时,如:驾车导航,记录运动轨迹等,可以调用该模块的API接口,完成位置信息的获取。 -基本概念 +**基本概念** 位置能力用于确定用户设备在哪里,系统使用位置坐标标示设备的位置,并用多种定位技术提供服务,如GNSS定位、基站定位、WLAN/蓝牙定位(基站定位、WLAN/蓝牙定位后续统称“网络定位技术”)。通过这些定位技术,无论用户设备在室内或是户外,都可以准确地确定设备位置。 @@ -40,7 +40,7 @@ **图 1** **子系统架构图** -![](figures/zh-1.png) +![](figures/location_zh-1.png) ## 目录 @@ -127,7 +127,7 @@ 开发者可以在应用config.json文件中声明所需要的权限,示例代码如下: - + ``` { "module": { @@ -148,7 +148,7 @@ 配置字段详细说明见[应用包结构配置文件的说明](../application-dev/quick-start/stage-structure.md)。 2. 导入geolocation模块,所有与基础定位能力相关的功能API,都是通过该模块提供的。 - + ``` import geolocation from '@ohos.geolocation'; ``` @@ -159,7 +159,7 @@ 为了面向开发者提供贴近其使用场景的API使用方式,系统定义了几种常见的位置能力使用场景,并针对使用场景做了适当的优化处理,应用可以直接匹配使用,简化开发复杂度。系统当前支持场景如下表所示。 - + ``` export enum LocationRequestScenario { UNSET = 0x300, @@ -171,7 +171,7 @@ } ``` - + **表2** 定位场景类型说明 | 场景名称 | 常量定义 | 说明 | @@ -183,7 +183,7 @@ | 无功耗场景 | NO_POWER | 无功耗场景,适用于不需要主动启动定位业务。系统在响应其他应用启动定位业务并上报位置结果时,会同时向请求此场景的应用程序上报定位结果,当前的应用程序不产生定位功耗。
此场景默认以最小1秒间隔上报定位结果,并且应用需要申请ohos.permission.LOCATION权限,同时获得用户授权。 | 以导航场景为例,实例化方式如下: - + ``` var requestInfo = {'scenario': 0x301, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0}; ``` @@ -192,7 +192,7 @@ 如果定义的现有场景类型不能满足所需的开发场景,系统提供了基本的定位优先级策略类型。 - + ``` export enum LocationRequestPriority { UNSET = 0x200, @@ -202,7 +202,7 @@ } ``` - + **表3** 定位优先级策略类型说明: | 策略类型 | 常量定义 | 说明 | @@ -212,7 +212,7 @@ | 低功耗定位优先策略 | LOW_POWER | 低功耗定位优先策略主要使用基站定位和WLAN、蓝牙定位技术,也可以同时提供室内和户外场景下的位置服务,因为其依赖周边基站、可见WLAN、蓝牙设备的分布情况,定位结果的精度波动范围较大,如果对定位结果精度要求不高,或者使用场景多在有基站、可见WLAN、蓝牙设备高密度分布的情况下,推荐使用,可以有效节省设备功耗。
应用至少申请ohos.permission.LOCATION权限,同时获得用户授权。 | 以定位精度优先策略为例,实例化方式如下: - + ``` var requestInfo = {'priority': 0x201, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0}; ``` @@ -227,19 +227,19 @@ ``` 5. 启动定位。 - + ``` geolocation.on('locationChange', requestInfo, locationChange); ``` 6. (可选)结束定位。 - + ``` geolocation.off('locationChange', locationChange); ``` 如果应用使用场景不需要实时的设备位置,可以获取系统缓存的最近一次历史定位结果。 - + ``` geolocation.getLastLocation((data) => { console.log('getLastLocation: data: ' + JSON.stringify(data)); @@ -256,14 +256,14 @@ > GeoConvert需要访问后端服务,请确保设备联网,以进行信息获取。 1. 导入geolocation模块,所有与(逆)地理编码转化能力相关的功能API,都是通过该模块提供的。 - + ``` import geolocation from '@ohos.geolocation'; ``` 2. 获取转化结果。 - 调用getAddressesFromLocation,坐标转化地理位置信息。 - + ``` var reverseGeocodeRequest = {"latitude": 31.12, "longitude": 121.11, "maxItems": 1}; geolocation.getAddressesFromLocation(reverseGeocodeRequest, (data) => { @@ -273,7 +273,7 @@ 参考接口API说明,应用可以获得与此坐标匹配的GeoAddress列表,应用可以根据实际使用需求,读取相应的参数数据。 - 调用getAddressesFromLocationName位置描述转化坐标。 - + ``` var geocodeRequest = {"description": "上海市浦东新区xx路xx号", "maxItems": 1}; geolocation.getAddressesFromLocationName(geocodeRequest, (data) => { diff --git a/zh-cn/release-notes/OpenHarmony-v3.2-beta2.md b/zh-cn/release-notes/OpenHarmony-v3.2-beta2.md index 3eb8da4befa96166c8a54de10b512f504ecfcc05..18992d1e2478d51993d4cf7f1d2ee9bd90897428 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.2-beta2.md +++ b/zh-cn/release-notes/OpenHarmony-v3.2-beta2.md @@ -148,7 +148,7 @@ | 泛Sensor服务子系统 | - 支持更多类型的传感器上报。
- 支持SELinux。
主要涉及如下需求:
I53SFI 【DFX打点】【泛Sensor服务子系统】提供系统事件、SA dump、trace打点
I537CB 【新增规格】泛Sensor能力持续集成-旋转矢量传感器
I537AN 【新增规格】泛Sensor能力持续集成-重力传感器
I5379T 【新增规格】泛Sensor能力持续集成-地磁传感器
I5379C 【新增规格】泛Sensor能力持续集成-方向传感器
I53784 【新增规格】泛Sensor能力持续集成-环境光传感器
I53SFS 【新增规格】【泛Sensor服务】SELinux策略配置 | NA | | 分布式数据管理子系统 | data_share支持多种数据类型。
主要涉及如下需求:
I5EHGF 【DataShare】DataShare支持多种数据储存类型 | NA | | web子系统 | - 新增支持JS相关交互能力。
- 新增支持网络、键鼠、webstorage、SELinux策略等能力。
主要涉及如下需求:
I5DM1E 【新增规格】web组件的JS窗口管理
I5DNG2 【新增规格】JS侧提供全量hittest接口以及DefaultUserAgent获取
I5EK53 【新增规格】【web子系统】web组件http验证管理
I5EGBB 【新增规格】【web子系统】【web部件】web子系统的SELinux策略配置
I5EBG1 【新增规格】【web子系统】web子系统适配w3c network information api
I5EVEC 【新增规格】【web子系统】web内核对接鼠标、键盘等外设能力
I5FF2L 【新增规格】【web子系统】web组件支持webstorage | NA | -| 驱动子系统 | - 支持内核态驱动动态加载及DFX能力。
- 提供Codec2.0接口及codec驱动模型。
- Camera、Display、Audio、Sensor、Wlan等模块驱动能力增强。
主要涉及如下需求:
I536FN 【新增特性】【驱动子系统】支持HDI passthrougt模式
I5DJE5 【增强特性】兼容Linux uevent事件上报机制,增强设备即插即用功能
I550OL 【新增特性】提供DFX跟踪定位,获取信息能力
I544XP 【新增特性】支持HDF服务SELinux权限检查 标准系统
I528DG 【新增特性】支持Codec 2.0参考实现,简化适配难度
I50I6S 【新增特性】Audio新增IPC模式与直调模式接口调用统一
I5A6H6 【增强特性】增强显示设备管理,支持多屏显示能力
I5B0C5 【新增特性】Camera支持实现Mate类型的流
I5B0BR 【新增特性】录像模式自拍镜像功能
I5AJW1 【新增特性】支持Linux libALSA音频接口兼容
I56V2N 【新增特性】HDF WLAN DAL HDI功率模式相关接口的定义与开发
I5F411 【增强特性】马达效果能力增强 | NA | +| 驱动子系统 | - 支持内核态驱动动态加载及DFX能力。
- 提供Codec2.0接口及codec驱动模型。
- Camera、Display、Audio、Sensor、WLAN等模块驱动能力增强。
主要涉及如下需求:
I536FN 【新增特性】【驱动子系统】支持HDI passthrougt模式
I5DJE5 【增强特性】兼容Linux uevent事件上报机制,增强设备即插即用功能
I550OL 【新增特性】提供DFX跟踪定位,获取信息能力
I544XP 【新增特性】支持HDF服务SELinux权限检查 标准系统
I528DG 【新增特性】支持Codec 2.0参考实现,简化适配难度
I50I6S 【新增特性】Audio新增IPC模式与直调模式接口调用统一
I5A6H6 【增强特性】增强显示设备管理,支持多屏显示能力
I5B0C5 【新增特性】Camera支持实现Mate类型的流
I5B0BR 【新增特性】录像模式自拍镜像功能
I5AJW1 【新增特性】支持Linux libALSA音频接口兼容
I56V2N 【新增特性】HDF WLAN DAL HDI功率模式相关接口的定义与开发
I5F411 【增强特性】马达效果能力增强 | NA | | USB服务子系统 | - 支持USB服务广播消息。
- 增加SELinux安全策略。
主要涉及如下需求:
I59MYK 【新增特性】USB服务广播消息
I5AR8N 【新增规格】【USB服务子系统】USB服务子系统的SELinux策略配置 | NA | | 内核子系统 | - 新增支持内存精细化管控特性。
- 新增支持关联服务adj调整机制。
主要涉及如下需求:
I58LOD 【新增特性】支持关联服务adj调整机制
I54Y5J 【新增特性】支持memtrack内存占用和进程维度adj查询接口特性
I56B3Q 【新增特性】支持OnMemoryLevel特性
I5B694 【新增特性】支持新型内存精细化管控特性
I59O8H 【新增特性】支持purgable memory特性
I5CXOK 【新增特性】支持hyperhold可靠性提升特性 | NA | diff --git a/zh-cn/release-notes/api-change/template/changelog-x-x.md b/zh-cn/release-notes/api-change/template/changelog-x-x.md index abf59c77cba59f171efbb6121e24f238516ad50e..b20dbfc1fc13ba0dc94a8044119ac0ae2473cfb7 100644 --- a/zh-cn/release-notes/api-change/template/changelog-x-x.md +++ b/zh-cn/release-notes/api-change/template/changelog-x-x.md @@ -1,14 +1,17 @@ -# ChangeLog -## xxx子系统(该段落为示例,请不要修改或删除) -已经release的版本发生了影响契约兼容性(契约兼容:也称语义兼容,指版本演进后,开发者原有程序行为不发生变化)的变更(包括不限于接口名、参数、返回值、所需要的权限、调用顺序、枚举值、配置参数、路径等),则需要在ChangeLog中对变更进行阐述。 -### cl.subsystemname.x xxx功能变更, 例:DeviceType属性变更、相机权限变更(尽量概括,不要超过15个字) -每个变更标题前需要附加编号:cl.subsystemname.x。cl为ChangeLog首字母缩写,subsystemname请填写子系统英文标准名称,x表示变更序号(从低到高逐位增加)。 +# xxx子系统ChangeLog + +相比最近一个发布版本(包括不限于LTS、Release、Beta、monthly版本)发生了影响契约兼容性(契约兼容:也称语义兼容,指版本演进后,开发者原有程序行为不发生变化)的变更(包括不限于接口名、参数、返回值、所需要的权限、调用顺序、枚举值、配置参数、路径等),则需要在ChangeLog中对变更进行阐述。 + +## cl.subsystemname.x xxx功能变更, 例:DeviceType属性变更、相机权限变更(尽量概括,不要超过15个字) + +每个变更标题前需要附加编号:cl.subsystemname.x。cl为ChangeLog首字母缩写,subsystemname请填写子系统英文标准名称,x表示变更序号(从低到高逐位增加,起始为1)。 以功能维度对变更点进行概括描述。例如:xxx功能的xxx、xxx等发生了xxx变化,开发者需要根据以下说明对应用进行适配。 如果有此变更有对应的需求或设计文档,可以在描述中附上对应的设计文档编号。 **变更影响** -是否影响已release的接口或者接口行为发生变更等;影响的是JS接口、Java接口还是Native接口。 +是否影响已发布的接口或者接口行为发生变更,影响的是JS接口还是Native接口。 +是否影响在此前版本已开发的应用,即应用是否需要进行适配动才可以在新版本SDK环境正常编译通过。 **关键的接口/组件变更** @@ -16,15 +19,13 @@ **适配指导(可选,不涉及则可以删除)** -(前面空一行)提供指导,帮助开发者针对相关变更进行适配,使应用可以与新版本兼容。例: +提供指导,帮助开发者针对相关变更进行适配,使应用可以与新版本兼容。 +例: 在xxx文件中将xxx参数修改为xxx。 + ``` sample code ``` -### cl.subsystemname.x xxx功能变更 -每个功能变更点在自己的子系统章节内新增一个功能变更章节。 -## xxx子系统 -每个子系统有且只能有一个子系统章节。 diff --git a/zh-cn/release-notes/api-change/v3.2-beta2/native-apidiff-v3.2-beta2.md b/zh-cn/release-notes/api-change/v3.2-beta2/native-apidiff-v3.2-beta2.md new file mode 100644 index 0000000000000000000000000000000000000000..b8e6c8a45ece7f1c7b9ea6d3c58297678af3a17d --- /dev/null +++ b/zh-cn/release-notes/api-change/v3.2-beta2/native-apidiff-v3.2-beta2.md @@ -0,0 +1,13 @@ +# Native API 差异报告 + +OpenHarmony 3.2 Beta2相较于OpenHarmony 3.2 Beta1版本的API变更如下: + +## 标准系统接口变更 + +| 模块名称 | 接口名称 | 变更类型 | 变更说明 | +| -------- | ------------------------------------------------------------ | -------- | ----------------------------------------------- | +| 包管理-BundleFramework | OH_NativeBundle_ApplicationInfo OH_NativeBundle_GetCurrentApplicationInfo() | 新增 | 获取当前应用的包名和指纹信息 | +| 图形-NativeWindow | int32_t OH_NativeWindow_NativeWindowSetScalingMode(OHNativeWindow *window, uint32_t sequence, OHScalingMode scalingMode) | 新增 | 新增通过NativeWindow设置缩放模式的接口 | +| 图形-NativeWindow | int32_t OH_NativeWindow_NativeWindowSetMetaData(OHNativeWindow *window, uint32_t sequence, int32_t size, const OHHDRMetaData *metaData) | 新增 | 新增通过NativeWindow设置HDR元数据的接口 | +| 图形-NativeWindow | int32_t OH_NativeWindow_NativeWindowSetMetaDataSet(OHNativeWindow *window, uint32_t sequence, OHHDRMetadataKey key, int32_t size, const uint8_t *metaData) | 新增 | 新增通过NativeWindow设置HDR元数据集的接口 | +| 图形-NativeWindow | int32_t OH_NativeWindow_NativeWindowSetTunnelHandle(OHNativeWindow *window, const OHExtDataHandle *handle) | 新增 | 新增通过NativeWindow设置tunnelhandle的接口 | \ No newline at end of file diff --git a/zh-cn/release-notes/changelog/v3.2-beta2/application-sandbox-adaptation-guide.md b/zh-cn/release-notes/changelog/v3.2-beta2/application-sandbox-adaptation-guide.md new file mode 100644 index 0000000000000000000000000000000000000000..7e7f81e258da29f05da52b4d9f61f855ad40269b --- /dev/null +++ b/zh-cn/release-notes/changelog/v3.2-beta2/application-sandbox-adaptation-guide.md @@ -0,0 +1,112 @@ +# OpenHarmony启用应用沙箱机制-适配指导 + +## 验证流程 + +![](figures/verification-process.png) + +1. 取发布版本自验证功能,如果功能正常,则适配流程结束。 +2. 取版本验证发现自身应用功能异常,则进行问题定位,通过分析代码识别到问题点,通过[适配流程](#适配流程)中的方法来进行文件访问模型的适配。 +3. 适配完毕之后,重新验证功能,功能正常则适配流程结束。功能依旧存在问题则重新回到第二步继续定位,直到问题解决为止。 + +## 适配流程 + +![](figures/adaptation-process.png) + +1. 定位出app异常的问题点之后,识别该问题是否是app源代码访问路径出错导致的,是否是访问有效文件可以通过下一章节的[沙箱文件访问规格清单](#沙箱文件访问规格清单)自查。 +2. 如果是app源码访问无效路径,则可以通过调整访问路径的策略,将原来访问/data目录从绝对路径访问方式调整为使用context接口进行访问,具体请见context接口使用说明: + https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/ability/context-userguide.md + https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-ability-context.md + https://gitee.com/OpenHarmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-Context.md +3. 如果是app调用三方模块,异常调用栈出现在三方模块中,而app源码没有使用绝对路径去访问文件,则适配过程如下: + - 通知三方模块,让其访问文件路径通过context接口进行访问而非使用绝对路径的方式。 + - 如果三方模块是个公共模块,除了给appspawn孵化的进程使用之外还给native进程使用,则可以将三方模块抽象成一个服务,应用通过ipc的方式去访问服务。 + +## 沙箱文件访问规格清单 + +**应用根目录访问路径清单** + +| 路径名 | 备注 | +| --------------------- | ------------------------------------------ | +| bin | 存放着各种二进制文件 | +| config | 配置目录 | +| data | 应用数据目录 | +| dev | 设备节点 | +| etc | /system/etc的软连接 | +| init | /system/bin/init的软连接 | +| lib | /system/lib的软连接 | +| mnt | 挂载目录 | +| proc | proc文件系统目录 | +| sys | sys文件系统目录 | +| sys_prod | 此目录不同设备上存在差异,部分设备无此目录 | +| system/app | 系统目录资源 | +| system/fonts | 系统文字资源 | +| system/lib | 系统库 | +| system/data | 系统目录资源 | +| system/usr | 系统目录资源 | +| system/profile | 系统目录资源 | +| system/bin | 系统程序 | +| system/etc | 系统配置 | +| vendor/lib/chipsetsdk | 芯片组件目录,目前仅挂载chipsetsdk | + +**应用数据目录访问路径清单** + +| 路径名 | 备注 | +| ---------------------------------- | ------------------------------------------------------------ | +| /data | 应用数据目录 | +| /data/storage | 应用数据 | +| /data/bundles | 所有应用安装目录,仅应用apl权限为BASIC及以上权限的应用可访问 | +| /data/storage/el1 | 应用el1加密级别数据目录 | +| /data/storage/el2 | 应用el2加密级别数据目录 | +| /data/storage/el1/base | 应用el1加密级别数据目录 | +| /data/storage/el1/bundles | 应用el1加密级别应用安装包目录 | +| /data/storage/el1/database | 应用el1加密级别数据库存储目录 | +| /data/storage/el2/base | 应用el2加密级别数据目录 | +| /data/storage/el2/database | 应用el2加密级别数据库存储目录 | +| /data/storage/el2/auth_groups | 应用el2加密级别无账号分布式数据融合目录 | +| /data/storage/el2/distributedfiles | 应用el2加密级别有账号分布式数据融合目录 | + +启用应用沙箱之后,应用命名空间内无法再访问物理路径下数据目录的访问方式,而是只能通过context接口来访问应用的数据目录,具体访问应用数据目录的方式可以通过context接口进行访问,参考[适配流程](#适配流程)中的context接口访问链接了解更多细节。 +应用的物理数据目录跟沙箱数据目录存储的是同一份应用的数据,通过bind mount技术进行关联,改动任意一处会影响另一处的数据。应用在命名空间下访问数据,只能通过沙箱路径来访问,下面列出应用的数据目录在物理路径跟沙箱路径下的对应关系。 + +**应用的数据目录在物理路径跟沙箱路径下的对应关系** + +| 物理路径 | 沙箱路径 | 备注 | +| ------------------------------------------------------------ | ---------------------------------- | --------------------------------------- | +| /data/app/el1/bundle/public/\\ | /data/storage/el1/bundle | 应用安装包目录 | +| /data/app/el1/\/base/\ | /data/storage/el1/base | 应用el1级别加密数据目录 | +| /data/app/el2/\/base/\ | /data/storage/el2/base | 应用el2级别加密数据目录 | +| /data/app/el1/\/database/\ | /data/storage/el1/database | 应用el1级别加密数据库目录 | +| /data/app/el2/\/database/\ | /data/storage/el2/database | 应用el2级别加密数据库目录 | +| /mnt/hmdfs/\/account/merge_view/data/\ | /data/storage/el2/distributedfiles | 应用el2加密级别有账号分布式数据融合目录 | +| /mnt/hmdfs/\/non_account/merge_view/data/ | /data/storage/el2/auth_groups | 应用el2加密级别无账号分布式数据融合目录 | +| /mnt/hmdfs/ | /mnt/hmdfs/ | 分布式文件系统目录 | + +> **说明:**
\代表当前的用户ID +> \代表当前的应用包名 + +更多物理路径沙箱路径的对应关系,请访问: +https://gitee.com/OpenHarmony/startup_appspawn/blob/master/appdata-sandbox64.json + +## 案例:Contacts.hap拨号场景无法触发音频问题 + +联系人应用沙箱整改前访问资源文件的方式如下,可以看到访问的路径是绝对路径硬编码,为/data/app/el1此类目录,而此类目录在应用沙箱中是访问受限的,所以会造成访问异常。 + +![](figures/example1.png) + +此代码的核心是想通过fileIO接口open固定路径得到fdNumber,使用fdNumber去做接下来的文件访问。FileIO是通过路径得到fdNumber的,而现在路径访问已经被限制了,因此考虑用其他的接口去获取fdNumber即可, +查阅OpenHarmony相关开发手册得知,使用resourceManager可以获取fdNumber。 +更改后的代码如下: + +![](figures/example2.png) + +## 规避方案 + +如果发现应用异常且定位没有结论,可以使用关闭进程沙箱的方式来规避问题,规避方式如下: + +1. 打开OpenHarmony startup_appspawn仓的源码,找到应用沙箱配置文件,根据自己编译类型修改对应的配置代码文件。 + 32位修改:https://gitee.com/OpenHarmony/startup_appspawn/blob/master/appdata-sandbox.json + 64位修改:https://gitee.com/OpenHarmony/startup_appspawn/blob/master/appdata-sandbox.json + +2. 在json中文件找到camera的配置,在下方参照camera的配置新建一条自身应用的配置,将包名改为自身应用报名,其他项保持跟camera一致即可,OFF字段代表关闭进程沙箱。 + + ![](figures/example3.png) \ No newline at end of file diff --git a/zh-cn/release-notes/changelog/v3.2-beta2/changelog-v3.2-beta2.md b/zh-cn/release-notes/changelog/v3.2-beta2/changelog-v3.2-beta2.md new file mode 100644 index 0000000000000000000000000000000000000000..97cc21a129800e7f6018318d098ceeb4657e37d2 --- /dev/null +++ b/zh-cn/release-notes/changelog/v3.2-beta2/changelog-v3.2-beta2.md @@ -0,0 +1,58 @@ +# 3.2 beta2相对3.2 beta1变更详细说明 + +## 启用应用沙箱机制 + +基于namespace机制强化OpenHarmony应用数据安全,建立应用沙盒机制,增加目录可见性数据访问防线,减少了应用数据和用户隐私信息泄露,建立了更加严格安全的应用沙盒隔离能力。 +同时也解决了目录混乱、文件访问方式多途径造成的文件管理的垃圾文件、文件混乱等体验问题和并发稳定性问题。 + +**变更影响** + +OpenHarmony启用应用沙箱机制后,所有被appspawn进程孵化的应用访问资源会受到应用沙箱的限制。 +如果应用没有适配应用沙箱的文件访问模型,则会导致应用功能异常。 +应用对于/data目录下文件的访问,需要将所有硬编码路径访问的方式调整为使用context接口访问,具体请见[适配流程](application-sandbox-adaptation-guide.md#适配流程)。 + +**关键的接口/组件变更** + +OpenHarmony应用沙箱组件 + +**适配指导** + +请参考[适配指导](application-sandbox-adaptation-guide.md)。 + +## 增加对于自定义组件Struct的编译校验 + +**变更1**:自定义组件Struct的生命周期函数(比如aboutToAppear)不能使用private修饰。 + +**变更影响** + +旧版本只有编辑器做了校验,新版本编译也加了校验报错。 + +**关键的接口/组件变更** + +无 + +**适配指导** + +当出现以下情况时,将private修饰去掉,即可通过编译。 + +![](figures/compile-change1-1.png) + +![](figures/compile-change1-2.png) + +**变更2:**自定义组件Struct的成员属性不能和内置属性方法名重名。 + +**变更影响** + +与内置属性方法名重名的Struct的成员属性无法通过校验。 + +**关键的接口/组件变更** + +无 + +**适配指导** + +当出现以下情况时,修改属性名,使其与内置属性方法名不重名。 + +![](figures/compile-change2-1.png) + +![](figures/compile-change2-2.png) \ No newline at end of file diff --git a/zh-cn/release-notes/changelog/v3.2-beta2/figures/adaptation-process.png b/zh-cn/release-notes/changelog/v3.2-beta2/figures/adaptation-process.png new file mode 100644 index 0000000000000000000000000000000000000000..05b1892b5508c56ca029e930a6f0c1360f6a7967 Binary files /dev/null and b/zh-cn/release-notes/changelog/v3.2-beta2/figures/adaptation-process.png differ diff --git a/zh-cn/release-notes/changelog/v3.2-beta2/figures/compile-change1-1.png b/zh-cn/release-notes/changelog/v3.2-beta2/figures/compile-change1-1.png new file mode 100644 index 0000000000000000000000000000000000000000..01e3e90dd66f2aad624a5fbbf88600833442a3fc Binary files /dev/null and b/zh-cn/release-notes/changelog/v3.2-beta2/figures/compile-change1-1.png differ diff --git a/zh-cn/release-notes/changelog/v3.2-beta2/figures/compile-change1-2.png b/zh-cn/release-notes/changelog/v3.2-beta2/figures/compile-change1-2.png new file mode 100644 index 0000000000000000000000000000000000000000..3607345cc1b59633f8dc0c35ae99393525c15496 Binary files /dev/null and b/zh-cn/release-notes/changelog/v3.2-beta2/figures/compile-change1-2.png differ diff --git a/zh-cn/release-notes/changelog/v3.2-beta2/figures/compile-change2-1.png b/zh-cn/release-notes/changelog/v3.2-beta2/figures/compile-change2-1.png new file mode 100644 index 0000000000000000000000000000000000000000..22c62fb46ef2311b6ff4f040baf72938317b1ef2 Binary files /dev/null and b/zh-cn/release-notes/changelog/v3.2-beta2/figures/compile-change2-1.png differ diff --git a/zh-cn/release-notes/changelog/v3.2-beta2/figures/compile-change2-2.png b/zh-cn/release-notes/changelog/v3.2-beta2/figures/compile-change2-2.png new file mode 100644 index 0000000000000000000000000000000000000000..6ef778e4d6b361f43b5e7d8493236bda03cd9b24 Binary files /dev/null and b/zh-cn/release-notes/changelog/v3.2-beta2/figures/compile-change2-2.png differ diff --git a/zh-cn/release-notes/changelog/v3.2-beta2/figures/example1.png b/zh-cn/release-notes/changelog/v3.2-beta2/figures/example1.png new file mode 100644 index 0000000000000000000000000000000000000000..db7b455ef72cac51d6bea1be36283c1c1c269ec0 Binary files /dev/null and b/zh-cn/release-notes/changelog/v3.2-beta2/figures/example1.png differ diff --git a/zh-cn/release-notes/changelog/v3.2-beta2/figures/example2.png b/zh-cn/release-notes/changelog/v3.2-beta2/figures/example2.png new file mode 100644 index 0000000000000000000000000000000000000000..9bb60d4b1e05dcb152e15553611db0c1da4d2b33 Binary files /dev/null and b/zh-cn/release-notes/changelog/v3.2-beta2/figures/example2.png differ diff --git a/zh-cn/release-notes/changelog/v3.2-beta2/figures/example3.png b/zh-cn/release-notes/changelog/v3.2-beta2/figures/example3.png new file mode 100644 index 0000000000000000000000000000000000000000..b9923c8a00716601316b4129b143a3fad854beb7 Binary files /dev/null and b/zh-cn/release-notes/changelog/v3.2-beta2/figures/example3.png differ diff --git a/zh-cn/release-notes/changelog/v3.2-beta2/figures/verification-process.png b/zh-cn/release-notes/changelog/v3.2-beta2/figures/verification-process.png new file mode 100644 index 0000000000000000000000000000000000000000..97bb2b82243470253462271e1c7164d77d64b4dc Binary files /dev/null and b/zh-cn/release-notes/changelog/v3.2-beta2/figures/verification-process.png differ diff --git a/zh-cn/third-party-components/npm-third-party-guide.md b/zh-cn/third-party-components/npm-third-party-guide.md index e9231f9f6d748935f668594cc5fde1e22c12a9a6..60222a480c852f19216688d99dda1dd9822005cc 100644 --- a/zh-cn/third-party-components/npm-third-party-guide.md +++ b/zh-cn/third-party-components/npm-third-party-guide.md @@ -1,11 +1,11 @@ -# OpenHarmony JS/TS三方组件使用指导 -## OpenHarmony JS/TS三方组件介绍 +# OpenHarmony JS和TS三方组件使用指导 +## OpenHarmony JS和TS三方组件介绍 -OpenHarmony JS/TS三方组件是以OpenHarmony npm包的形式,在传统的npm三方组件的基础上,定义了OpenHarmony npm共享包特定的工程结构和配置文件,支持OpenHarmony页面组件相关API、资源的调用。通过OpenHarmony npm包,可以实现多个模块或者多个工程共享OpenHarmony页面、资源等相关代码。前往[npm官方文档](https://docs.npmjs.com/about-npm),可以了解和掌握npm的基础功能和机制。 +OpenHarmony JS和TS三方组件是以OpenHarmony npm包的形式,在传统的npm三方组件的基础上,定义了OpenHarmony npm共享包特定的工程结构和配置文件,支持OpenHarmony页面组件相关API、资源的调用。通过OpenHarmony npm包,可以实现多个模块或者多个工程共享OpenHarmony页面、资源等相关代码。前往[npm官方文档](https://docs.npmjs.com/about-npm),可以了解和掌握npm的基础功能和机制。 -## 查找OpenHarmony JS/TS三方组件 +## 查找OpenHarmony JS和TS三方组件 1. 关注Gitee官网OpenHarmony-TPC[三方组件资源汇总](https://gitee.com/openharmony-tpc/tpc_resource)项目,根据目录索引即可找到对应分类下的具体组件。 @@ -16,9 +16,9 @@ OpenHarmony JS/TS三方组件是以OpenHarmony npm包的形式,在传统的npm -## 安装并使用OpenHarmony JS/TS语言的三方组件 +## 安装并使用OpenHarmony JS和TS语言的三方组件 -在应用开发的过程中,JS/TS语言的三方组件,通常以源码或OpenHarmony npm包的方式被引入使用。按照以下步骤即可将OpenHarmony npm包引入应用并使用,源码的具体引入及使用请参考各三方组件README.md指导介绍。 +在应用开发的过程中,JS和TS语言的三方组件,通常以源码或OpenHarmony npm包的方式被引入使用。按照以下步骤即可将OpenHarmony npm包引入应用并使用,源码的具体引入及使用请参考各三方组件README.md指导介绍。 1. 配置OpenHarmony npm环境,详情请参考安装教程 [如何安装OpenHarmony npm包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_npm_usage.md)。 diff --git a/zh-cn/third-party-components/third-party-components-introduction.md b/zh-cn/third-party-components/third-party-components-introduction.md index 17e06934e35a1e17ac5931b1ea6e057a2fbc7ec9..31f1ab1bfd795ff7b8154455a16d59ca234cd494 100644 --- a/zh-cn/third-party-components/third-party-components-introduction.md +++ b/zh-cn/third-party-components/third-party-components-introduction.md @@ -1,6 +1,6 @@ # OpenHarmony三方组件 -OpenHarmony三方组件,是经过验证可在OpenHarmony系统上可重复使用的软件组件,可帮助开发者快速开发OpenHarmony系统或应用。根据其开发语言分为了2种,一种是使用JavaScript或TypeScript语言的三方组件,通常以源码或OpenHarmony npm包的方式引入,在应用开发中使用。另一种是C/C++语言的三方组件,通常以源码或OpenHarmony hpm包的方式引入,在应用开发中以NAPI的方式使用,或直接编译在OpenHarmony操作系统镜像中。 +OpenHarmony三方组件,是经过验证可在OpenHarmony系统上可重复使用的软件组件,可帮助开发者快速开发OpenHarmony系统或应用。根据其开发语言分为了2种,一种是使用JavaScript和TypeScript语言的三方组件,通常以源码或OpenHarmony npm包的方式引入,在应用开发中使用。另一种是C和C++语言的三方组件,通常以源码或OpenHarmony hpm包的方式引入,在应用开发中以NAPI的方式使用,或直接编译在OpenHarmony操作系统镜像中。 diff --git a/zh-cn/website.md b/zh-cn/website.md index 839638458ee3b08090a89a54fe17c831b4206e4b..1edc4cf36f5c38ac154fac3af0336e2c89ab9a03 100644 --- a/zh-cn/website.md +++ b/zh-cn/website.md @@ -28,29 +28,61 @@ - [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) + - API差异报告 + + - OpenHamrony 3.2 Beta2 + - JS API差异报告 + - [元能力](release-notes/api-change/v3.2-beta2/js-apidiff-ability.md) + - [无障碍](release-notes/api-change/v3.2-beta2/js-apidiff-accessibility.md) + - [帐号](release-notes/api-change/v3.2-beta2/js-apidiff-account.md) + - [ArkUI](release-notes/api-change/v3.2-beta2/js-apidiff-arkui.md) + - [包管理](release-notes/api-change/v3.2-beta2/js-apidiff-bundle.md) + - [基础通信](release-notes/api-change/v3.2-beta2/js-apidiff-communicate.md) + - [公共基础库](release-notes/api-change/v3.2-beta2/js-apidiff-complier-and-runtime.md) + - [DFX](release-notes/api-change/v3.2-beta2/js-apidiff-dfx.md) + - [分布式数据管理](release-notes/api-change/v3.2-beta2/js-apidiff-distributed-data.md) + - [事件通知](release-notes/api-change/v3.2-beta2/js-apidiff-event-and-notification.md) + - [文件管理](release-notes/api-change/v3.2-beta2/js-apidiff-file-management.md) + - [位置服务](release-notes/api-change/v3.2-beta2/js-apidiff-geolocation.md) + - [全球化](release-notes/api-change/v3.2-beta2/js-apidiff-global.md) + - [图形图像](release-notes/api-change/v3.2-beta2/js-apidiff-graphic.md) + - [Misc](release-notes/api-change/v3.2-beta2/js-apidiff-misc.md) + - [多模输入](release-notes/api-change/v3.2-beta2/js-apidiff-multi-modal-input.md) + - [多媒体](release-notes/api-change/v3.2-beta2/js-apidiff-multimedia.md) + - [资源调度](release-notes/api-change/v3.2-beta2/js-apidiff-resource-scheduler.md) + - [安全](release-notes/api-change/v3.2-beta2/js-apidiff-security.md) + - [泛Sensor](release-notes/api-change/v3.2-beta2/js-apidiff-sensor.md) + - [分布式软总线](release-notes/api-change/v3.2-beta2/js-apidiff-soft-bus.md) + - [测试框架](release-notes/api-change/v3.2-beta2/js-apidiff-unitest.md) + - [升级服务](release-notes/api-change/v3.2-beta2/js-apidiff-update.md) + - [USB服务](release-notes/api-change/v3.2-beta2/js-apidiff-usb.md) + - [用户身份认证](release-notes/api-change/v3.2-beta2/js-apidiff-user-authentication.md) + - [Web](release-notes/api-change/v3.2-beta2/js-apidiff-web.md) + - [窗口管理](release-notes/api-change/v3.2-beta2/js-apidiff-window.md) + - OpenHarmony 3.2 Beta1 - JS API差异报告 - - [元能力](release-notes/api-change/v3.2-beta/js-apidiff-ability.md) - - [ArkUI](release-notes/api-change/v3.2-beta/js-apidiff-arkui.md) - - [电源](release-notes/api-change/v3.2-beta/js-apidiff-battery.md) - - [包管理](release-notes/api-change/v3.2-beta/js-apidiff-bundle.md) - - [基础通信](release-notes/api-change/v3.2-beta/js-apidiff-communicate.md) - - [DFX](release-notes/api-change/v3.2-beta/js-apidiff-dfx.md) - - [分布式数据管理](release-notes/api-change/v3.2-beta/js-apidiff-distributed-data.md) - - [事件通知](release-notes/api-change/v3.2-beta/js-apidiff-event-and-notification.md) - - [文件管理](release-notes/api-change/v3.2-beta/js-apidiff-file-management.md) - - [全球化](release-notes/api-change/v3.2-beta/js-apidiff-global.md) - - [启动恢复](release-notes/api-change/v3.2-beta/js-apidiff-init.md) - - [Misc](release-notes/api-change/v3.2-beta/js-apidiff-misc.md) - - [多模输入](release-notes/api-change/v3.2-beta/js-apidiff-multi-modal-input.md) - - [多媒体](release-notes/api-change/v3.2-beta/js-apidiff-multimedia.md) - - [资源调度](release-notes/api-change/v3.2-beta/js-apidiff-resource-scheduler.md) - - [分布式软总线](release-notes/api-change/v3.2-beta/js-apidiff-soft-bus.md) - - [测试框架](release-notes/api-change/v3.2-beta/js-apidiff-unitest.md) - - [Web](release-notes/api-change/v3.2-beta/js-apidiff-web.md) - - [窗口管理](release-notes/api-change/v3.2-beta/js-apidiff-window.md) - - [Native API差异报告](release-notes/api-change/v3.2-beta/native-apidiff-v3.2-beta.md) + - [元能力](release-notes/api-change/v3.2-beta1/js-apidiff-ability.md) + - [ArkUI](release-notes/api-change/v3.2-beta1/js-apidiff-arkui.md) + - [电源](release-notes/api-change/v3.2-beta1/js-apidiff-battery.md) + - [包管理](release-notes/api-change/v3.2-beta1/js-apidiff-bundle.md) + - [基础通信](release-notes/api-change/v3.2-beta1/js-apidiff-communicate.md) + - [DFX](release-notes/api-change/v3.2-beta1/js-apidiff-dfx.md) + - [分布式数据管理](release-notes/api-change/v3.2-beta1/js-apidiff-distributed-data.md) + - [事件通知](release-notes/api-change/v3.2-beta1/js-apidiff-event-and-notification.md) + - [文件管理](release-notes/api-change/v3.2-beta1/js-apidiff-file-management.md) + - [全球化](release-notes/api-change/v3.2-beta1/js-apidiff-global.md) + - [启动恢复](release-notes/api-change/v3.2-beta1/js-apidiff-init.md) + - [Misc](release-notes/api-change/v3.2-beta1/js-apidiff-misc.md) + - [多模输入](release-notes/api-change/v3.2-beta1/js-apidiff-multi-modal-input.md) + - [多媒体](release-notes/api-change/v3.2-beta1/js-apidiff-multimedia.md) + - [资源调度](release-notes/api-change/v3.2-beta1/js-apidiff-resource-scheduler.md) + - [分布式软总线](release-notes/api-change/v3.2-beta1/js-apidiff-soft-bus.md) + - [测试框架](release-notes/api-change/v3.2-beta1/js-apidiff-unitest.md) + - [Web](release-notes/api-change/v3.2-beta1/js-apidiff-web.md) + - [窗口管理](release-notes/api-change/v3.2-beta1/js-apidiff-window.md) + - [Native API差异报告](release-notes/api-change/v3.2-beta1/native-apidiff-v3.2-beta.md) - OpenHarmony 3.1 Release - JS API差异报告(API Version 8) - [元能力](release-notes/api-change/v3.1-Release/js-apidiff-ability.md) @@ -61,7 +93,7 @@ - [包管理](release-notes/api-change/v3.1-Release/js-apidiff-bundle.md) - [基础通信](release-notes/api-change/v3.1-Release/js-apidiff-communicate.md) - [语言编译器运行时](release-notes/api-change/v3.1-Release/js-apidiff-compiler-and-runtime.md) - - [DFX](release-notes/api-change/v3.1-Release/js-apidiff-dfx.md) + - [DFX](release-notes/api-change/v3.1-Release/js-apidiff-dfx.md) - [分布式数据管理](release-notes/api-change/v3.1-Release/js-apidiff-distributed-data.md) - [分布式硬件](release-notes/api-change/v3.1-Release/js-apidiff-distributed-hardware.md) - [事件通知](release-notes/api-change/v3.1-Release/js-apidiff-event-and-notification.md) @@ -93,7 +125,10 @@ - [资源调度](release-notes/api-change/v3.1-Release/js-apidiff-resource-scheduler_api-9-canary.md) - [窗口管理](release-notes/api-change/v3.1-Release/js-apidiff-window_api-9-canary.md) - [Native API差异报告](release-notes/api-change/v3.1-Release/native-apidiff-v3.1-release.md) - + - 变更说明 + - OpenHamrony 3.2 Beta2 + - [3.2 beta2相对3.2 beta1变更详细说明](release-notes\changelog\v3.2-beta2\changelog-v3.2-beta2.md) + - [OpenHarmony启用应用沙箱机制-适配指导](release-notes\changelog\v3.2-beta2\application-sandbox-adaptation-guide.md) - OpenHarmony三方组件 - [OpenHarmony三方组件简介](third-party-components/third-party-components-introduction.md) - [OpenHarmony JS/TS三方组件使用指导](third-party-components/npm-third-party-guide.md)