diff --git a/en/application-dev/application-models/common-event-overview.md b/en/application-dev/application-models/common-event-overview.md index d54fcf4786f0e22077cda0e6aae2d211bb2d0e90..e8be9abaa3015a5512c47af55d2f364be0de79ad 100644 --- a/en/application-dev/application-models/common-event-overview.md +++ b/en/application-dev/application-models/common-event-overview.md @@ -15,14 +15,15 @@ Common events are classified into system common events and custom common events. Common events are also classified into unordered, ordered, and sticky common events. -- Unordered common events: common events that CES forwards based on the subscription sequence, regardless of whether subscribers receive the events. +- Unordered common events: common events that CES forwards regardless of whether subscribers receive the events and when they subscribe to the events. -- Ordered common events: common events that CES forwards based on the subscriber priority. CES forwards common events to the subscriber with lower priority only after receiving a reply from the previous subscriber with higher priority. +- Ordered common events: common events that CES forwards based on the subscriber priority. CES forwards common events to the subscriber with lower priority only after receiving a reply from the previous subscriber with higher priority. Subscribers with the same priority receive common events in a random order. -- Sticky common events: common events that can be sent to a subscriber before they initiate a subscription. Only system applications and system services can send sticky common events, and they must request the **ohos.permission.COMMONEVENT_STICKY** permission. For details about the configuration, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). +- Sticky common events: common events that can be sent to a subscriber before or after they initiate a subscription. Only system applications and system services can send sticky common events, which remain in the system after being sent. The sends must first request the **ohos.permission.COMMONEVENT_STICKY** permission. For details about the configuration, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). Each application can subscribe to common events as required. After your application subscribes to a common event, the system sends it to your application every time the event is published. Such an event may be published by the system, other applications, or your own application. **Figure 1** Common events + ![common-event](figures/common-event.png) \ No newline at end of file diff --git a/en/application-dev/application-models/figures/common-event.png b/en/application-dev/application-models/figures/common-event.png index 24b51ff8718ae504ba69c1e12656d4daad797a62..fe2591d12d5f2c570d7be942d33ec330a6eb6c98 100644 Binary files a/en/application-dev/application-models/figures/common-event.png and b/en/application-dev/application-models/figures/common-event.png differ diff --git a/en/application-dev/connectivity/http-request.md b/en/application-dev/connectivity/http-request.md index a266e285245c932534873440fc777fd86ccd480d..6204682cde551e1d9a952d8e19716cf342ce2d3d 100644 --- a/en/application-dev/connectivity/http-request.md +++ b/en/application-dev/connectivity/http-request.md @@ -89,8 +89,3 @@ httpRequest.request( } ); ``` - -## Samples -The following sample is provided to help you better understand how to develop the HTTP data request feature: -- [`HTTP`: Data Request (ArkTS) (API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/Http) -- [HTTP Communication (ArkTS) (API9)](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/SmartChatEtsOH) diff --git a/en/application-dev/connectivity/ipc-rpc-development-guideline.md b/en/application-dev/connectivity/ipc-rpc-development-guideline.md index 5512d7a016754c94174fe269d5ed58424a218fb6..89bff0d4a168c74309f6bc711a3725fd4c9aad1b 100644 --- a/en/application-dev/connectivity/ipc-rpc-development-guideline.md +++ b/en/application-dev/connectivity/ipc-rpc-development-guideline.md @@ -1,4 +1,4 @@ -# IPC & RPC Development Guidelines +# IPC & RPC Development ## When to Use diff --git a/en/application-dev/connectivity/net-sharing.md b/en/application-dev/connectivity/net-sharing.md index d81e8f59ecfb538ececb78afc83941d52f330eda..d5bc9cf2f8817723f0f23d666c45997a6735f706 100644 --- a/en/application-dev/connectivity/net-sharing.md +++ b/en/application-dev/connectivity/net-sharing.md @@ -63,7 +63,7 @@ For the complete list of APIs and example code, see [Network Sharing](../referen }); // Call startSharing to start network sharing of the specified type. - sharing.startSharing(SharingIfaceType.SHARING_WIFI, (error) => { + sharing.startSharing(sharing.SharingIfaceType.SHARING_WIFI, (error) => { console.log(JSON.stringify(error)); }); ``` @@ -88,7 +88,7 @@ For the complete list of APIs and example code, see [Network Sharing](../referen }); // Call stopSharing to stop network sharing of the specified type. - sharing.stopSharing(SharingIfaceType.SHARING_WIFI, (error) => { + sharing.stopSharing(sharing.SharingIfaceType.SHARING_WIFI, (error) => { console.log(JSON.stringify(error)); }); ``` @@ -107,7 +107,7 @@ For the complete list of APIs and example code, see [Network Sharing](../referen import sharing from '@ohos.net.sharing' // Call startSharing to start network sharing of the specified type. - sharing.startSharing(SharingIfaceType.SHARING_WIFI, (error) => { + sharing.startSharing(sharing.SharingIfaceType.SHARING_WIFI, (error) => { console.log(JSON.stringify(error)); }); @@ -118,7 +118,7 @@ For the complete list of APIs and example code, see [Network Sharing](../referen }); // Call stopSharing to stop network sharing of the specified type and clear the data volume of network sharing. - sharing.stopSharing(SharingIfaceType.SHARING_WIFI, (error) => { + sharing.stopSharing(sharing.SharingIfaceType.SHARING_WIFI, (error) => { console.log(JSON.stringify(error)); }); diff --git a/en/application-dev/connectivity/socket-connection.md b/en/application-dev/connectivity/socket-connection.md index b0c6fcd63d49a6cf9b77662d8340cadc8f82735d..5cae73b2a5c84f280aea80e299605ee80ac2553a 100644 --- a/en/application-dev/connectivity/socket-connection.md +++ b/en/application-dev/connectivity/socket-connection.md @@ -319,10 +319,3 @@ TLS Socket connection process on the client: tlsTwoWay.off('close'); }); ``` - -## Samples - -The following samples are provided to help you better understand how to develop Socket connection features: -- [`Socket`: Socket Connection (ArkTS) (API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/Network/Socket) -- [UDP Socket (ArkTS) (API9)](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/UdpDemoOH) -- [TCP Socket (ArkTS) (API9)](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/TcpSocketDemo) diff --git a/en/application-dev/dfx/apprecovery-guidelines.md b/en/application-dev/dfx/apprecovery-guidelines.md index 67176a77ff4cacda15de76a3390275f59f3a6aa4..4a82385816bd7f51ca0dadf85aff9961f84b94ca 100644 --- a/en/application-dev/dfx/apprecovery-guidelines.md +++ b/en/application-dev/dfx/apprecovery-guidelines.md @@ -1,62 +1,87 @@ -# Development of Application Recovery +# Application Recovery Development ## When to Use -During application running, some unexpected behaviors are inevitable. For example, unprocessed exceptions and errors are thrown, and the call or running constraints of the framework are violated. +During application running, some unexpected behaviors are inevitable. For example, unprocessed exceptions and errors are thrown, and the call or running constraints of the recovery framework are violated. -By default, the processes will exit as exception handling. However, if user data is generated during application use, process exits may interrupt user operations and cause data loss. -In this way, application recovery APIs may help you save temporary data, restart an application after it exits, and restore its status and data, which deliver a better user experience. +Process exit is treated as the default exception handling method. However, if user data is generated during application use, process exit may interrupt user operations and cause data loss. +Application recovery helps to restore the application state and save temporary data upon next startup in the case of an abnormal process exit, thus providing more consistent user experience. The application state includes two parts, namely, the page stack of the and the data saved in **onSaveState**. -Currently, the APIs support only the development of an application that adopts the stage model, single process, and single ability. +In API version 9, application recovery is supported only for a single ability of the application developed using the stage model. Application state saving and automatic restart are performed when a JsError occurs. + +In API version 10, application recovery is also supported for multiple abilities of the application developed using the stage model. Application state storage and restore are performed when an AppFreeze occurs. If an application is killed in control mode, the application state will be restored upon next startup. ## Available APIs -The application recovery APIs are provided by the **appRecovery** module, which can be imported via **import**. For details, please refer to [Development Example](#development-example). This document describes behaviors of APIs in API version 9, and the content will update with changes. +The application recovery APIs are provided by the **appRecovery** module, which can be imported via **import**. For details, see [Development Example](#development-example). ### Available APIs -| API | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| enableAppRecovery(restart?: RestartFlag, saveOccasion?: SaveOccasionFlag, saveMode?: SaveModeFlag) : void; | Enables the application recovery function. | -| saveAppState(): boolean; | Saves the ability status of an application. | -| restartApp(): void; | Restarts the current process. If there is saved ability status, it will be passed to the **want** parameter's **wantParam** attribute of the **onCreate** lifecycle callback of the ability.| +| API | Description | +| ------------------------------------------------------------ | ---------------------------------------------------- | +| enableAppRecovery(restart?: RestartFlag, saveOccasion?: SaveOccasionFlag, saveMode?: SaveModeFlag) : void;9+ | Enables application recovery. After this API is called, the first ability that is displayed when the application is started from the initiator can be restored.| +| saveAppState(): boolean;9+ | Saves the state of the ability that supports recovery in the current application.| +| restartApp(): void;9+ | Restarts the current process and starts the ability specified by **setRestartWant**. If no ability is specified, a foreground ability that supports recovery is restarted.| +| saveAppState(context?: UIAbilityContext): boolean;10+ | Saves the ability state specified by **Context**.| +| setRestartWant(want: Want): void;10+ | Sets the abilities to restart when **restartApp** is actively called and **RestartFlag** is not **NO_RESTART**. The abilities must be under the same bundle name and must be a **UiAbility**.| + +No error will be thrown if the preceding APIs are used in the troubleshooting scenario. The following are some notes on API usage: + +**enableAppRecovery**: This API should be called during application initialization. For example, you can call this API in **onCreate** of **AbilityStage**. For details, see [Parameter Description](../reference/apis/js-apis-app-ability-appRecovery.md). + +**saveAppState**: After this API is called, the recovery framework invokes **onSaveState** for all abilities that support recovery in the current process. If you choose to save data in **onSaveState**, the related data and ability page stack are persistently stored in the local cache of the application. To save data of the specified ability, you need to specify the context corresponding to that ability. + +**setRestartWant**: This API specifies the ability to be restarted by **appRecovery**. + +**restartApp**: After this API is called, the recovery framework kills the current process and restarts the ability specified by **setRestartWant**, with **APP_RECOVERY** set as the startup cause. In API version 9 and scenarios where an ability is not specified by **setRestartWant**, the last foreground ability that supports recovery is started. If the no foreground ability supports recovery, the application crashes. If a saved state is available for the restarted ability, the saved state is passed as the **wantParam** attribute in the **want** parameter of the ability's **onCreate** callback. + +### Application State Management +Since API version 10, application recovery is not limited to automatic restart in the case of an exception. Therefore, you need to understand when the application will load the saved state. + +If the last exit of an application is not initiated by a user and a saved state is available for recovery, the startup reason is set to **APP_RECOVERY** when the application is started by the user next time, and the recovery state of the application is cleared. +The application recovery status flag is set when **saveAppState** is actively or passively called. The flag is cleared when the application exits normally or the saved state is consumed. (A normal exit is usually triggered by pressing the back key or clearing recent tasks.) -The APIs are used for troubleshooting and do not return any exception. Therefore, you need to be familiar with when they are used. +![Application recovery status management](./figures/application_recovery_status_management.png) -**enableAppRecovery**: This API should be called during application initialization. For example, you can call this API in **onCreate** of **AbilityStage**. For details, please refer to the [parameter description](../reference/apis/js-apis-app-ability-appRecovery.md). +### Application State Saving and Restore -**saveAppState**: After this API is called, the framework calls back **onSaveState** of the ability. If data saving is agreed to in this method, relevant data and the page stack of the ability are persisted to the local cache of the application. +API version 10 or later supports saving of the application state when an application is suspended. If a JsError occurs, **onSaveState** is called in the main thread. If an AppFreeze occurs, however, the main thread may be suspended, and therefore **onSaveState** is called in a non-main thread. The following figure shows the main service flow. -**restartApp**: After this API is called, the framework kills the current application process and restarts the ability in the foreground, with **APP_RECOVERY** specified as the startup cause. +![Application recovery from the freezing state](./figures/application_recovery_from_freezing.png) -### Framework Fault Management Process +When the application is suspended, the callback is not executed in the JS thread. Therefore, you are advised not to use the imported dynamic Native library or access the **thread_local** object created by the main thread in the code of the **onSaveState** callback. + +### Framework Fault Management Fault management is an important way for applications to deliver a better user experience. The application framework offers three methods for application fault management: fault listening, fault rectification, and fault query. -- Fault listening refers to the process of registering [ErrorObserver](../reference/apis/js-apis-application-errorManager.md#errorobserver) via [errorManager](../reference/apis/js-apis-application-errorManager.md), listening for fault occurrence, and notifying the fault listener. +- Fault listening refers to the process of registering an [ErrorObserver](../reference/apis/js-apis-inner-application-errorObserver.md) via [errorManager](../reference/apis/js-apis-app-ability-errorManager.md), listening for faults, and notifying the listener of the faults. + +- Fault rectification refers to the process of restoring the application state and data through [appRecovery](../reference/apis/js-apis-app-ability-appRecovery.md). -- Fault rectification refers to [appRecovery](../reference/apis/js-apis-app-ability-appRecovery.md) and restarts an application to restore its status previous to a fault. +- Fault query is the process of calling APIs of [faultLogger](../reference/apis/js-apis-faultLogger.md) to obtain the fault information. -- Fault query indicates that [faultLogger](../reference/apis/js-apis-faultLogger.md) obtains the fault information using its query API. +The figure below does not illustrate the time when [faultLogger](../reference/apis/js-apis-faultLogger.md) is called. You can refer to the [LastExitReason](../reference/apis/js-apis-app-ability-abilityConstant.md#abilityconstantlastexitreason) passed during application initialization to determine whether to call [faultLogger](../reference/apis/js-apis-faultLogger.md) to query information about the previous fault. -The figure below does not illustrate the time when [faultLogger](../reference/apis/js-apis-faultLogger.md) is called. You can refer to [LastExitReason](../reference/apis/js-apis-app-ability-abilityConstant.md#abilityconstantlastexitreason) passed during application initialization to determine whether to call [faultLogger](../reference/apis/js-apis-faultLogger.md) to query the information about the last fault. ![Fault rectification process](./figures/fault_rectification.png) -It is recommended that you call [errorManager](../reference/apis/js-apis-application-errorManager.md) to process the exception. After the processing is complete, you can call the status saving API and restart the application. -If you do not register [ErrorObserver](../reference/apis/js-apis-application-errorManager.md#errorobserver) or enable application recovery, the application process will exit according to the default processing logic of the system. Users can restart the application from the home screen. -If you have enabled application recovery, the framework first checks whether a fault allows for ability status saving and whether you have configured ability status saving. If so, [onSaveState](../reference/apis/js-apis-application-ability.md#abilityonsavestate) of [Ability](../reference/apis/js-apis-application-ability.md#ability) is called back. Finally, the application is restarted. +It is recommended that you call [errorManager](../reference/apis/js-apis-app-ability-errorManager.md) to handle the exception. After the processing is complete, you can call the **saveAppState** API and restart the application. + +If you do not register [ErrorObserver](../reference/apis/js-apis-inner-application-errorObserver.md) or enable application recovery, the application process will exit according to the default processing logic of the system. Users can restart the application from the home screen. + +If you have enabled application recovery, the recovery framework first checks whether application state saving is supported and whether the application state saving is enabled. If so, the recovery framework invokes [onSaveState](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonsavestate) of the [Ability](../reference/apis/js-apis-app-ability-uiAbility.md). Finally, the application is restarted. -### Scenarios Supported by Application Fault Management APIs +### Supported Application Recovery Scenarios Common fault types include JavaScript application crash, application freezing, and C++ application crash. Generally, an application is closed when a crash occurs. Application freezing occurs when the application does not respond. The fault type can be ignored for the upper layer of an application. The recovery framework implements fault management in different scenarios based on the fault type. -| Fault | Fault Listening| Status Saving| Automatic Restart| Log Query| -| ------------------------------------------------------------ | -------- | -------- | -------- | -------- | -| [JS_CRASH](../reference/apis/js-apis-faultLogger.md#faulttype) | Supported | Supported | Supported | Supported | -| [APP_FREEZE](../reference/apis/js-apis-faultLogger.md#faulttype) | Not supported | Not supported | Supported | Supported | -| [CPP_CRASH](../reference/apis/js-apis-faultLogger.md#faulttype) | Not supported | Not supported | Not supported | Supported | +| Fault | Fault Listening | State Saving| Automatic Restart| Log Query| +| ----------|--------- |--------- |--------- |--------- | +| [JS_CRASH](../reference/apis/js-apis-faultLogger.md#faulttype) | Supported|Supported|Supported|Supported| +| [APP_FREEZE](../reference/apis/js-apis-faultLogger.md#faulttype) | Not supported|Supported|Supported|Supported| +| [CPP_CRASH](../reference/apis/js-apis-faultLogger.md#faulttype) | Not supported|Not supported|Not supported|Supported| -**Status Saving** in the table header means status saving when a fault occurs. To protect user data as much as possible in the application freezing fault, you can adopt either the periodic or automatic way, and the latter will save user data when an ability is switched to the background. +**State Saving** in the table header means saving of the application state when a fault occurs. To protect user data as much as possible when an AppFreeze occurs, you can adopt either the periodic or automatic way, and the latter will save user data when an ability is switched to the background. @@ -78,11 +103,23 @@ export default class MyAbilityStage extends AbilityStage { appRecovery.SaveModeFlag.SAVE_WITH_FILE); } } +``` +### Enabling Application Recovery for the Specified Abilities +Generally, the ability configuration list is named **module.json5**. +```json +{ + "abilities": [ + { + "name": "EntryAbility", + "recoverable": true, + }] +} + ``` ### Saving and Restoring Data -After enabling **appRecovery**, you can use this function by either actively or passively saving the status and restoring data in the ability. +After enabling **appRecovery**, you can use this function by either actively or passively saving the application state and restoring data in the ability. The following is an example of **EntryAbility**: #### Importing the Service Package @@ -93,9 +130,9 @@ import appRecovery from '@ohos.app.ability.appRecovery'; import AbilityConstant from '@ohos.app.ability.AbilityConstant'; ``` -#### Actively Saving Status and Restoring Data +#### Actively Saving the Application State and Restoring Data -- Define and register the [ErrorObserver](../reference/apis/js-apis-application-errorManager.md#errorobserver) callback. +- Define and register the [ErrorObserver](../reference/apis/js-apis-inner-application-errorObserver.md) callback. ```ts var registerId = -1; @@ -108,7 +145,7 @@ import AbilityConstant from '@ohos.app.ability.AbilityConstant'; } onWindowStageCreate(windowStage) { - // Main window is created. Set a main page for this ability. + // Main window is created, set main page for this ability console.log("[Demo] EntryAbility onWindowStageCreate") globalThis.registerObserver = (() => { @@ -125,7 +162,7 @@ After the callback triggers **appRecovery.saveAppState()**, **onSaveState(state, ```ts onSaveState(state, wantParams) { - // Save application data. + // Ability has called to save app data console.log("[Demo] EntryAbility onSaveState") wantParams["myData"] = "my1234567"; return AbilityConstant.onSaveResult.ALL_AGREE; @@ -134,7 +171,7 @@ After the callback triggers **appRecovery.saveAppState()**, **onSaveState(state, - Restore data. -After the callback triggers **appRecovery.restartApp()**, the application is restarted. After the restart, **onCreate(want, launchParam)** of **EntryAbility** is called, and the saved data is in **parameters** of **want**. +After the callback triggers **appRecovery.restartApp()**, the application is restarted. After the restart, **onCreate(want, launchParam)** of **EntryAbility** is called, and the saved data is stored in **parameters** of **want**. ```ts storage: LocalStorage @@ -150,11 +187,11 @@ onCreate(want, launchParam) { } ``` -- Deregister **ErrorObserver callback**. +- Unregister the **ErrorObserver** callback. ```ts onWindowStageDestroy() { - // Main window is destroyed to release UI resources. + // Main window is destroyed, release UI related resources console.log("[Demo] EntryAbility onWindowStageDestroy") globalThis.unRegisterObserver = (() => { @@ -165,9 +202,9 @@ onWindowStageDestroy() { } ``` -#### Passively Saving Status and Restoring Data +#### Passively Saving the Application State and Restoring Data -This is triggered by the recovery framework. You do not need to register **ErrorObserver callback**. You only need to implement **onSaveState** of the ability for status saving and **onCreate** of the ability for data restoration. +This is triggered by the recovery framework. You do not need to register an **ErrorObserver** callback. You only need to implement **onSaveState** for application state saving and **onCreate** for data restore. ```ts export default class EntryAbility extends Ability { @@ -184,7 +221,7 @@ export default class EntryAbility extends Ability { } onSaveState(state, wantParams) { - // Save application data. + // Ability has called to save app data console.log("[Demo] EntryAbility onSaveState") wantParams["myData"] = "my1234567"; return AbilityConstant.onSaveResult.ALL_AGREE; diff --git a/en/application-dev/dfx/figures/application_recovery_from_freezing.png b/en/application-dev/dfx/figures/application_recovery_from_freezing.png new file mode 100644 index 0000000000000000000000000000000000000000..968b4cefc5e898209cdae117c7f9f667bc9fbd64 Binary files /dev/null and b/en/application-dev/dfx/figures/application_recovery_from_freezing.png differ diff --git a/en/application-dev/dfx/figures/application_recovery_status_management.png b/en/application-dev/dfx/figures/application_recovery_status_management.png new file mode 100644 index 0000000000000000000000000000000000000000..762504c1d1027be87233e589988be2091640191b Binary files /dev/null and b/en/application-dev/dfx/figures/application_recovery_status_management.png differ diff --git a/en/application-dev/dfx/figures/fault_rectification.png b/en/application-dev/dfx/figures/fault_rectification.png index 67aa40592f7bcad23e216222e898c1f1327a4efb..e5831ac2b5aefc33a955ad98cd76f41ad28a7f70 100644 Binary files a/en/application-dev/dfx/figures/fault_rectification.png and b/en/application-dev/dfx/figures/fault_rectification.png differ diff --git a/en/application-dev/internationalization/intl-guidelines.md b/en/application-dev/internationalization/intl-guidelines.md index 7274514385795ec42b6e81924e34e71070a71ebf..fcac5325292b27f349f6c3dcadb627dca2dd0c03 100644 --- a/en/application-dev/internationalization/intl-guidelines.md +++ b/en/application-dev/internationalization/intl-guidelines.md @@ -2,7 +2,7 @@ The **intl** module provides basic i18n capabilities, such as time and date formatting, number formatting, and string sorting, through the standard i18n APIs defined in ECMA 402. For more details about APIs and their usage, see [intl](../reference/apis/js-apis-intl.md). -The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities through supplementary interfaces that are not defined in ECMA 402. It works with the Intl module to provide a complete suite of I18N capabilities. +The [i18n](../reference/apis/js-apis-i18n.md) module provides enhanced I18N capabilities through supplementary interfaces that are not defined in ECMA 402. It works with the Intl module to provide a complete suite of I18N capabilities. ## Setting Locale Information @@ -111,7 +111,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug let dateTimeFormat = new Intl.DateTimeFormat(); ``` - Alternatively, use your own locale and formatting parameters to create a **DateTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [DateTimeOptions](../reference/apis/js-apis-intl.md#datetimeoptions). + Alternatively, use your own locale and formatting parameters to create a **DateTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [DateTimeOptions](../reference/apis/js-apis-intl.md#datetimeoptions9). ```js let options = {dateStyle: "full", timeStyle: "full"}; @@ -150,7 +150,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug let resolvedOptions = dateTimeFormat.resolvedOptions(); // resolvedOptions = {"locale": "zh-CN", "calendar": "gregorian", "dateStyle":"full", "timeStyle":"full", "timeZone": "CST"} ``` -## Number Formatting +## Formatting Numbers [NumberFormat](../reference/apis/js-apis-intl.md#numberformat) provides APIs to implement the number formatting specific to a locale. @@ -181,7 +181,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug let numberFormat = new Intl.NumberFormat(); ``` - Alternatively, use your own locale and formatting parameters to create a **NumberFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [NumberOptions](../reference/apis/js-apis-intl.md#numberoptions). + Alternatively, use your own locale and formatting parameters to create a **NumberFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [NumberOptions](../reference/apis/js-apis-intl.md#numberoptions9). ```js let options = {compactDisplay: "short", notation: "compact"}; @@ -209,7 +209,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug let resolvedOptions = numberFormat.resolvedOptions(); // resolvedOptions = {"locale": "zh-CN", "compactDisplay": "short", "notation": "compact", "numberingSystem": "Latn"} ``` -## String Sorting +## Sorting Strings Users in different regions have different requirements for string sorting. [Collator](../reference/apis/js-apis-intl.md#collator8) provides APIs to sort character strings specific to a locale. @@ -317,7 +317,7 @@ According to grammars in certain languages, the singular or plural form of a nou let categoryResult = pluralRules.select(number); // categoryResult = "other" ``` -## Formatting Relative Time +## Formatting the Relative Time [RelativeTimeFormat](../reference/apis/js-apis-intl.md#relativetimeformat8) provides APIs to format the relative time for a specific locale. @@ -385,9 +385,3 @@ According to grammars in certain languages, the singular or plural form of a nou let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"}); let options = relativeTimeFormat.resolvedOptions(); // options = {"locale": "zh-CN", "style": "long", "numeric": "always", "numberingSystem": "latn"} ``` - -## Samples - -The following sample is provided to help you better understand how to develop internationalization capabilities: - --[`International`: Internationalization (ArkTS) (API9) (Full SDK)] (https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/Internationalnation/International) diff --git a/en/application-dev/quick-start/arkts-rendering-control.md b/en/application-dev/quick-start/arkts-rendering-control.md index c59ee04dccef3411c25326851c446dcdd3f7164f..13904097ef69fc988fe3b1ed8d5a98714c38c2aa 100644 --- a/en/application-dev/quick-start/arkts-rendering-control.md +++ b/en/application-dev/quick-start/arkts-rendering-control.md @@ -256,7 +256,7 @@ struct MyComponent { this.data.pushData('/path/image' + this.data.totalCount() + '.png') }) }, item => item) - } + }.height('100%').width('100%') } } ``` diff --git a/en/application-dev/quick-start/cross-app-hsp.md b/en/application-dev/quick-start/cross-app-hsp.md index 15345c966babd31b925d29160325eaf66e5b1140..db971e348908dbc6f6ca87f5d84d162b6bac0997 100644 --- a/en/application-dev/quick-start/cross-app-hsp.md +++ b/en/application-dev/quick-start/cross-app-hsp.md @@ -7,7 +7,7 @@ The host application of an inter-application HSP is a special form of applicatio 1. The code of an inter-application HSP runs in the application process. When invoking the code, implement an exception capture and fault tolerance mechanism to avoid stability issues caused by malfunctioning of the inter-application HSP. 2. An application can depend on multiple inter-application HSP files at the same time. 3. The inter-application HSP may slow down the startup of the application that depends on it. To avoid significant increase in the startup delay, limit the number of inter-application HSP dependencies within 16. -4. Third-party developers can only use the system-provided inter-application HSP files. +4. Privilege verification is conducted during inter-application HSP installation. To develop an inter-application HSP, you must configure the **allowAppShareLibrary** application privilege. For details, see [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md). ## Inter-Application HSP Usage An inter-application HSP works by combining the following parts: @@ -23,7 +23,7 @@ src ├── main | └── module.json5 ├── index.d.ets -└── package.json +└── oh-package.json5 ``` Below is an example of the **index.d.ets** file content: ```ts @@ -40,7 +40,7 @@ export declare function foo2(): string; export declare function nativeHello(): string; ``` -In the example, **UIComponent** is an ArkUI component, **hello()**, **foo1()**, and **foo2()** are TS methods, and **nativeHello()** is an native method. Specific implementation is as follows: +In the example, **UIComponent** is an ArkUI component, **hello()**, **foo1()**, and **foo2()** are TS methods, and **nativeHello()** is a native method. Specific implementation is as follows: #### ArkUI Components The following is an implementation example of ArkUI components in the HSP: ```ts @@ -117,7 +117,7 @@ extern "C" __attribute__((constructor)) void RegisterLibaModule(void) { } ``` ### Using the Capabilities Exported from the HAR -To start with, [configure dependency](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-development-npm-package-0000001222578434#section89674298391) on the HAR. The dependency information will then be generated in the **module.json** file of the corresponding module, as shown in the following: +To start with, [configure dependency](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-development-npm-package-0000001222578434#section89674298391) on the HAR. The dependency information will then be generated in the **module.json5** file of the corresponding module, as shown in the following: ```json "dependencies": [ { diff --git a/en/application-dev/quick-start/har-package.md b/en/application-dev/quick-start/har-package.md index 71cc22a71f970d6fe9e7d3638b36da0e16b9d8de..63b5fcfd10437ac2140a17bcc1daf690e780c791 100644 --- a/en/application-dev/quick-start/har-package.md +++ b/en/application-dev/quick-start/har-package.md @@ -30,7 +30,7 @@ When obfuscation is enabled, DevEco Studio compiles, obfuscates, and compresses - The HAR of the stage model cannot reference content in the **AppScope** folder. This is because the content in the **AppScope** folder is not packaged into the HAR during compilation and building. ## Exporting ArkUI Components, APIs, and Resources of the HAR -The **index.ets** file acts as the entry of the HAR export declaration file and is where the HAR exports APIs. This file is automatically generated by DevEco Studio by default. You can specify another file as the entry declaration file in the **main** field in the **package.json** file of the module. The code snippet is as follows: +The **index.ets** file acts as the entry of the HAR export declaration file and is where the HAR exports APIs. This file is automatically generated by DevEco Studio by default. You can specify another file as the entry declaration file in the **main** field in the **oh-package.json5** file of the module. The code snippet is as follows: ```json { "main": "index.ets" diff --git a/en/application-dev/quick-start/in-app-hsp.md b/en/application-dev/quick-start/in-app-hsp.md index 05380e9c6f3f3e631c56955128318d394a97f774..cdd06b5dfb59a2c9609a7f327c95bae710943d3d 100644 --- a/en/application-dev/quick-start/in-app-hsp.md +++ b/en/application-dev/quick-start/in-app-hsp.md @@ -15,7 +15,7 @@ library │ │ └── index.ets │ ├── resources │ └── module.json5 -└── package.json +└── oh-package.json5 ``` In the **module.json5** file, set **type** to **shared** for the HSP. ```json @@ -24,7 +24,7 @@ In the **module.json5** file, set **type** to **shared** for the HSP. } ``` -The HSP provides capabilities for external systems by exporting APIs in the entry file. Specify the entry file in **main** in the **package.json** file. For example: +The HSP provides capabilities for external systems by exporting APIs in the entry file. Specify the entry file in **main** in the **oh-package.json5** file. For example: ```json { "main": "./src/main/ets/index.ets" @@ -103,9 +103,9 @@ export { nativeMulti } from './utils/nativeTest' ``` ## Using the In-Application HSP -To use APIs in the HSP, first configure the dependency on the HSP in the **package.json** file of the module that needs to call the APIs (called the invoking module). If the HSP and the invoking module are in the same project, the APIs can be referenced locally. The sample code is as follows: +To use APIs in the HSP, first configure the dependency on the HSP in the **oh-package.json5** file of the module that needs to call the APIs (called the invoking module). If the HSP and the invoking module are in the same project, the APIs can be referenced locally. The sample code is as follows: ```json -// entry/src/main/module.json5 +// entry/oh-package.json5 "dependencies": { "library": "file:../library" } diff --git a/en/application-dev/reference/apis/js-apis-call.md b/en/application-dev/reference/apis/js-apis-call.md index b6b2bddb6306e577053b5ea9e34c21acf23c9477..068a12cd46efce13b68a4fcf697306c4b5d8f256 100644 --- a/en/application-dev/reference/apis/js-apis-call.md +++ b/en/application-dev/reference/apis/js-apis-call.md @@ -14,110 +14,6 @@ To subscribe to the call status, use [`observer.on('callStateChange')`](js-apis- import call from '@ohos.telephony.call'; ``` -## call.dial(deprecated) - -dial\(phoneNumber: string, callback: AsyncCallback\): void - -Initiates a call. This API uses an asynchronous callback to return the result. - ->**NOTE** -> ->This parameter is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9). - -**Required Permissions**: ohos.permission.PLACE_CALL - -**System capability**: SystemCapability.Telephony.CallManager - -**Parameters** - -| Name | Type | Mandatory| Description | -| ----------- | ---------------------------- | ---- | --------------------------------------- | -| phoneNumber | string | Yes | Phone number. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure| - -**Example** - -```js -call.dial("138xxxxxxxx", (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); -``` - - -## call.dial(deprecated) - -dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback\): void - -Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result. - ->**NOTE** -> ->This parameter is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9). - -**Required Permissions**: ohos.permission.PLACE_CALL - -**System capability**: SystemCapability.Telephony.CallManager - -**Parameters** - -| Name | Type | Mandatory| Description | -| ----------- | ---------------------------- | ---- | --------------------------------------- | -| phoneNumber | string | Yes | Phone number. | -| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure| - -**Example** - -```js -call.dial("138xxxxxxxx", { - extras: false -}, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); -``` - - -## call.dial(deprecated) - -dial\(phoneNumber: string, options?: DialOptions\): Promise - -Initiates a call. You can set call options as needed. This API uses a promise to return the result. - ->**NOTE** -> ->This parameter is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9). - -**Required Permissions**: ohos.permission.PLACE_CALL - -**System capability**: SystemCapability.Telephony.CallManager - -**Parameters** - -| Name | Type | Mandatory| Description | -| ----------- | --------------------------- | ---- | -------------------------------------- | -| phoneNumber | string | Yes | Phone number. | -| options | [DialOptions](#dialoptions) | No | Call option, which indicates whether the call is a voice call or video call.| - -**Return value** - -| Type | Description | -| ---------------------- | ------------------------------------------------------------ | -| Promise<boolean> | Promise used to return the result.
- **true**: success
- **false**: failure| - -**Example** - -```js -let promise = call.dial("138xxxxxxxx", { - extras: false -}); -promise.then(data => { - console.log(`dial success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { - console.error(`dial fail, promise: err->${JSON.stringify(err)}`); -}); -``` - - ## call.dialCall9+ dialCall\(phoneNumber: string, callback: AsyncCallback\): void @@ -260,6 +156,107 @@ promise.then(() => { }); ``` +## call.dial(deprecated) + +dial\(phoneNumber: string, callback: AsyncCallback\): void + +Initiates a call. This API uses an asynchronous callback to return the result. + +> **NOTE** +> +> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9). The substitute API is available only for system applications. + +**Required Permissions**: ohos.permission.PLACE_CALL + +**System capability**: SystemCapability.Telephony.CallManager + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | ---------------------------- | ---- | --------------------------------------- | +| phoneNumber | string | Yes | Phone number. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure| + +**Example** + +```js +call.dial("138xxxxxxxx", (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.dial(deprecated) + +dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback\): void + +Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result. + +> **NOTE** +> +> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9). The substitute API is available only for system applications. + +**Required Permissions**: ohos.permission.PLACE_CALL + +**System capability**: SystemCapability.Telephony.CallManager + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | ---------------------------- | ---- | --------------------------------------- | +| phoneNumber | string | Yes | Phone number. | +| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure| + +**Example** + +```js +call.dial("138xxxxxxxx", { + extras: false +}, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + +## call.dial(deprecated) + +dial\(phoneNumber: string, options?: DialOptions\): Promise + +Initiates a call. You can set call options as needed. This API uses a promise to return the result. + +> **NOTE** +> +> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9). The substitute API is available only for system applications. + +**Required Permissions**: ohos.permission.PLACE_CALL + +**System capability**: SystemCapability.Telephony.CallManager + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | --------------------------- | ---- | -------------------------------------- | +| phoneNumber | string | Yes | Phone number. | +| options | [DialOptions](#dialoptions) | No | Call option, which indicates whether the call is a voice call or video call.| + +**Return value** + +| Type | Description | +| ---------------------- | ------------------------------------------------------------ | +| Promise<boolean> | Promise used to return the result.
- **true**: success
- **false**: failure| + +**Example** + +```js +let promise = call.dial("138xxxxxxxx", { + extras: false +}); +promise.then(data => { + console.log(`dial success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`dial fail, promise: err->${JSON.stringify(err)}`); +}); +``` ## call.makeCall7+ @@ -2387,7 +2384,7 @@ Subscribes to **callDetailsChange** events. This API uses an asynchronous callba | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------- | ---- | -------------------------- | -| type | string | Yes | Event type. This field has a fixed value of **callDetailsChange**.| +| type | string | Yes | Call event change. This field has a fixed value of **callDetailsChange**.| | callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | Yes | Callback used to return the result. | **Error codes** @@ -2427,7 +2424,7 @@ Subscribes to **callEventChange** events. This API uses an asynchronous callback | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------ | ---- | -------------------------- | -| type | string | Yes | This interface is used to monitor the change of call events during a call. The parameter has a fixed value of callEventChange.| +| type | string | Yes | Call event change. This field has a fixed value of **callEventChange**.| | callback | Callback<[CallEventOptions](#calleventoptions8)> | Yes | Callback used to return the result. | **Error codes** @@ -2467,7 +2464,7 @@ Subscribes to **callDisconnectedCause** events. This API uses an asynchronous ca | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------ | ---- | -------------------------- | -| type | string | Yes | Event type. The field has a fixed value of **callDisconnectedCause**.| +| type | string | Yes | Call disconnection cause. This field has a fixed value of **callDisconnectedCause**.| | callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | Yes | Callback used to return the result. | **Error codes** @@ -2507,7 +2504,7 @@ Subscribes to **mmiCodeResult** events. This API uses an asynchronous callback t | Name | Type | Mandatory| Description | | -------- | -------------------------------------------- | ---- | --------------------- | -| type | string | Yes | Event type. The field has a fixed value of **mmiCodeResult**.| +| type | string | Yes | MMI code result. This field has a fixed value of **mmiCodeResult**.| | callback | Callback<[MmiCodeResults](#mmicoderesults9)> | Yes | Callback used to return the result. | **Error codes** @@ -2547,7 +2544,7 @@ Unsubscribes from **callDetailsChange** events. This API uses an asynchronous ca | Name | Type | Mandatory| Description | | -------- | -------------------------------------------------------- | ---- | ---------------------------------- | -| type | string | Yes | Event type. The field has a fixed value of **callDetailsChange**.| +| type | string | Yes | Call details change. This field has a fixed value of **callDetailsChange**.| | callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | No | Callback used to return the result. | **Error codes** @@ -2587,7 +2584,7 @@ Unsubscribes from **callEventChange** events. This API uses an asynchronous call | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------ | ---- | ---------------------------------- | -| type | string | Yes | Event type. The field has a fixed value of **callEventChange**.| +| type | string | Yes | Call event change. This field has a fixed value of **callEventChange**.| | callback | Callback<[CallEventOptions](#calleventoptions8)> | No | Callback used to return the result. | **Error codes** @@ -2627,7 +2624,7 @@ Unsubscribes from **callDisconnectedCause** events. This API uses an asynchronou | Name | Type | Mandatory| Description | | -------- | ---------------------------------------------------------- | ---- | ------------------- | -| type | string | Yes | Event type. The field has a fixed value of **callDisconnectedCause**.| +| type | string | Yes | Call disconnection cause. This field has a fixed value of **callDisconnectedCause**.| | callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | No | Callback used to return the result. | **Error codes** @@ -2667,7 +2664,7 @@ Unsubscribes from **mmiCodeResult** events. This API uses an asynchronous callba | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------ | ---- | ----------- | -| type | string | Yes | Event type. The field has a fixed value of **mmiCodeResult**.| +| type | string | Yes | MMI code result. This field has a fixed value of **mmiCodeResult**.| | callback | Callback<[MmiCodeResults](#mmicoderesults9)> | No | Callback used to return the result. | **Error codes** diff --git a/en/application-dev/reference/apis/js-apis-hichecker.md b/en/application-dev/reference/apis/js-apis-hichecker.md index 4d6d81f15430a456eb60f54e1b650df5ef112dbe..35c86ccd1c0143dea06b5f1a24634b6cc09a2187 100644 --- a/en/application-dev/reference/apis/js-apis-hichecker.md +++ b/en/application-dev/reference/apis/js-apis-hichecker.md @@ -122,7 +122,9 @@ try { addRule(rule: bigint): void -> **NOTE**
This API is deprecated since API version 9. You are advised to use [hichecker.addCheckRule](#hicheckeraddcheckrule9) instead. +> **NOTE** +> +> This API is deprecated since API version 9. You are advised to use [hichecker.addCheckRule](#hicheckeraddcheckrule9). Adds one or more rules. HiChecker detects unexpected operations or gives feedback based on the added rules. @@ -149,7 +151,9 @@ hichecker.addRule( removeRule(rule: bigint): void -> **NOTE**
This API is deprecated since API version 9. You are advised to use [hichecker.removeCheckRule](#hicheckerremovecheckrule9) instead. +> **NOTE** +> +> This API is deprecated since API version 9. You are advised to use [hichecker.removeCheckRule](#hicheckerremovecheckrule9). Removes one or more rules. The removed rules will become ineffective. @@ -200,7 +204,9 @@ hichecker.getRule(); // return 1n; contains(rule: bigint): boolean -> **NOTE**
This API is deprecated since API version 9. You are advised to use [hichecker.containsCheckRule](#hicheckercontainscheckrule9) instead. +> **NOTE** +> +> This API is deprecated since API version 9. You are advised to use [hichecker.containsCheckRule](#hicheckercontainscheckrule9). Checks whether the specified rule exists in the collection of added rules. If the rule is of the thread level, this operation is performed only on the current thread. diff --git a/en/application-dev/reference/apis/js-apis-hidebug.md b/en/application-dev/reference/apis/js-apis-hidebug.md index 364938ddfa2864850a1335cb886f41e3de2c1a9c..186b2dc92d8bf4fd2693f06b5b6e062bb9a7fc29 100644 --- a/en/application-dev/reference/apis/js-apis-hidebug.md +++ b/en/application-dev/reference/apis/js-apis-hidebug.md @@ -1,10 +1,10 @@ # @ohos.hidebug (HiDebug) -The **hidebug** module provides APIs for you to obtain the memory usage of an application, including the static heap memory (native heap) and proportional set size (PSS) occupied by the application process. You can also export VM memory slices and collect VM CPU profiling data. - -> **NOTE**
+> **NOTE** +> > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. +The **hidebug** module provides APIs for you to obtain the memory usage of an application, including the static heap memory (native heap) and proportional set size (PSS) occupied by the application process. You can also export VM memory slices and collect VM CPU profiling data. ## Modules to Import @@ -19,31 +19,25 @@ getNativeHeapSize(): bigint Obtains the total heap memory size of this application. -This API is defined but not implemented in OpenHarmony 3.1 Release. - **System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug **Return value** -| Type | Description | +| Type | Description | | ------ | --------------------------- | | bigint | Total heap memory size of the application, in KB.| - **Example** ```js let nativeHeapSize = hidebug.getNativeHeapSize(); ``` - ## hidebug.getNativeHeapAllocatedSize getNativeHeapAllocatedSize(): bigint Obtains the allocated heap memory size of this application. -This API is defined but not implemented in OpenHarmony 3.1 Release. - **System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug **Return value** @@ -58,15 +52,12 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. let nativeHeapAllocatedSize = hidebug.getNativeHeapAllocatedSize(); ``` - ## hidebug.getNativeHeapFreeSize getNativeHeapFreeSize(): bigint Obtains the free heap memory size of this application. -This API is defined but not implemented in OpenHarmony 3.1 Release. - **System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug **Return value** @@ -80,7 +71,6 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. let nativeHeapFreeSize = hidebug.getNativeHeapFreeSize(); ``` - ## hidebug.getPss getPss(): bigint @@ -100,7 +90,6 @@ Obtains the size of the physical memory actually used by the application process let pss = hidebug.getPss(); ``` - ## hidebug.getSharedDirty getSharedDirty(): bigint @@ -135,7 +124,6 @@ Obtains the size of the private dirty memory of a process. | ------ | -------------------------- | | bigint | Size of the private dirty memory of the process, in KB.| - **Example** ```js let privateDirty = hidebug.getPrivateDirty(); @@ -163,76 +151,6 @@ For example, if the CPU usage is **50%**, **0.5** is returned. let cpuUsage = hidebug.getCpuUsage(); ``` -## hidebug.startProfiling(deprecated) - -startProfiling(filename : string) : void - -> **NOTE**
This API is deprecated since API version 9. You are advised to use [hidebug.startJsCpuProfiling](#hidebugstartjscpuprofiling9) instead. - -Starts the profiling method. `startProfiling()` and `stopProfiling()` are called in pairs. `startProfiling()` always occurs before `stopProfiling()`; that is, calling the functions in the sequence similar to the following is prohibited: `start->start->stop`, `start->stop->stop`, and `start->start->stop->stop`. - -**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------ | ---- | ------------------------------------------------------------ | -| filename | string | Yes | User-defined profile name. The `filename.json` file is generated in the `files` directory of the application based on the specified `filename`.| - -**Example** - -```js -hidebug.startProfiling("cpuprofiler-20220216"); -// code block -// ... -// code block -hidebug.stopProfiling(); -``` - - - -## hidebug.stopProfiling(deprecated) - -stopProfiling() : void - -> **NOTE**
This API is deprecated since API version 9. You are advised to use [hidebug.stopJsCpuProfiling](#hidebugstopjscpuprofiling9) instead. - -Stops the profiling method. `startProfiling()` and `stopProfiling()` are called in pairs. `startProfiling()` always occurs before `stopProfiling()`; that is, calling the functions in the sequence similar to the following is prohibited: `start->start->stop`, `start->stop->stop`, and `start->start->stop->stop`. - -**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug - -**Example** - -```js -hidebug.startProfiling("cpuprofiler-20220216"); -// code block -// ... -// code block -hidebug.stopProfiling(); -``` - -## hidebug.dumpHeapData(deprecated) - -dumpHeapData(filename : string) : void - -> **NOTE**
This API is deprecated since API version 9. You are advised to use [hidebug.dumpJsHeapData](#hidebugdumpjsheapdata9) instead. - -Exports the heap data. - -**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------ | ---- | ------------------------------------------------------------ | -| filename | string | Yes | User-defined heap file name. The `filename.heapsnapshot` file is generated in the `files` directory of the application based on the specified `filename`.| - -**Example** - -```js -hidebug.dumpHeapData("heap-20220216"); -``` - ## hidebug.getServiceDump9+ getServiceDump(serviceid : number, fd : number, args : Array\) : void @@ -360,3 +278,71 @@ try { console.info(error.message) } ``` + +## hidebug.startProfiling(deprecated) + +startProfiling(filename : string) : void + +> **NOTE**
This API is deprecated since API version 9. You are advised to use [hidebug.startJsCpuProfiling](#hidebugstartjscpuprofiling9) instead. + +Starts the profiling method. `startProfiling()` and `stopProfiling()` are called in pairs. `startProfiling()` always occurs before `stopProfiling()`; that is, calling the functions in the sequence similar to the following is prohibited: `start->start->stop`, `start->stop->stop`, and `start->start->stop->stop`. + +**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| filename | string | Yes | User-defined profile name. The `filename.json` file is generated in the `files` directory of the application based on the specified `filename`.| + +**Example** + +```js +hidebug.startProfiling("cpuprofiler-20220216"); +// code block +// ... +// code block +hidebug.stopProfiling(); +``` + +## hidebug.stopProfiling(deprecated) + +stopProfiling() : void + +> **NOTE**
This API is deprecated since API version 9. You are advised to use [hidebug.stopJsCpuProfiling](#hidebugstopjscpuprofiling9) instead. + +Stops the profiling method. `startProfiling()` and `stopProfiling()` are called in pairs. `startProfiling()` always occurs before `stopProfiling()`; that is, calling the functions in the sequence similar to the following is prohibited: `start->start->stop`, `start->stop->stop`, and `start->start->stop->stop`. + +**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug + +**Example** + +```js +hidebug.startProfiling("cpuprofiler-20220216"); +// code block +// ... +// code block +hidebug.stopProfiling(); +``` + +## hidebug.dumpHeapData(deprecated) + +dumpHeapData(filename : string) : void + +> **NOTE**
This API is deprecated since API version 9. You are advised to use [hidebug.dumpJsHeapData](#hidebugdumpjsheapdata9) instead. + +Exports the heap data. + +**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| filename | string | Yes | User-defined heap file name. The `filename.heapsnapshot` file is generated in the `files` directory of the application based on the specified `filename`.| + +**Example** + +```js +hidebug.dumpHeapData("heap-20220216"); +``` diff --git a/en/application-dev/reference/apis/js-apis-http.md b/en/application-dev/reference/apis/js-apis-http.md index 820cba210b6b8b43578733c1a2eb060177aa5995..e884f1f348b6754b4f8c8703220a1dcd8a4eb19d 100644 --- a/en/application-dev/reference/apis/js-apis-http.md +++ b/en/application-dev/reference/apis/js-apis-http.md @@ -1,6 +1,6 @@ # @ohos.net.http (Data Request) -This module provides the HTTP data request capability. An application can initiate a data request over HTTP. Common HTTP methods include **GET**, **POST**, **OPTIONS**, **HEAD**, **PUT**, **DELETE**, **TRACE**, and **CONNECT**. +The **http** module provides the HTTP data request capability. An application can initiate a data request over HTTP. Common HTTP methods include **GET**, **POST**, **OPTIONS**, **HEAD**, **PUT**, **DELETE**, **TRACE**, and **CONNECT**. >**NOTE** > @@ -13,10 +13,10 @@ This module provides the HTTP data request capability. An application can initia import http from '@ohos.net.http'; ``` -## Example +## Examples ```js -// Import the http namespace. +// Import the HTTP namespace. import http from '@ohos.net.http'; // Each httpRequest corresponds to an HTTP request task and cannot be reused. @@ -27,7 +27,7 @@ httpRequest.on('headersReceive', (header) => { console.info('header: ' + JSON.stringify(header)); }); httpRequest.request( - // Customize EXAMPLE_URL on your own. It is up to you whether to add parameters to the URL. + // Customize EXAMPLE_URL in extraData on your own. It is up to you whether to add parameters to the URL. "EXAMPLE_URL", { method: http.RequestMethod.POST, // Optional. The default value is http.RequestMethod.GET. @@ -69,7 +69,7 @@ httpRequest.request( createHttp(): HttpRequest -Creates an HTTP request. You can use this API to initiate or destroy an HTTP request, or enable or disable listening for HTTP Response Header events. An HttpRequest object corresponds to an HTTP request. To initiate multiple HTTP requests, you must create an **HttpRequest** object for each HTTP request. +Creates an HTTP request. You can use this API to initiate or destroy an HTTP request, or enable or disable listening for HTTP Response Header events. An **HttpRequest** object corresponds to an HTTP request. To initiate multiple HTTP requests, you must create an **HttpRequest** object for each HTTP request. **System capability**: SystemCapability.Communication.NetStack @@ -112,7 +112,7 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback **Error codes** -| Code | Error Message | +| ID | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -164,7 +164,7 @@ Initiates an HTTP request containing specified options to a given URL. This API **Error codes** -| Code | Error Message | +| ID | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -231,7 +231,7 @@ httpRequest.request("EXAMPLE_URL", request(url: string, options? : HttpRequestOptions): Promise\ -Initiates an HTTP request to a given URL. This API uses a promise to return the result. +Initiates an HTTP request containing specified options to a given URL. This API uses a promise to return the result. >**NOTE** >This API supports only transfer of data not greater than 5 MB. @@ -255,7 +255,7 @@ Initiates an HTTP request to a given URL. This API uses a promise to return the **Error codes** -| Code | Error Message | +| ID | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -332,7 +332,7 @@ httpRequest.destroy(); ### request210+ -request2(url: string, callback: AsyncCallback\): void +request2(url: string, callback: AsyncCallback\): void Initiates an HTTP request to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response. @@ -345,11 +345,11 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback | Name | Type | Mandatory| Description | | -------- | ---------------------------------------------- | ---- | ----------------------------------------------- | | url | string | Yes | URL for initiating an HTTP request. | -| callback | AsyncCallback\ | Yes | Callback used to return the result. | +| callback | AsyncCallback\<[number](#responsecode)\> | Yes | Callback used to return the result. | **Error codes** -| Code | Error Message | +| ID | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -366,9 +366,9 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback **Example** ```js -httpRequest.request2("EXAMPLE_URL", (err) => { +httpRequest.request2("EXAMPLE_URL", (err, data) => { if (!err) { - console.info("request2 OK!"); + console.info("request2 OK! ResponseCode is " + JSON.stringify(data)); } else { console.info("request2 ERROR : err = " + JSON.stringify(err)); } @@ -377,7 +377,7 @@ httpRequest.request2("EXAMPLE_URL", (err) => { ### request210+ -request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\): void +request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\): void Initiates an HTTP request to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response. @@ -391,11 +391,11 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback | -------- | ---------------------------------------------- | ---- | ----------------------------------------------- | | url | string | Yes | URL for initiating an HTTP request. | | options | HttpRequestOptions | Yes | Request options. For details, see [HttpRequestOptions](#httprequestoptions).| -| callback | AsyncCallback\ | Yes | Callback used to return the result. | +| callback | AsyncCallback\<[number](#responsecode)\> | Yes | Callback used to return the result. | **Error codes** -| Code | Error Message | +| ID | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -444,9 +444,9 @@ httpRequest.request2("EXAMPLE_URL", }, readTimeout: 60000, connectTimeout: 60000 -}, (err) => { +}, (err, data) => { if (!err) { - console.info("request2 OK!"); + console.info("request2 OK! ResponseCode is " + JSON.stringify(data)); } else { console.info("request2 ERROR : err = " + JSON.stringify(err)); } @@ -454,7 +454,7 @@ httpRequest.request2("EXAMPLE_URL", ``` ### request210+ -request2(url: string, options? : HttpRequestOptions): Promise\ +request2(url: string, options? : HttpRequestOptions): Promise\ Initiates an HTTP request containing specified options to a given URL. This API uses a promise to return the result, which is a streaming response. @@ -473,11 +473,11 @@ Initiates an HTTP request containing specified options to a given URL. This API | Type | Description | | :------------------------------------- | :-------------------------------- | -| Promise\ | Promise used to return the result.| +| Promise\<[number](#responsecode)\> | Promise used to return the result.| **Error codes** -| Code | Error Message | +| ID | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -513,7 +513,7 @@ Initiates an HTTP request containing specified options to a given URL. This API >**NOTE** > For details about the error codes, see [HTTP Error Codes](../errorcodes/errorcode-net-http.md). -> The HTTP error code mapping is in the format of 2300000 + Curl error code. For more common error codes, see [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html). +> The HTTP error code mapping is in the format of 2300000 + Curl error code. For more common error codes, see: **Example** @@ -526,8 +526,8 @@ let promise = httpRequest.request("EXAMPLE_URL", { 'Content-Type': 'application/json' } }); -promise.then(() => { - console.info("request2 OK!"); +promise.then((data) => { + console.info("request2 OK!" + JSON.stringify(data)); }).catch((err) => { console.info("request2 ERROR : err = " + JSON.stringify(err)); }); @@ -839,7 +839,7 @@ Enumerates the response codes for an HTTP request. | Name | Value | Description | | ----------------- | ---- | ------------------------------------------------------------ | -| OK | 200 | The request is successful. The request has been processed successfully. This return code is generally used for GET and POST requests. | +| OK | 200 | "OK." The request has been processed successfully. This return code is generally used for GET and POST requests. | | CREATED | 201 | "Created." The request has been successfully sent and a new resource is created. | | ACCEPTED | 202 | "Accepted." The request has been accepted, but the processing has not been completed. | | NOT_AUTHORITATIVE | 203 | "Non-Authoritative Information." The request is successful. | @@ -1007,7 +1007,7 @@ Disables the cache and deletes the data in it. This API uses a promise to return | Type | Description | | --------------------------------- | ------------------------------------- | -| Promise\ | Promise used to return the result.| +| Promise\ | Promise used to return the result.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-net-connection.md b/en/application-dev/reference/apis/js-apis-net-connection.md index adb1c8ee47ae8dc076f5b2c2f00b2c2ca92a2cd5..f5c48ddd07342118d752a82a00972aec398685ea 100644 --- a/en/application-dev/reference/apis/js-apis-net-connection.md +++ b/en/application-dev/reference/apis/js-apis-net-connection.md @@ -294,8 +294,8 @@ let httpProxy = { port: 8080, exclusionList: exclusionArray } -connection.setGlobalHttpProxy(httpProxy).then((error, data) => { - console.info(JSON.stringify(data)); +connection.setGlobalHttpProxy(httpProxy).then(() => { + console.info("success"); }).catch(error=>{ console.info(JSON.stringify(error)); }) @@ -436,8 +436,8 @@ Binds an application to the specified network, so that the application can acces ```js connection.getDefaultNet().then(function (netHandle) { - connection.setAppNet(netHandle).then((error, data) => { - console.log(JSON.stringify(data)) + connection.setAppNet(netHandle).then(() => { + console.log("success") }).catch(error => { console.log(JSON.stringify(error)) }) @@ -1097,7 +1097,7 @@ getAddressesByName(host: string, callback: AsyncCallback\>): Resolves the host name by using the default network to obtain all IP addresses. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.GET_NETWORK_INFO +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetManager.Core @@ -1134,7 +1134,7 @@ getAddressesByName(host: string): Promise\> Resolves the host name by using the default network to obtain all IP addresses. This API uses a promise to return the result. -**Required permission**: ohos.permission.GET_NETWORK_INFO +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetManager.Core @@ -1639,7 +1639,7 @@ getAddressesByName(host: string, callback: AsyncCallback\>): Resolves the host name by using the corresponding network to obtain all IP addresses. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.GET_NETWORK_INFO +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetManager.Core @@ -1678,7 +1678,7 @@ getAddressesByName(host: string): Promise\> Resolves the host name by using the corresponding network to obtain all IP addresses. This API uses a promise to return the result. -**Required permission**: ohos.permission.GET_NETWORK_INFO +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetManager.Core @@ -1721,7 +1721,7 @@ getAddressByName(host: string, callback: AsyncCallback\): void Resolves the host name by using the corresponding network to obtain the first IP address. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.GET_NETWORK_INFO +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetManager.Core @@ -1760,7 +1760,7 @@ getAddressByName(host: string): Promise\ Resolves the host name by using the corresponding network to obtain the first IP address. This API uses a promise to return the result. -**Required permission**: ohos.permission.GET_NETWORK_INFO +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetManager.Core diff --git a/en/application-dev/reference/apis/js-apis-observer.md b/en/application-dev/reference/apis/js-apis-observer.md index 3c46e47479de6cacc6a0a2613f0aa422aad9aff8..b0e30e22190f5242d16e4be0b815bcf4c4109f30 100644 --- a/en/application-dev/reference/apis/js-apis-observer.md +++ b/en/application-dev/reference/apis/js-apis-observer.md @@ -25,13 +25,15 @@ Registers an observer for network status change events. This API uses an asynchr **Parameters** -| Name | Type | Mandatory| Description | -| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Network status change event. | +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------------------------- | ---- | ---------------------------------------------------------------- | +| type | string | Yes | Network status change event. This field has a fixed value of **networkStateChange**. | | callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | Yes | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -62,14 +64,16 @@ Registers an observer for network status change events of the SIM card in the sp **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------------------------- | -| type | string | Yes | Network status change event. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------------------------- | ---- | ---------------------------------------------------------------- | +| type | string | Yes | Network status change event. This field has a fixed value of **networkStateChange**. | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | Yes | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -104,7 +108,7 @@ Unregisters the observer for network status change events. This API uses an asyn | Name | Type | Mandatory| Description | | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Network status change event. | +| type | string | Yes | Network status change event. This field has a fixed value of **networkStateChange**. | | callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | No | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).| | ID| Error Message | @@ -138,12 +142,14 @@ Registers an observer for signal status change events. This API uses an asynchro **Parameters** | Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Signal information change event. | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. | | callback | Callback\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -172,14 +178,16 @@ Registers an observer for signal status change events of the SIM card in the spe **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------------------------- | -| type | string | Yes | Signal information change event. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -214,11 +222,13 @@ Unregisters the observer for signal status change events. This API uses an async | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Signal information change event. | +| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. | | callback | Callback\> | No | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -255,7 +265,7 @@ Registers an observer for cell information change events. This API uses an async | Name | Type | Mandatory| Description | | -------- | --------------------------------------------------------- | ---- |------------------------------------------------------------| -| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**. | +| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**. | | callback | Callback\<[CellInformation](js-apis-radio.md#cellinformation8)\> | Yes | Callback used to return the result.| **Error codes** @@ -370,12 +380,14 @@ Registers an observer for call status change events. This API uses an asynchrono **Parameters** | Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Call status change event. | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | Yes | Call status change event. This field has a fixed value of **callStateChange**. | | callback | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | Yes | Callback function. For details, see [CallState](js-apis-call.md#callstate) in call.
**number**: phone number.| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -404,13 +416,15 @@ Registers an observer for call status change events. This API uses an asynchrono **Parameters** | Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Call status change event. | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | Yes | Call status change event. This field has a fixed value of **callStateChange**. | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | Yes | Callback function. For details, see [CallState](js-apis-call.md#callstate) in call.
**number**: phone number.| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -443,12 +457,14 @@ Unregisters the observer for call status change events. This API uses an asynchr **Parameters** | Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Call status change event. | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | Yes | Call status change event. This field has a fixed value of **callStateChange**. | | callback | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | No | Callback function. For details, see [CallState](js-apis-call.md#callstate) in call.
**number**: phone number.| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -482,11 +498,13 @@ Registers an observer for connection status change events of the cellular data l | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Connection status change event of the cellular data link. | +| type | string | Yes | Cellular data connection status event. This field has a fixed value of **cellularDataConnectionStateChange**.| | callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | Yes | Callback used to return the result. For details, see [DataConnectState](js-apis-telephony-data.md#dataconnectstate) and [RadioTechnology](js-apis-radio.md#radiotechnology).| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -516,12 +534,14 @@ Registers an observer for connection status change events of the cellular data l | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Connection status change event of the cellular data link. | +| type | string | Yes | Cellular data connection status event. This field has a fixed value of **cellularDataConnectionStateChange**.| | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | Yes | Callback used to return the result. For details, see [DataConnectState](js-apis-telephony-data.md#dataconnectstate) and [RadioTechnology](js-apis-radio.md#radiotechnology).| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -555,11 +575,13 @@ Unregisters the observer for connection status change events of the cellular dat | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Connection status change event of the cellular data link. | +| type | string | Yes | Cellular data connection status event. This field has a fixed value of **cellularDataConnectionStateChange**.| | callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | No | Callback used to return the result. For details, see [DataConnectState](js-apis-telephony-data.md#dataconnectstate) and [RadioTechnology](js-apis-radio.md#radiotechnology).| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -593,11 +615,13 @@ Registers an observer for the uplink and downlink data flow status change events | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Uplink and downlink data flow status change event of the cellular data service. | +| type | string | Yes | Cellular data flow change event. This field has a fixed value of **cellularDataFlowChange**. | | callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | Yes | Callback used to return the result. For details, see [DataFlowType](js-apis-telephony-data.md#dataflowtype).| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -627,12 +651,14 @@ Registers an observer for the uplink and downlink data flow status change events | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Uplink and downlink data flow status change event of the cellular data service. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | +| type | string | Yes | Cellular data flow change event. This field has a fixed value of **cellularDataFlowChange**. | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | Yes | Callback used to return the result. For details, see [DataFlowType](js-apis-telephony-data.md#dataflowtype).| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -664,13 +690,15 @@ Unregisters the observer for the uplink and downlink data flow status change eve **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Uplink and downlink data flow status change event of the cellular data service. | +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| type | string | Yes | Cellular data flow change event. This field has a fixed value of **cellularDataFlowChange**. | | callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | No | Callback used to return the result. For details, see [DataFlowType](js-apis-telephony-data.md#dataflowtype).| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -703,12 +731,14 @@ Registers an observer for SIM card status change events. This API uses an asynch **Parameters** | Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | SIM card status change event. | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | Yes | SIM status change event. This field has a fixed value of **simStateChange**. | | callback | Callback\<[SimStateData](#simstatedata7)\> | Yes | Callback used to return the result.| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -738,12 +768,14 @@ Registers an observer for status change events of the SIM card in the specified | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | SIM card status change event. | +| type | string | Yes | SIM status change event. This field has a fixed value of **simStateChange**. | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\<[SimStateData](#simstatedata7)\> | Yes | Callback used to return the result.| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -777,11 +809,13 @@ Unregisters the observer for SIM card status change events. This API uses an asy | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | SIM card status change event. | +| type | string | Yes | SIM status change event. This field has a fixed value of **simStateChange**. | | callback | Callback\<[SimStateData](#simstatedata7)\> | No | Callback used to return the result.| **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | diff --git a/en/application-dev/reference/apis/js-apis-radio.md b/en/application-dev/reference/apis/js-apis-radio.md index 448ccd3dc7d40a17edfdb7b0862cefe3a2377f9e..15c1fc484dd8987dd26c9229beeb200ba8a711e9 100644 --- a/en/application-dev/reference/apis/js-apis-radio.md +++ b/en/application-dev/reference/apis/js-apis-radio.md @@ -32,6 +32,8 @@ Obtains the RAT used in the CS and PS domains for the SIM card in the specified **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -75,6 +77,8 @@ Obtains the RAT used in the CS and PS domains for the SIM card in the specified **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -115,6 +119,8 @@ Obtains the network status. This API uses an asynchronous callback to return the **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -152,6 +158,8 @@ Obtains the network status. This API uses an asynchronous callback to return the **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -195,6 +203,8 @@ Obtains the network status. This API uses a promise to return the result. **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -234,6 +244,8 @@ Obtains the network selection mode of the SIM card in the specified slot. This A **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -274,6 +286,8 @@ Obtains the network selection mode of the SIM card in the specified slot. This A **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -312,6 +326,8 @@ Obtains the ISO country code of the network with which the SIM card in the speci **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -352,6 +368,8 @@ Obtains the ISO country code of the network with which the SIM card in the speci **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -389,6 +407,8 @@ Obtains the ID of the slot in which the primary card is located. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 8300001 | Invalid parameter value. | @@ -421,6 +441,8 @@ Obtains the ID of the slot in which the primary card is located. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 8300001 | Invalid parameter value. | @@ -457,6 +479,8 @@ Obtains a list of signal strengths of the network with which the SIM card in the **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -497,6 +521,8 @@ Obtains a list of signal strengths of the network with which the SIM card in the **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -644,6 +670,8 @@ Checks whether the radio service is enabled on the primary SIM card. This API us **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -681,6 +709,8 @@ Checks whether the radio service is enabled on the SIM card in the specified slo **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -724,6 +754,8 @@ Checks whether the radio service is enabled on the SIM card in the specified slo **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -763,6 +795,8 @@ Obtains the carrier name for the SIM card in the specified slot. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -803,6 +837,8 @@ Obtains the carrier name for the SIM card in the specified slot. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -844,6 +880,8 @@ Sets the ID of the slot in which the primary card is located. This API uses an a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -858,8 +896,8 @@ Sets the ID of the slot in which the primary card is located. This API uses an a ```js let slotId = 0; -radio.setPrimarySlotId(slotId, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.setPrimarySlotId(slotId, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -890,6 +928,8 @@ Sets the ID of the slot in which the primary card is located. This API uses a pr **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -905,9 +945,9 @@ Sets the ID of the slot in which the primary card is located. This API uses a pr ```js let slotId = 0; let promise = radio.setPrimarySlotId(slotId); -promise.then(data => { - console.log(`setPrimarySlotId success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setPrimarySlotId success.`); +}).catch((err) => { console.log(`setPrimarySlotId failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -932,6 +972,8 @@ Obtains the IMEI of the SIM card in a card slot. This API uses an asynchronous c **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -971,6 +1013,8 @@ Obtains the IMEI of the SIM card in the specified card slot. This API uses an as **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1016,6 +1060,8 @@ Obtains the IMEI of the SIM card in the specified card slot. This API uses a pro **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1057,6 +1103,8 @@ Obtains the MEID of the SIM card in a card slot. This API uses an asynchronous c **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1096,6 +1144,8 @@ Obtains the MEID of the SIM card in the specified card slot. This API uses an as **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1141,6 +1191,8 @@ Obtains the MEID of the SIM card in the specified card slot. This API uses a pro **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1182,6 +1234,8 @@ Obtains the unique device ID of the SIM card in a card slot. This API uses an as **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1221,6 +1275,8 @@ Obtains the unique device ID of the SIM card in the specified card slot. This AP **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1266,6 +1322,8 @@ Obtains the unique device ID of the SIM card in the specified card slot. This AP **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1307,6 +1365,8 @@ Sends a cell location update request. This API uses an asynchronous callback to **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1319,8 +1379,8 @@ Sends a cell location update request. This API uses an asynchronous callback to **Example** ```js -radio.sendUpdateCellLocationRequest((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.sendUpdateCellLocationRequest((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1345,6 +1405,8 @@ Sends a cell location update request for the SIM card in the specified slot. Thi **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1358,8 +1420,8 @@ Sends a cell location update request for the SIM card in the specified slot. Thi ```js let slotId = 0; -radio.sendUpdateCellLocationRequest(slotId, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.sendUpdateCellLocationRequest(slotId, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1389,6 +1451,8 @@ Sends a cell location update request for the SIM card in the specified slot. Thi **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1402,10 +1466,9 @@ Sends a cell location update request for the SIM card in the specified slot. Thi ```js let slotId = 0; -let promise = radio.sendUpdateCellLocationRequest(slotId); -promise.then(data => { - console.log(`sendUpdateCellLocationRequest success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +radio.sendUpdateCellLocationRequest(slotId).then(() => { + console.log(`sendUpdateCellLocationRequest success.`); +}).catch((err) => { console.log(`sendUpdateCellLocationRequest failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1430,6 +1493,8 @@ Obtains cell information. This API uses an asynchronous callback to return the r **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1469,6 +1534,8 @@ Obtains cell information for the SIM card in the specified slot. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1514,6 +1581,8 @@ Obtains cell information for the SIM card in the specified slot. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1556,6 +1625,8 @@ Sets the network selection mode. This API uses an asynchronous callback to retur **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1580,8 +1651,8 @@ let networkSelectionModeOptions={ networkInformation: networkInformation, resumeSelection: true } -radio.setNetworkSelectionMode(networkSelectionModeOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.setNetworkSelectionMode(networkSelectionModeOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1611,6 +1682,8 @@ Sets the network selection mode. This API uses a promise to return the result. **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1636,9 +1709,9 @@ let networkSelectionModeOptions={ resumeSelection: true } let promise = radio.setNetworkSelectionMode(networkSelectionModeOptions); -promise.then(data => { - console.log(`setNetworkSelectionMode success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setNetworkSelectionMode success.`); +}).catch((err) => { console.log(`setNetworkSelectionMode failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1664,6 +1737,8 @@ Obtains network search information for the SIM card in the specified slot. This **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1707,6 +1782,8 @@ Obtains network search information for the SIM card in the specified slot. This **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1745,6 +1822,8 @@ Obtains the NR option mode. This API uses an asynchronous callback to return the **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1781,6 +1860,8 @@ Obtains the NR option mode for the SIM card in the specified slot. This API uses **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1823,6 +1904,8 @@ Obtains the NR option mode for the SIM card in the specified slot. This API uses **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1863,6 +1946,8 @@ Turns on the radio function. This API uses an asynchronous callback to return th **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1875,8 +1960,8 @@ Turns on the radio function. This API uses an asynchronous callback to return th **Example** ```js -radio.turnOnRadio((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.turnOnRadio((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1902,6 +1987,8 @@ Turns on the radio function for the SIM card in the specified slot. This API use **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1915,8 +2002,8 @@ Turns on the radio function for the SIM card in the specified slot. This API use ```js let slotId = 0; -radio.turnOnRadio(slotId, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.turnOnRadio(slotId, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1947,6 +2034,8 @@ Turns on the radio function for the SIM card in the specified slot. This API use **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1960,10 +2049,9 @@ Turns on the radio function for the SIM card in the specified slot. This API use ```js let slotId = 0; -let promise = radio.turnOnRadio(slotId); -promise.then(data => { - console.log(`turnOnRadio success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +radio.turnOnRadio(slotId).then(() => { + console.log(`turnOnRadio success.`); +}).catch((err) => { console.error(`turnOnRadio failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1988,6 +2076,8 @@ Turns off the radio function. This API uses an asynchronous callback to return t **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2000,8 +2090,8 @@ Turns off the radio function. This API uses an asynchronous callback to return t **Example** ```js -radio.turnOffRadio((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.turnOffRadio((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2027,6 +2117,8 @@ Turns off the radio function for the SIM card in the specified slot. This API us **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2040,8 +2132,8 @@ Turns off the radio function for the SIM card in the specified slot. This API us ```js let slotId = 0; -radio.turnOffRadio(slotId, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.turnOffRadio(slotId, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2072,6 +2164,8 @@ Turns off the radio function for the SIM card in the specified slot. This API us **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2085,10 +2179,9 @@ Turns off the radio function for the SIM card in the specified slot. This API us ```js let slotId = 0; -let promise = radio.turnOffRadio(slotId); -promise.then(data => { - console.log(`turnOffRadio success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +radio.turnOffRadio(slotId).then(() => { + console.log(`turnOffRadio success.`); +}).catch((err) => { console.error(`turnOffRadio failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2115,6 +2208,8 @@ Sets the preferred network for the SIM card in the specified slot. This API uses **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2127,8 +2222,9 @@ Sets the preferred network for the SIM card in the specified slot. This API uses **Example** ```js -radio.setPreferredNetwork(0, 1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +let slotId = 0; +radio.setPreferredNetwork(slotId, radio.PreferredNetworkMode.PREFERRED_NETWORK_MODE_GSM, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2159,7 +2255,9 @@ Sets the preferred network for the SIM card in the specified slot. This API uses **Error codes** -| ID| Error Message | +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | | 401 | Parameter error. | @@ -2171,10 +2269,10 @@ Sets the preferred network for the SIM card in the specified slot. This API uses **Example** ```js -let promise = radio.setPreferredNetwork(0, 1); -promise.then(data => { - console.log(`setPreferredNetwork success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +let slotId = 0; +radio.setPreferredNetwork(slotId, radio.PreferredNetworkMode.PREFERRED_NETWORK_MODE_GSM).then(() => { + console.log(`setPreferredNetwork success.`); +}).catch((err) => { console.log(`setPreferredNetwork failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2200,6 +2298,8 @@ Obtains the preferred network for the SIM card in the specified slot. This API u **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2243,6 +2343,8 @@ Obtains the preferred network for the SIM card in the specified slot. This API u **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2285,6 +2387,8 @@ Obtains the IMS registration status of the specified IMS service type for the SI **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2329,6 +2433,8 @@ Obtains the IMS registration status of the specified IMS service type for the SI **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2372,6 +2478,8 @@ Enables listening for **imsRegStateChange** events. This API uses an asynchronou **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2412,6 +2520,8 @@ Disables listening for **imsRegStateChange** events. This API uses an asynchrono **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | diff --git a/en/application-dev/reference/apis/js-apis-resource-manager.md b/en/application-dev/reference/apis/js-apis-resource-manager.md index 41d18e140d9442384c32d7ccbd94ccc153b8ca07..cc24c7ab23912cb3abb8f2ee648c0be026565aac 100644 --- a/en/application-dev/reference/apis/js-apis-resource-manager.md +++ b/en/application-dev/reference/apis/js-apis-resource-manager.md @@ -13,7 +13,7 @@ The Resource Manager module provides APIs to obtain information about applicatio import resourceManager from '@ohos.resourceManager'; ``` -## How to Use +## Instruction Since API version 9, the stage model allows an application to obtain a **ResourceManager** object based on **context** and call its resource management APIs without first importing the required bundle. This approach, however, is not applicable to the FA model. For the FA model, you need to import the required bundle and then call the [getResourceManager](#resourcemanagergetresourcemanager) API to obtain a **ResourceManager** object. For details about how to reference context in the stage model, see [Context in the Stage Model](../../application-models/application-context-stage.md). @@ -78,7 +78,7 @@ Obtains the **ResourceManager** object of an application based on the specified | Name | Type | Mandatory | Description | | ---------- | ---------------------------------------- | ---- | ----------------------------- | -| bundleName | string | Yes | Bundle name of the target application. | +| bundleName | string | Yes | Bundle name of the application. | | callback | AsyncCallback<[ResourceManager](#resourcemanager)> | Yes | Callback used to return the result.| **Example** @@ -118,7 +118,7 @@ Obtains the **ResourceManager** object of this application. This API uses a prom console.log("error is " + error); }); ``` -> **NOTE**
> In the sample code, **0x1000000** indicates the resource ID, which can be found in the compiled **ResourceTable.txt** file. +> **NOTE**
In the sample code, **0x1000000** indicates the resource ID, which can be found in the compiled **ResourceTable.txt** file. ## resourceManager.getResourceManager @@ -135,7 +135,7 @@ Obtains the **ResourceManager** object of an application based on the specified | Name | Type | Mandatory | Description | | ---------- | ------ | ---- | ------------- | -| bundleName | string | Yes | Bundle name of the target application.| +| bundleName | string | Yes | Bundle name of the application.| **Return value** @@ -171,12 +171,12 @@ Enumerates the device types. | Name | Value | Description | | -------------------- | ---- | ---- | -| DEVICE_TYPE_PHONE | 0x00 | Phone. | -| DEVICE_TYPE_TABLET | 0x01 | Tablet. | -| DEVICE_TYPE_CAR | 0x02 | Head unit. | -| DEVICE_TYPE_PC | 0x03 | PC. | -| DEVICE_TYPE_TV | 0x04 | TV. | -| DEVICE_TYPE_WEARABLE | 0x06 | Wearable. | +| DEVICE_TYPE_PHONE | 0x00 | Phone | +| DEVICE_TYPE_TABLET | 0x01 | Tablet | +| DEVICE_TYPE_CAR | 0x02 | Head unit | +| DEVICE_TYPE_PC | 0x03 | PC | +| DEVICE_TYPE_TV | 0x04 | TV | +| DEVICE_TYPE_WEARABLE | 0x06 | Wearable | ## ScreenDensity @@ -278,7 +278,7 @@ Defines the capability of accessing application resources. > **NOTE** > -> - The methods involved in **ResourceManager** are applicable only to the TypeScript-based declarative development paradigm. +> - The APIs involved in **ResourceManager** are applicable only to the TypeScript-based declarative development paradigm. > > - Resource files are defined in the **resources** directory of the project. You can obtain the resource ID using **$r(resource address).id**, for example, **$r('app.string.test').id**. @@ -645,7 +645,7 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco getMediaContent(resId: number, callback: AsyncCallback<Uint8Array>): void -Obtains the content of the media file corresponding to the specified resource name. This API uses an asynchronous callback to return the result. +Obtains the content of the media file corresponding to the specified resource ID. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Global.ResourceManager @@ -1658,7 +1658,7 @@ Obtains the string corresponding to the specified resource name. This API uses a | Type | Description | | --------------------- | ---------- | -| Promise<string> | Promise used to return the result.| +| Promise<string> | String corresponding to the resource name.| For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). @@ -1770,7 +1770,7 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco getMediaByName(resName: string, callback: AsyncCallback<Uint8Array>): void -Obtains the content of the media file corresponding to the specified resource name. This API uses an asynchronous callback to return the result. +Obtains the content of the media file corresponding to the specified resource ID. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Global.ResourceManager @@ -2036,7 +2036,7 @@ Obtains the string corresponding to the specified resource ID. This API returns | Type | Description | | ------ | ----------- | -| string | String corresponding to the specified resource ID.| +| string | Promise used to return the result.| For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). @@ -2075,7 +2075,7 @@ Obtains the string corresponding to the specified resource object. This API retu | Type | Description | | ------ | ---------------- | -| string | String corresponding to the resource object.| +| string | Promise used to return the result.| For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). @@ -2119,7 +2119,7 @@ Obtains the string corresponding to the specified resource name. This API return | Type | Description | | ------ | ---------- | -| string | String corresponding to the resource name.| +| string | String corresponding to the specified resource name.| For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). @@ -2395,6 +2395,142 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getDrawableDescriptor10+ + +getDrawableDescriptor(resId: number, density?: number): DrawableDescriptor; + +Obtains the **DrawableDescriptor** object based on the specified resource ID. This API returns the result synchronously. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----- | ------ | ---- | ----- | +| resId | number | Yes | Resource ID.| +| [density](#screendensity) | number | No | Screen density. The default value is **0**.| + +**Return value** + +| Type | Description | +| ------ | ---------- | +| DrawableDescriptor | **DrawableDescriptor** object corresponding to the resource ID.| + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +**Error codes** + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001001 | If the resId invalid. | +| 9001002 | If the resource not found by resId. | + +**Example** + ```ts + try { + this.context.resourceManager.getDrawableDescriptor($r('app.media.icon').id); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + try { + this.context.resourceManager.getDrawableDescriptor($r('app.media.icon').id, 120); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### getDrawableDescriptor10+ + +getDrawableDescriptor(resource: Resource, density?: number): DrawableDescriptor; + +Obtains the **DrawableDescriptor** object based on the specified resource. This API returns the result synchronously. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------- | ---- | ---- | +| resource | [Resource](#resource9) | Yes | Resource object.| +| [density](#screendensity) | number | No | Screen density. The default value is **0**.| + +**Return value** + +| Type | Description | +| ------- | ----------------- | +| DrawableDescriptor | **DrawableDescriptor** object corresponding to the resource ID.| + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +**Error codes** + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001001 | If the resId invalid. | +| 9001002 | If the resource not found by resId. | + +**Example** + ```ts + let resource = { + bundleName: "com.example.myapplication", + moduleName: "entry", + id: $r('app.media.icon').id + }; + try { + this.context.resourceManager.getDrawableDescriptor(resource); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + try { + this.context.resourceManager.getDrawableDescriptor(resource, 120); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### getDrawableDescriptorByName10+ + +getDrawableDescriptorByName(resName: string, density?: number): DrawableDescriptor; + +Obtains the **DrawableDescriptor** object based on the specified resource name. This API returns the result synchronously. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------- | ------ | ---- | ---- | +| resName | string | Yes | Resource name.| +| [density](#screendensity) | number | No | Screen density. The default value is **0**.| + +**Return value** + +| Type | Description | +| ------ | --------- | +| DrawableDescriptor | **DrawableDescriptor** object corresponding to the resource ID.| + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +**Error codes** + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001003 | If the resName invalid. | +| 9001004 | If the resource not found by resName. | + +**Example** + ```ts + try { + this.context.resourceManager.getDrawableDescriptorByName('icon'); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + try { + this.context.resourceManager.getDrawableDescriptorByName('icon', 120); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` ### getString(deprecated) @@ -2530,7 +2666,7 @@ This API is deprecated since API version 9. You are advised to use [getStringArr getMedia(resId: number, callback: AsyncCallback<Uint8Array>): void -Obtains the content of the media file corresponding to the specified resource name. This API uses an asynchronous callback to return the result. +Obtains the content of the media file corresponding to the specified resource ID. This API uses an asynchronous callback to return the result. This API is deprecated since API version 9. You are advised to use [getMediaContent](#getmediacontent9) instead. diff --git a/en/application-dev/reference/apis/js-apis-sim.md b/en/application-dev/reference/apis/js-apis-sim.md index f8d5e0d75a5425fcade12cd6f8f90e8cc5ee720a..6736cc90eca295e17310c295409a781f679db7d4 100644 --- a/en/application-dev/reference/apis/js-apis-sim.md +++ b/en/application-dev/reference/apis/js-apis-sim.md @@ -134,13 +134,14 @@ Checks whether the application (caller) has been granted the operator permission **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **Example** @@ -173,13 +174,14 @@ Checks whether the application (caller) has been granted the operator permission **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **Example** @@ -210,6 +212,8 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -250,6 +254,8 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -288,6 +294,8 @@ Obtains the public land mobile network \(PLMN\) ID of the SIM card in the specif **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -328,6 +336,8 @@ Obtains the PLMN ID of the SIM card in the specified slot. This API uses a promi **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -366,6 +376,8 @@ Obtains the service provider name (SPN) of the SIM card in the specified slot. T **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -406,6 +418,8 @@ Obtains the SPN of the SIM card in the specified slot. This API uses a promise t **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -444,13 +458,14 @@ Obtains the state of the SIM card in the specified slot. This API uses an asynch **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **Example** @@ -484,13 +499,14 @@ Obtains the state of the SIM card in the specified slot. This API uses a promise **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **Example** @@ -521,6 +537,8 @@ Obtains the type of the SIM card in the specified slot. This API uses an asynchr **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -561,6 +579,8 @@ Obtains the type of the SIM card in the specified slot. This API uses a promise **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -599,13 +619,14 @@ Checks whether the SIM card in the specified slot is installed. This API uses an **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **Example** @@ -639,13 +660,14 @@ Checks whether the SIM card in the specified slot is installed. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **Example** @@ -680,6 +702,8 @@ Obtains SIM card account information. This API uses an asynchronous callback to **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -726,6 +750,8 @@ Obtains SIM card account information. This API uses a promise to return the resu **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -768,6 +794,8 @@ Obtains the account information list of the active SIM card. This API uses an as **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -807,6 +835,8 @@ Obtains the account information list of the active SIM card. This API uses a pro **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -849,6 +879,8 @@ Sets the default slot ID of the SIM card that provides voice services. This API **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -863,8 +895,8 @@ Sets the default slot ID of the SIM card that provides voice services. This API **Example** ```js -sim.setDefaultVoiceSlotId(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.setDefaultVoiceSlotId(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -895,6 +927,8 @@ Sets the default slot ID of the SIM card that provides voice services. This API **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -910,9 +944,9 @@ Sets the default slot ID of the SIM card that provides voice services. This API ```js let promise = sim.setDefaultVoiceSlotId(0); -promise.then(data => { - console.log(`setDefaultVoiceSlotId success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setDefaultVoiceSlotId success.`); +}).catch((err) => { console.log(`setDefaultVoiceSlotId failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -939,6 +973,8 @@ Sets a display name for the SIM card in the specified slot. This API uses an asy **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -953,8 +989,8 @@ Sets a display name for the SIM card in the specified slot. This API uses an asy ```js let name = "ShowName"; -sim.setShowName(0, name, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.setShowName(0, name, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -985,6 +1021,8 @@ Sets a display name for the SIM card in the specified slot. This API uses a prom **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1000,9 +1038,9 @@ Sets a display name for the SIM card in the specified slot. This API uses a prom ```js let name = "ShowName"; let promise = sim.setShowName(0, name); -promise.then(data => { - console.log(`setShowName success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setShowName success.`); +}).catch((err) => { console.log(`setShowName failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1028,6 +1066,8 @@ Obtains the name of the SIM card in the specified slot. This API uses an asynchr **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1073,6 +1113,8 @@ Obtains the name of the SIM card in the specified slot. This API uses a promise **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1116,6 +1158,8 @@ Sets a display number for the SIM card in the specified slot. This API uses an a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1130,8 +1174,8 @@ Sets a display number for the SIM card in the specified slot. This API uses an a ```js let number = '+861xxxxxxxxxx'; -sim.setShowNumber(0, number, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.setShowNumber(0, number, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1163,6 +1207,8 @@ Sets a display number for the SIM card in the specified slot. This API uses a pr **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1178,9 +1224,9 @@ Sets a display number for the SIM card in the specified slot. This API uses a pr ```js let number = '+861xxxxxxxxxx'; let promise = sim.setShowNumber(0, number); -promise.then(data => { - console.log(`setShowNumber success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setShowNumber success.`); +}).catch((err) => { console.log(`setShowNumber failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1206,6 +1252,8 @@ Obtains the display number of the SIM card in the specified slot. This API uses **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1251,6 +1299,8 @@ Obtains the display number of the SIM card in the specified slot. This API uses **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1293,6 +1343,8 @@ Activates a SIM card in a specified card slot. This API uses an asynchronous cal **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1306,8 +1358,8 @@ Activates a SIM card in a specified card slot. This API uses an asynchronous cal **Example** ```js -sim.activateSim(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.activateSim(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1338,6 +1390,8 @@ Activates the SIM card in the specified slot. This API uses a promise to return **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1352,9 +1406,9 @@ Activates the SIM card in the specified slot. This API uses a promise to return ```js let promise = sim.activateSim(0); -promise.then(data => { - console.log(`activateSim success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`activateSim success.`); +}).catch((err) => { console.log(`activateSim failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1380,6 +1434,8 @@ Disables the SIM card in the specified slot. This API uses an asynchronous callb **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1393,8 +1449,8 @@ Disables the SIM card in the specified slot. This API uses an asynchronous callb **Example** ```js -sim.deactivateSim(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.deactivateSim(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1425,6 +1481,8 @@ Disables the SIM card in the specified slot. This API uses a promise to return t **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1439,9 +1497,9 @@ Disables the SIM card in the specified slot. This API uses a promise to return t ```js let promise = sim.deactivateSim(0); -promise.then(data => { - console.log(`deactivateSim success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`deactivateSim success.`); +}).catch((err) => { console.log(`deactivateSim failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1468,6 +1526,8 @@ Sets the lock status of the SIM card in the specified slot. This API uses an asy **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1520,6 +1580,8 @@ Sets the lock status of the SIM card in the specified slot. This API uses a prom **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1569,6 +1631,8 @@ Obtains the lock status of the SIM card in the specified slot. This API uses an **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1616,6 +1680,8 @@ Obtains the lock status of the SIM card in the specified slot. This API uses a p **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1661,6 +1727,8 @@ Changes the PIN of the SIM card in the specified slot. This API uses an asynchro **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1709,6 +1777,8 @@ Changes the PIN of the SIM card in the specified slot. This API uses a promise t **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1754,6 +1824,8 @@ Changes PIN 2 of the SIM card in the specified slot. This API uses an asynchrono **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1802,6 +1874,8 @@ Changes PIN 2 of the SIM card in the specified slot. This API uses a promise to **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1846,6 +1920,8 @@ Unlocks the PIN of the SIM card in the specified slot. This API uses an asynchro **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1894,6 +1970,8 @@ Unlocks the PIN of the SIM card in the specified slot. This API uses a promise t **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1940,6 +2018,8 @@ Unlocks the PUK of the SIM card in the specified slot. This API uses an asynchro **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1990,6 +2070,8 @@ Unlocks the PUK of the SIM card in the specified slot. This API uses a promise t **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2036,6 +2118,8 @@ Unlocks PIN 2 of the SIM card in the specified slot. This API uses an asynchrono **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2084,6 +2168,8 @@ Unlocks PIN 2 of the SIM card in the specified slot. This API uses a promise to **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2130,6 +2216,8 @@ Unlocks PUK 2 of the SIM card in the specified slot. This API uses an asynchrono **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2180,6 +2268,8 @@ Unlocks PUK 2 of the SIM card in the specified slot. This API uses a promise to **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2245,6 +2335,8 @@ Obtains the ICCID of the SIM card in the specified slot. This API uses an asynch **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2290,6 +2382,8 @@ Obtains the ICCID of the SIM card in the specified slot. This API uses a promise **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2332,6 +2426,8 @@ Obtains the voice mailbox alpha identifier of the SIM card in the specified slot **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2377,6 +2473,8 @@ Obtains the voice mailbox alpha identifier of the SIM card in the specified slot **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2419,6 +2517,8 @@ Obtains the voice mailbox number of the SIM card in the specified slot. This API **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2464,6 +2564,8 @@ Obtains the voice mailbox number of the SIM card in the specified slot. This API **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2509,6 +2611,8 @@ Sets voice mailbox information for the SIM card in the specified slot. This API **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2523,8 +2627,8 @@ Sets voice mailbox information for the SIM card in the specified slot. This API **Example** ```js -sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com", (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com", (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2557,6 +2661,8 @@ Sets voice mailbox information for the SIM card in the specified slot. This API **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2572,9 +2678,9 @@ Sets voice mailbox information for the SIM card in the specified slot. This API ```js let promise = sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com"); -promise.then(data => { - console.log(`setVoiceMailInfo success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setVoiceMailInfo success.`); +}).catch((err) => { console.log(`setVoiceMailInfo failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2600,6 +2706,8 @@ Obtains the MSISDN of the SIM card in the specified slot. This API uses an async **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2645,6 +2753,8 @@ Obtains the MSISDN of the SIM card in the specified slot. This API uses a promis **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2687,6 +2797,8 @@ Obtains the group identifier level 1 (GID1) of the SIM card in the specified slo **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2732,6 +2844,8 @@ Obtains the GID1 of the SIM card in the specified slot. This API uses a promise **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2774,6 +2888,8 @@ Obtains the international mobile subscriber identity (IMSI) of the SIM card in t **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2819,6 +2935,8 @@ Obtains the IMSI of the SIM card in the specified slot. This API uses a promise **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2861,6 +2979,8 @@ Obtains the carrier configuration of the SIM card in the specified slot. This AP **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2868,7 +2988,6 @@ Obtains the carrier configuration of the SIM card in the specified slot. This AP | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **Example** @@ -2906,6 +3025,8 @@ Obtains the carrier configuration of the SIM card in the specified slot. This AP **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2913,7 +3034,6 @@ Obtains the carrier configuration of the SIM card in the specified slot. This AP | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **Example** @@ -2949,6 +3069,8 @@ Queries contact numbers of the SIM card in the specified slot. This API uses an **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2996,6 +3118,8 @@ Queries contact numbers of the SIM card in the specified slot. This API uses a p **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3041,6 +3165,8 @@ Adds contact numbers for the SIM card in the specified slot. This API uses an as **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3060,8 +3186,8 @@ let diallingNumbersInof = { number: "138xxxxxxxx", pin2: "1234" }; -sim.addIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.addIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3094,6 +3220,8 @@ Adds contact numbers for the SIM card in the specified slot. This API uses a pro **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3113,9 +3241,9 @@ let diallingNumbersInof = { number: "138xxxxxxxx" }; let promise = sim.addIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof); -promise.then(data => { - console.log(`addIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`addIccDiallingNumbers success.`); +}).catch((err) => { console.log(`addIccDiallingNumbers failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3143,6 +3271,8 @@ Deletes contact numbers from the SIM card in the specified slot. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3163,8 +3293,8 @@ let diallingNumbersInof = { recordNumber: 123, pin2: "1234" }; -sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3197,6 +3327,8 @@ Deletes contact numbers from the SIM card in the specified slot. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3216,9 +3348,9 @@ let diallingNumbersInof = { number: "138xxxxxxxx" }; let promise = sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof); -promise.then(data => { - console.log(`delIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`delIccDiallingNumbers success.`); +}).catch((err) => { console.log(`delIccDiallingNumbers failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3246,6 +3378,8 @@ Updates contact numbers for the SIM card in the specified slot. This API uses an **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3266,8 +3400,8 @@ let diallingNumbersInof = { recordNumber: 123, pin2: "1234" }; -sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3300,6 +3434,8 @@ Updates contact numbers for the SIM card in the specified slot. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3320,9 +3456,9 @@ let diallingNumbersInof = { recordNumber: 123 }; let promise = sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof); -promise.then(data => { - console.log(`updateIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`updateIccDiallingNumbers success.`); +}).catch((err) => { console.log(`updateIccDiallingNumbers failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3349,6 +3485,8 @@ Sends an envelope command to the SIM card in the specified slot. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3362,8 +3500,8 @@ Sends an envelope command to the SIM card in the specified slot. This API uses a **Example** ```js -sim.sendEnvelopeCmd(0, "ls", (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.sendEnvelopeCmd(0, "ls", (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3395,6 +3533,8 @@ Sends an envelope command to the SIM card in the specified slot. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3409,9 +3549,9 @@ Sends an envelope command to the SIM card in the specified slot. This API uses a ```js let promise = sim.sendEnvelopeCmd(0, "ls"); -promise.then(data => { - console.log(`sendEnvelopeCmd success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`sendEnvelopeCmd success.`); +}).catch((err) => { console.log(`sendEnvelopeCmd failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3438,6 +3578,8 @@ Sends a terminal response command to the SIM card in the specified slot. This AP **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3451,8 +3593,8 @@ Sends a terminal response command to the SIM card in the specified slot. This AP **Example** ```js -sim.sendTerminalResponseCmd(0, "ls", (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.sendTerminalResponseCmd(0, "ls", (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3484,6 +3626,8 @@ Sends a terminal response command to the SIM card in the specified slot. This AP **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3498,9 +3642,9 @@ Sends a terminal response command to the SIM card in the specified slot. This AP ```js let promise = sim.sendTerminalResponseCmd(0, "ls"); -promise.then(data => { - console.log(`sendTerminalResponseCmd success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`sendTerminalResponseCmd success.`); +}).catch((err) => { console.log(`sendTerminalResponseCmd failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3528,6 +3672,8 @@ Unlocks the SIM card in the specified slot. This API uses an asynchronous callba **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3579,6 +3725,8 @@ Unlocks the SIM card in the specified slot. This API uses a promise to return th **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3622,6 +3770,8 @@ Obtains the opkey of the SIM card in the specified slot. This API uses an asynch **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3629,7 +3779,6 @@ Obtains the opkey of the SIM card in the specified slot. This API uses an asynch | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **Example** @@ -3671,6 +3820,8 @@ Obtains the opkey of the SIM card in the specified slot. This API uses a promise **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3678,7 +3829,6 @@ Obtains the opkey of the SIM card in the specified slot. This API uses a promise | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **Example** @@ -3709,6 +3859,8 @@ Obtains the OpName of the SIM card in the specified slot. This API uses an async **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3716,7 +3868,6 @@ Obtains the OpName of the SIM card in the specified slot. This API uses an async | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **Example** @@ -3758,6 +3909,8 @@ Obtains the OpName of the SIM card in the specified slot. This API uses a promis **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3765,7 +3918,6 @@ Obtains the OpName of the SIM card in the specified slot. This API uses a promis | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **Example** @@ -3847,17 +3999,17 @@ Enumerates personalized lock types. **System capability**: SystemCapability.Telephony.CoreService -| Name | Value | Description | -| ------------ | ---- | ----------------------------------------------- | -| PN_PIN_LOCK | 0 | Personalized network PIN lock. For details, see *3GPP TS 22.022 [33]*. | +| Name | Value | Description | +| ------------ | ---- | ------------------------------------------------ | +| PN_PIN_LOCK | 0 | Personalized network PIN lock. For details, see *3GPP TS 22.022 [33]*. | | PN_PUK_LOCK | 1 | Personalized network PUK lock. | -| PU_PIN_LOCK | 2 | Personalized network subset PIN lock. For details, see *3GPP TS 22.022 [33]*. | +| PU_PIN_LOCK | 2 | Personalized network subset PIN lock. For details, see *3GPP TS 22.022 [33]*. | | PU_PUK_LOCK | 3 | Personalized network subset PUK lock. | -| PP_PIN_LOCK | 4 | Personalized service provider PIN lock. For details, see *3GPP TS 22.022 [33]*.| +| PP_PIN_LOCK | 4 | Personalized service provider PIN lock. For details, see *3GPP TS 22.022 [33]*. | | PP_PUK_LOCK | 5 | Personalized service provider PUK lock. | -| PC_PIN_LOCK | 6 | Personalized corporate PIN lock. For details, see *3GPP TS 22.022 [33]*. | +| PC_PIN_LOCK | 6 | Personalized corporate PIN lock. For details, see *3GPP TS 22.022 [33]*. | | PC_PUK_LOCK | 7 | Personalized corporate PUK lock. | -| SIM_PIN_LOCK | 8 | Personalized SIM card PIN lock. For details, see *3GPP TS 22.022 [33]*. | +| SIM_PIN_LOCK | 8 | Personalized SIM card PIN lock. For details, see *3GPP TS 22.022 [33]*. | | SIM_PUK_LOCK | 9 | Personalized SIM card PUK lock. | ## LockStatusResponse7+ diff --git a/en/application-dev/reference/apis/js-apis-sms.md b/en/application-dev/reference/apis/js-apis-sms.md index c3a1f35f5140514d466ae481876fe1114c2b43e8..464f34595cc67c5051524d2f7f6ef0753bede543 100644 --- a/en/application-dev/reference/apis/js-apis-sms.md +++ b/en/application-dev/reference/apis/js-apis-sms.md @@ -91,6 +91,19 @@ Sends an SMS message. | ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | | options | [SendMessageOptions](#sendmessageoptions) | Yes | Options (including the callback) for sending an SMS message.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -179,6 +192,8 @@ Sets the default slot ID of the SIM card used to send SMS messages. This API use **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -192,8 +207,8 @@ Sets the default slot ID of the SIM card used to send SMS messages. This API use **Example** ```js -sms.setDefaultSmsSlotId(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.setDefaultSmsSlotId(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}.`); }); ``` @@ -224,6 +239,8 @@ Sets the default slot ID of the SIM card used to send SMS messages. This API use **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -238,9 +255,9 @@ Sets the default slot ID of the SIM card used to send SMS messages. This API use ```js let promise = sms.setDefaultSmsSlotId(0); -promise.then(data => { - console.log(`setDefaultSmsSlotId success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setDefaultSmsSlotId success.`); +}).catch((err) => { console.error(`setDefaultSmsSlotId failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -267,6 +284,8 @@ Sets the short message service center (SMSC) address. This API uses an asynchron **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -281,8 +300,8 @@ Sets the short message service center (SMSC) address. This API uses an asynchron ```js let slotId = 0; let smscAddr = '+861xxxxxxxxxx'; -sms.setSmscAddr(slotId, smscAddr, (err,data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.setSmscAddr(slotId, smscAddr, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -314,6 +333,8 @@ Sets the SMSC address. This API uses a promise to return the result. **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -329,9 +350,9 @@ Sets the SMSC address. This API uses a promise to return the result. let slotId = 0; let smscAddr = '+861xxxxxxxxxx'; let promise = sms.setSmscAddr(slotId, smscAddr); -promise.then(data => { - console.log(`setSmscAddr success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setSmscAddr success.`); +}).catch((err) => { console.error(`setSmscAddr failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -358,6 +379,8 @@ Obtains the SMSC address. This API uses an asynchronous callback to return the r **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -403,6 +426,8 @@ Obtains the SMSC address. This API uses a promise to return the result. **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -464,6 +489,8 @@ Splits an SMS message into multiple segments. This API uses an asynchronous call **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -509,6 +536,8 @@ Splits an SMS message into multiple segments. This API uses a promise to return **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -551,6 +580,8 @@ Adds a SIM message. This API uses an asynchronous callback to return the result. **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -569,8 +600,8 @@ let simMessageOptions = { pdu: "xxxxxx", status: sms.SimMessageStatus.SIM_MESSAGE_STATUS_READ }; -sms.addSimMessage(simMessageOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.addSimMessage(simMessageOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -601,6 +632,8 @@ Adds a SIM message. This API uses a promise to return the result. **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -620,9 +653,9 @@ let simMessageOptions = { status: sms.SimMessageStatus.SIM_MESSAGE_STATUS_READ }; let promise = sms.addSimMessage(simMessageOptions); -promise.then(data => { - console.log(`addSimMessage success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`addSimMessage success.`); +}).catch((err) => { console.error(`addSimMessage failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -649,6 +682,8 @@ Deletes a SIM message. This API uses an asynchronous callback to return the resu **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -663,8 +698,8 @@ Deletes a SIM message. This API uses an asynchronous callback to return the resu ```js let slotId = 0; let msgIndex = 1; -sms.delSimMessage(slotId, msgIndex, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.delSimMessage(slotId, msgIndex, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -696,6 +731,8 @@ Deletes a SIM message. This API uses a promise to return the result. **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -711,9 +748,9 @@ Deletes a SIM message. This API uses a promise to return the result. let slotId = 0; let msgIndex = 1; let promise = sms.delSimMessage(slotId, msgIndex); -promise.then(data => { - console.log(`delSimMessage success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`delSimMessage success.`); +}).catch((err) => { console.error(`delSimMessage failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -739,6 +776,8 @@ Updates a SIM message. This API uses an asynchronous callback to return the resu **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -758,8 +797,8 @@ let updateSimMessageOptions = { pdu: "xxxxxxx", smsc: "test" }; -sms.updateSimMessage(updateSimMessageOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.updateSimMessage(updateSimMessageOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -790,6 +829,8 @@ Updates a SIM message. This API uses a promise to return the result. **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -810,9 +851,9 @@ let updateSimMessageOptions = { smsc: "test" }; let promise = sms.updateSimMessage(updateSimMessageOptions); -promise.then(data => { - console.log(`updateSimMessage success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`updateSimMessage success.`); +}).catch((err) => { console.error(`updateSimMessage failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -838,6 +879,8 @@ Obtains all SIM card messages. This API uses an asynchronous callback to return **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -883,6 +926,8 @@ Obtains all SIM card messages. This API uses a promise to return the result. **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -925,6 +970,8 @@ Sets the cell broadcast configuration. This API uses an asynchronous callback to **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -944,8 +991,8 @@ let cbConfigOptions = { endMessageId: 200, ranType: sms.RanType.TYPE_GSM }; -sms.setCBConfig(cbConfigOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.setCBConfig(cbConfigOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -976,6 +1023,8 @@ Sets the cell broadcast configuration. This API uses a promise to return the res **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -996,9 +1045,9 @@ let cbConfigOptions = { ranType: sms.RanType.TYPE_GSM }; let promise = sms.setCBConfig(cbConfigOptions); -promise.then(data => { - console.log(`setCBConfig success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setCBConfig success.`); +}).catch((err) => { console.error(`setCBConfig failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1024,6 +1073,8 @@ Obtains SMS message segment information. This API uses an asynchronous callback **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1068,6 +1119,8 @@ Obtains SMS message segment information. This API uses a promise to return the r **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1107,6 +1160,8 @@ Checks whether SMS is supported on IMS. This API uses an asynchronous callback t **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1149,6 +1204,8 @@ This API uses an asynchronous callback to return the result. This API uses a pro **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1187,9 +1244,10 @@ Obtains the SMS format supported by the IMS. This API uses an asynchronous callb **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | -| 201 | Permission denied. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -1223,9 +1281,10 @@ Obtains the SMS format supported by the IMS. This API uses a promise to return t **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | -| 201 | Permission denied. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -1262,6 +1321,8 @@ Decodes MMS messages. This API uses an asynchronous callback to return the resul **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1304,6 +1365,8 @@ Decodes MMS messages. This API uses a promise to return the result. **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1343,6 +1406,8 @@ MMS message code. This API uses an asynchronous callback to return the result. **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1393,6 +1458,8 @@ MMS message code. This API uses a promise to return the result. **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | diff --git a/en/application-dev/reference/apis/js-apis-socket.md b/en/application-dev/reference/apis/js-apis-socket.md index 27d1b5cb9a3e0fc77437ab1bdee1b81a30dcaecc..d60b3e4eaf6245634140ba6c217bb3d97eb2ac25 100644 --- a/en/application-dev/reference/apis/js-apis-socket.md +++ b/en/application-dev/reference/apis/js-apis-socket.md @@ -1,4 +1,4 @@ -# Socket Connection +# # @ohos.net.socket (Socket Connection) The **socket** module implements data transfer over TCPSocket, UDPSocket, WebSocket, and TLSSocket connections. @@ -364,7 +364,7 @@ udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback\): void -Sets other properties of the UDPSocket connection. This API uses an asynchronous callback to return the result. +Sets other attributes of the UDPSocket connection. This API uses an asynchronous callback to return the result. >**NOTE** >This API can be called only after **bind** is successfully called. @@ -418,7 +418,7 @@ udp.bind({address:'192.168.xx.xxx', port:xxxx, family:1}, err=> { setExtraOptions(options: UDPExtraOptions): Promise\ -Sets other properties of the UDPSocket connection. This API uses a promise to return the result. +Sets other attributes of the UDPSocket connection. This API uses a promise to return the result. >**NOTE** >This API can be called only after **bind** is successfully called. @@ -522,7 +522,7 @@ let callback = value =>{ console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); } udp.on('message', callback); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. udp.off('message', callback); udp.off('message'); ``` @@ -582,14 +582,14 @@ let callback1 = () =>{ console.log("on listening, success"); } udp.on('listening', callback1); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. udp.off('listening', callback1); udp.off('listening'); let callback2 = () =>{ console.log("on close, success"); } udp.on('close', callback2); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. udp.off('close', callback2); udp.off('close'); ``` @@ -646,7 +646,7 @@ let callback = err =>{ console.log("on error, err:" + JSON.stringify(err)); } udp.on('error', callback); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. udp.off('error', callback); udp.off('error'); ``` @@ -1426,7 +1426,7 @@ let callback = value =>{ console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); } tcp.on('message', callback); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. tcp.off('message', callback); tcp.off('message'); ``` @@ -1486,14 +1486,14 @@ let callback1 = () =>{ console.log("on connect success"); } tcp.on('connect', callback1); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. tcp.off('connect', callback1); tcp.off('connect'); let callback2 = () =>{ console.log("on close success"); } tcp.on('close', callback2); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. tcp.off('close', callback2); tcp.off('close'); ``` @@ -1550,7 +1550,7 @@ let callback = err =>{ console.log("on error, err:" + JSON.stringify(err)); } tcp.on('error', callback); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. tcp.off('error', callback); tcp.off('error'); ``` @@ -2674,4 +2674,4 @@ Defines the certificate raw data. | Type | Description | | --------------------------------------------------------------------- | --------------------- | -|[cryptoFramework.EncodingBlob](js-apis-cryptoFramework.md#datablob) | Data and encoding format of the certificate.| +|[cert.EncodingBlob](js-apis-cert.md#datablob) | Data and encoding format of the certificate.| diff --git a/en/application-dev/reference/apis/js-apis-telephony-data.md b/en/application-dev/reference/apis/js-apis-telephony-data.md index 4521aa0eac78b15b8c5644b53aac44fc59b2f648..7e244574143dd04bedd6c8f74a6206b0263f7584 100644 --- a/en/application-dev/reference/apis/js-apis-telephony-data.md +++ b/en/application-dev/reference/apis/js-apis-telephony-data.md @@ -100,6 +100,8 @@ Sets the default slot of the SIM card used for mobile data. This API uses an asy **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -114,8 +116,8 @@ Sets the default slot of the SIM card used for mobile data. This API uses an asy **Example** ```js -data.setDefaultCellularDataSlotId(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +data.setDefaultCellularDataSlotId(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}.`); }); ``` @@ -145,6 +147,8 @@ Sets the default slot of the SIM card used for mobile data. This API uses a prom **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -160,8 +164,8 @@ Sets the default slot of the SIM card used for mobile data. This API uses a prom ```js let promise = data.setDefaultCellularDataSlotId(0); -promise.then((data) => { - console.log(`setDefaultCellularDataSlotId success, promise: data->${JSON.stringify(data)}`); +promise.then(() => { + console.log(`setDefaultCellularDataSlotId success.`); }).catch((err) => { console.error(`setDefaultCellularDataSlotId fail, promise: err->${JSON.stringify(err)}`); }); @@ -279,6 +283,8 @@ Checks whether the cellular data service is enabled. This API uses an asynchrono **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -314,6 +320,8 @@ Checks whether the cellular data service is enabled. This API uses a promise to **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -353,6 +361,8 @@ Checks whether roaming is enabled for the cellular data service. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -394,6 +404,8 @@ Checks whether roaming is enabled for the cellular data service. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -434,6 +446,8 @@ Enables the cellular data service. This API uses an asynchronous callback to ret **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -446,8 +460,8 @@ Enables the cellular data service. This API uses an asynchronous callback to ret **Example** ```js -data.enableCellularData((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +data.enableCellularData((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -471,6 +485,8 @@ Enables the cellular data service. This API uses a promise to return the result. **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -484,8 +500,8 @@ Enables the cellular data service. This API uses a promise to return the result. ```js let promise = data.enableCellularData(); -promise.then((data) => { - console.log(`enableCellularData success, promise: data->${JSON.stringify(data)}`); +promise.then(() => { + console.log(`enableCellularData success.`); }).catch((err) => { console.error(`enableCellularData fail, promise: err->${JSON.stringify(err)}`); }); @@ -511,6 +527,8 @@ Disables the cellular data service. This API uses an asynchronous callback to re **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -523,8 +541,8 @@ Disables the cellular data service. This API uses an asynchronous callback to re **Example** ```js -data.disableCellularData((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +data.disableCellularData((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -548,6 +566,8 @@ Disables the cellular data service. This API uses a promise to return the result **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -561,8 +581,8 @@ Disables the cellular data service. This API uses a promise to return the result ```js let promise = data.disableCellularData(); -promise.then((data) => { - console.log(`disableCellularData success, promise: data->${JSON.stringify(data)}`); +promise.then(() => { + console.log(`disableCellularData success.`); }).catch((err) => { console.error(`disableCellularData fail, promise: err->${JSON.stringify(err)}`); }); @@ -589,6 +609,8 @@ Enables the cellular data roaming service. This API uses an asynchronous callbac **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -601,8 +623,8 @@ Enables the cellular data roaming service. This API uses an asynchronous callbac **Example** ```js -data.enableCellularDataRoaming(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +data.enableCellularDataRoaming(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -632,6 +654,8 @@ Enables the cellular data roaming service. This API uses a promise to return the **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -645,8 +669,8 @@ Enables the cellular data roaming service. This API uses a promise to return the ```js let promise = data.enableCellularDataRoaming(0); -promise.then((data) => { - console.log(`enableCellularDataRoaming success, promise: data->${JSON.stringify(data)}`); +promise.then(() => { + console.log(`enableCellularDataRoaming success.`); }).catch((err) => { console.error(`enableCellularDataRoaming fail, promise: err->${JSON.stringify(err)}`); }); @@ -673,6 +697,8 @@ Disables the cellular data roaming service. This API uses an asynchronous callba **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -685,8 +711,8 @@ Disables the cellular data roaming service. This API uses an asynchronous callba **Example** ```js -data.disableCellularDataRoaming(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +data.disableCellularDataRoaming(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -716,6 +742,8 @@ Disables the cellular data roaming service. This API uses a promise to return th **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -729,8 +757,8 @@ Disables the cellular data roaming service. This API uses a promise to return th ```js let promise = data.disableCellularDataRoaming(0); -promise.then((data) => { - console.log(`disableCellularDataRoaming success, promise: data->${JSON.stringify(data)}`); +promise.then(() => { + console.log(`disableCellularDataRoaming success.`); }).catch((err) => { console.error(`disableCellularDataRoaming fail, promise: err->${JSON.stringify(err)}`); }); diff --git a/en/application-dev/reference/arkui-js/js-components-basic-marquee.md b/en/application-dev/reference/arkui-js/js-components-basic-marquee.md index a1072111daa65e9eab0e528e086b8955efa66e09..baf4fcc12c7ab5edb07b6d41cf6c9740e7fcfda6 100644 --- a/en/application-dev/reference/arkui-js/js-components-basic-marquee.md +++ b/en/application-dev/reference/arkui-js/js-components-basic-marquee.md @@ -136,4 +136,4 @@ export default { } ``` -![zh-cn_image_0000001176075554](figures/zh-cn_image_0000001176075554.gif) +![en-us_image_0000001176075554](figures/en-us_image_0000001176075554.gif) diff --git a/en/application-dev/reference/arkui-js/js-components-container-stepper.md b/en/application-dev/reference/arkui-js/js-components-container-stepper.md index 09bd2f3fce15f326b1d8f06832d3ea0c4319e234..ffcab80f20581fcb3e6ef36586416faeec50f922 100644 --- a/en/application-dev/reference/arkui-js/js-components-container-stepper.md +++ b/en/application-dev/reference/arkui-js/js-components-container-stepper.md @@ -48,7 +48,7 @@ In addition to the [universal events](../arkui-js/js-components-common-events.md | finish | - | Triggered when the last step on the navigator is complete. | | skip | - | Triggered when users click the skip button to skip steps.| | change | { prevIndex: prevIndex, index: index} | Triggered when users click the left or right (text) button of the step navigator to switch between steps. **prevIndex** indicates the index of the previous step, and **index** indicates that of the current step.| -| next | { index: index, pendingIndex: pendingIndex } | Triggered when users click the next (text) button. **index** indicates the index of the current step, and **pendingIndex** indicates that of the step to go. The return value is in **{pendingIndex:*** pendingIndex***}** format. You can use **pendingIndex** to specify a **** child component as the next step to go.| +| next | { index: index, pendingIndex: pendingIndex } | Triggered when users click the next (text) button. **index** indicates the index of the current step, and **pendingIndex** indicates that of the step to go. The return value is in **{pendingIndex:*** pendingIndex***}** format. You can use **pendingIndex** to specify a **\** child component as the next step to go. | | back | { index: index, pendingIndex: pendingIndex } | Triggered when users click the previous (text) button. **index** indicates the index of the current step, and **pendingIndex** indicates that of the step to go. The return value is in Object:{ **{pendingIndex:*** pendingIndex***}** format. You can use **pendingIndex** to specify a **** child component as the previous step.| diff --git a/en/application-dev/reference/arkui-js/js-components-custom-slot.md b/en/application-dev/reference/arkui-js/js-components-custom-slot.md index 706268221ec46fd3d18b3c0609229e4c1952efb3..894a56e8cbe2aa4a9675e9787f8218ad220393bd 100644 --- a/en/application-dev/reference/arkui-js/js-components-custom-slot.md +++ b/en/application-dev/reference/arkui-js/js-components-custom-slot.md @@ -31,7 +31,7 @@ The following references the custom component: ## Named Slot -When multiple slots are need inside a custom component, you can name them, so that you can specify the slot in which you want to fill content by setting the **** attribute. +When multiple slots are need inside a custom component, you can name them, so that you can specify the slot in which you want to fill content by setting the **\** attribute. ```html diff --git a/en/application-dev/reference/arkui-ts/Readme-EN.md b/en/application-dev/reference/arkui-ts/Readme-EN.md index 9b2c8d0277f79df9dc0cc3e59aece289076af677..7d723dc4082fd6f1aa65fe7ff181fc3fcd268621 100644 --- a/en/application-dev/reference/arkui-ts/Readme-EN.md +++ b/en/application-dev/reference/arkui-ts/Readme-EN.md @@ -28,7 +28,6 @@ - [Transformation](ts-universal-attributes-transformation.md) - [Image Effect Configuration](ts-universal-attributes-image-effect.md) - [Shape Clipping](ts-universal-attributes-sharp-clipping.md) - - [Text Style](ts-universal-attributes-text-style.md) - [Grid](ts-universal-attributes-grid.md) - [Gradient Color](ts-universal-attributes-gradient-color.md) - [Popup Control](ts-universal-attributes-popup.md) @@ -43,7 +42,8 @@ - [Background Blur](ts-universal-attributes-backgroundBlurStyle.md) - [restoreId](ts-universal-attributes-restoreId.md) - [Foreground Color](ts-universal-attributes-foreground-color.md) - - Gesture Processing + - [Universal Text Attributes](ts-universal-attributes-text-style.md) + - Gesture Handling - [Gesture Binding Methods](ts-gesture-settings.md) - Basic Gestures - [TapGesture](ts-basic-gestures-tapgesture.md) diff --git a/en/application-dev/reference/arkui-ts/figures/align.png b/en/application-dev/reference/arkui-ts/figures/align.png index ffabc26d3ee59984dda6cb375f8b18bb319b4fc7..5cdeb7cfd622b90a6fe52ef8cc94f187847d05b7 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/align.png and b/en/application-dev/reference/arkui-ts/figures/align.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/animation.PNG b/en/application-dev/reference/arkui-ts/figures/animation.PNG deleted file mode 100644 index 92f92e0001a90840d03ebd00e0b0ef736c2a94c8..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/animation.PNG and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/animation.gif b/en/application-dev/reference/arkui-ts/figures/animation.gif index 6cfbc07fc5122be3ecd69e6b33b6f00c0f676a0f..e1f1e9d8eedba5f4d7e9895fe10c1028cb8e19bd 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/animation.gif and b/en/application-dev/reference/arkui-ts/figures/animation.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/animation1.PNG b/en/application-dev/reference/arkui-ts/figures/animation1.PNG deleted file mode 100644 index 98cc1fa8c0537071549fa8185fa14f7ad103e7f8..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/animation1.PNG and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/animation1.gif b/en/application-dev/reference/arkui-ts/figures/animation1.gif new file mode 100644 index 0000000000000000000000000000000000000000..d4fae00973755cc243e1d48f10acf9ef4b24682e Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/animation1.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174104400.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174104400.gif new file mode 100644 index 0000000000000000000000000000000000000000..da442c6a4f02d281bafff3f9fde8a51c6ebbf932 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174104400.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001212378420.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001212378420.gif deleted file mode 100644 index ec293bafaf6cd7204ebb231c4eee7daa504b78c3..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001212378420.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_background_blur_style.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_background_blur_style.png index e9a7b0e3baa6d48739c2a3cfbc7b5b46600f9c70..9bec842e6d41af8a815ab24ce0897a0b75c8b8c4 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_background_blur_style.png and b/en/application-dev/reference/arkui-ts/figures/en-us_image_background_blur_style.png differ diff --git a/en/application-dev/reference/arkui-ts/ts-animatorproperty.md b/en/application-dev/reference/arkui-ts/ts-animatorproperty.md index f22e531ac3a0f8423c9e8de5af520a92d2828d5f..d5d669429dcb6af79c26cdc49661f1087c871472 100644 --- a/en/application-dev/reference/arkui-ts/ts-animatorproperty.md +++ b/en/application-dev/reference/arkui-ts/ts-animatorproperty.md @@ -37,11 +37,11 @@ struct AttrAnimationExample { build() { Column() { - Button('change width and height') + Button('change size') .onClick(() => { if (this.flag) { - this.widthSize = 100 - this.heightSize = 50 + this.widthSize = 150 + this.heightSize = 60 } else { this.widthSize = 250 this.heightSize = 100 @@ -67,8 +67,8 @@ struct AttrAnimationExample { duration: 1200, curve: Curve.Friction, delay: 500, - iterations: -1, // The value -1 indicates that the animation is played for an unlimited number of times. - playMode: PlayMode.AlternateReverse + iterations: -1, // The value -1 indicates that the animation is played for an unlimited number of times. + playMode: PlayMode.Alternate }) }.width('100%').margin({ top: 20 }) } diff --git a/en/application-dev/reference/arkui-ts/ts-appendix-enums.md b/en/application-dev/reference/arkui-ts/ts-appendix-enums.md index 967d9a0f35c6e5ee71a4ebe8a09ceaed21305c53..cf2dda07a27288101b36e111dd5ff2a51c390dff 100644 --- a/en/application-dev/reference/arkui-ts/ts-appendix-enums.md +++ b/en/application-dev/reference/arkui-ts/ts-appendix-enums.md @@ -417,21 +417,23 @@ Since API version 9, this API is supported in ArkTS widgets. Since API version 9, this API is supported in ArkTS widgets. -| Name | Description | -| ------ | -------------- | -| Start | Aligned with the start.| -| Center | Horizontally centered.| -| End | Aligned with the end.| +| Name | Description | +| --------------------- | -------------- | +| Start | Aligned with the start.| +| Center | Horizontally centered.| +| End | Aligned with the end.| +| Justify10+ | Aligned with both margins. | ## TextOverflow Since API version 9, this API is supported in ArkTS widgets. -| Name | Description | -| -------- | -------------------------------------- | -| Clip | Extra-long text is clipped. | -| Ellipsis | An ellipsis (...) is used to represent clipped text.| -| None | No clipping or ellipsis is used for extra-long text. | +| Name | Description | +| --------------------- | -------------------------------------- | +| None | No clipping or ellipsis is used for text overflow. | +| Clip | Extra-long text is clipped. | +| Ellipsis | An ellipsis (...) is used to represent text overflow.| +| Marquee10+ | Text continuously scrolls when text overflow occurs. | ## TextDecorationType @@ -513,3 +515,40 @@ Since API version 9, this API is supported in ArkTS widgets. | Block | The node responds to the hit test of a touch event, but its child node and sibling node are blocked from the hit test. | | Transparent | Both the node and its child node respond to the hit test of a touch event, and its sibling node is also considered during the hit test.| | None | The node does not respond to the hit test of a touch event, but its child node and sibling node are considered during the hit test.| + +## BlurStyle9+ + +This API is supported in ArkTS widgets. + + | Name| Description| + | ------- | ---------- | + | Thin | Thin material. | + | Regular | Regular material. | + | Thick | Thick material. | + | BackgroundThin | Material that creates the minimum depth of field effect.| + | BackgroundRegular | Material that creates a medium shallow depth of field effect.| + | BackgroundThick | Material that creates a high shallow depth of field effect.| + | BackgroundUltraThick | Material that creates the maximum depth of field effect.| + +## ThemeColorMode10+ + + | Name | Description | + | ------- | ---------- | + | System | Following the system color mode.| + | Light | Light color mode.| + | Dark | Dark color mode.| + +## AdaptiveColor10+ + + | Name | Description | + | ------- | ----------- | + | Default | Adaptive color mode is not used. The default color is used as the mask color.| + | Average | Adaptive color mode is used. The average color value of the color picking area is used as the mask color.| + +## TextHeightAdaptivePolicy10+ + +| Name | Description | +| ----------------------- | ------------------------------------------------ | +| MAX_LINES_FIRST | Prioritize the **maxLines** settings. | +| MIN_FONT_SIZE_FIRST | Prioritize the **minFontSize** settings. | +| LAYOUT_CONSTRAINT_FIRST | Prioritize the layout constraint settings in terms of height.| diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-button.md b/en/application-dev/reference/arkui-ts/ts-basic-components-button.md index 75d67936b62bf0ac72456673ef1474e4840cb9fd..de00ad6ba70f1ddb0cf8bff57e2f8ef7bfec26cf 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-button.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-button.md @@ -25,10 +25,9 @@ Since API version 9, this API is supported in ArkTS widgets. | type | ButtonType | No | Button type.
Default value: **ButtonType.Capsule** | | stateEffect | boolean | No | Whether to enable the pressed effect on the click of the button. The value **false** means to disable the pressed effect.
Default value: **true**| - **API 2:** Button(label?: ResourceStr, options?: { type?: ButtonType, stateEffect?: boolean }) - Creates a button component based on text content. In this case, the component cannot contain child components. +Creates a button component based on text content. In this case, the component cannot contain child components. Since API version 9, this API is supported in ArkTS widgets. @@ -46,6 +45,7 @@ Since API version 9, this API is supported in ArkTS widgets. | ----------- | ----------- | --------------------------------- | | type | ButtonType | Button type.
Default value: **ButtonType.Capsule**
Since API version 9, this API is supported in ArkTS widgets.| | stateEffect | boolean | Whether to enable the pressed effect on the click of the button. The value **false** means to disable the pressed effect.
Default value: **true**
Since API version 9, this API is supported in ArkTS widgets.| +| labelStyle10+ | [LabelStyle](#labelstyle10) | Label style of the button.| ## ButtonType enums @@ -58,11 +58,22 @@ Since API version 9, this API is supported in ArkTS widgets. | Normal | Normal button (without rounded corners by default). | > **NOTE** -> - The rounded corner of a button is set by using [borderRadius](ts-universal-attributes-border.md), rather than by using the **border** API. Only a button-wide rounded corner setting is supported. -> - For a button of the **Capsule** type, the **borderRadius** settings do not take effect, and its rounded corner is always half of the button height. +> - The rounded corner of a button is set by using [borderRadius](ts-universal-attributes-border.md), rather than by using the **border** API. Only a rounded corner whose parameter is [Length](ts-types.md#length) is supported. +> - For a button of the **Capsule** type, the **borderRadius** settings do not take effect, and the radius of its rounded corner is always half of the button height or width, whichever is smaller. > - For a button of the **Circle** type, its radius is the value of **borderRadius** (if set) or the width or height (whichever is smaller). > - The button text is set using the [text style attributes](ts-universal-attributes-text-style.md). - +> - Before setting the [gradient color](ts-universal-attributes-gradient-color.md), you need to set [backgroundColor](ts-universal-attributes-background.md) to transparent. + +## LabelStyle10+ + +| Name | Type | Mandatory| Description | +| -------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| overflow | [TextOverflow](ts-appendix-enums.md#textoverflow) | No | Display mode when the label text is too long. Text is clipped at the transition between words. To clip text in the middle of a word, add **\u200B** between characters.| +| maxLines | number | No | Maximum number of lines in the label text. By default, text is automatically folded. If this attribute is specified, the text will not exceed the specified number of lines. If there is extra text, you can use **textOverflow** to specify how it is displayed.| +| minFontSize | number \| [ResourceStr](ts-types.md#resourcestr) | No | Minimum font size of the label text. For the setting to take effect, this attribute must be used together with **maxFontSize**, **maxLines**, or layout constraint settings.| +| maxFontSize | number \| [ResourceStr](ts-types.md#resourcestr) | No | Maximum font size of the label text. For the setting to take effect, this attribute must be used together with **minFontSize**, **maxLines**, or layout constraint settings.| +| heightAdaptivePolicy | [TextHeightAdaptivePolicy](ts-appendix-enums.md#textheightadaptivepolicy10) | No | How the adaptive height is determined for the label text. | +| font | [Font](ts-types.md#Font) | No | Font of the label text. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md b/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md index 08d913698286ee0cb2cbfbc66386cd4a52a45bc9..f65895eba487b20b68d4dc26f74f5c5493f3dccb 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md @@ -24,10 +24,20 @@ Since API version 9, this API is supported in ArkTS widgets. | Name | Type | Mandatory | Description| | ----------------- | -------- | ----- | -------- | -| values | number[] | Yes | Data value list. A maximum of nine values are supported. If more than nine values are set, only the first nine ones are used. If the value is less than 0, the value 0 is used.| +| values | number[] | Yes | Data value list. A maximum of nine values are supported. If more than nine values are set, only the first nine ones are used. A value less than 0 evaluates to the value **0**. | | max | number | No | - When set to a value greater than 0, this parameter indicates the maximum value in the **values** list.
- When set to a value equal to or smaller than 0, this parameter indicates the sum of values in the **values** list. The values are displayed in proportion.
Default value: **100**| | type8+ | [DataPanelType](#datapaneltype) | No| Type of the data panel (dynamic modification is not supported).
Default value: **DataPanelType.Circle**| +## Attributes + +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + +| Name | Type | Description | +| ----------- | ------- | -------------------------------------------- | +| closeEffect | boolean | Whether to disable the rotation effect for the component.
Default value: **false**| + + + ## DataPanelType Since API version 9, this API is supported in ArkTS widgets. diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md b/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md index cee85008404560b115d9dc021ed98e59da47d36a..3555f55586004554735bbf5cf4c4aa582e25e925 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md @@ -26,15 +26,10 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | ----------- | ---------- | ------------------ | | vertical | boolean | Whether a vertical divider is used. **false**: A horizontal divider is used.
**true**: A vertical divider is used.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| | color | [ResourceColor](ts-types.md#resourcecolor) | Color of the divider.
Since API version 9, this API is supported in ArkTS widgets.| -| strokeWidth | number \| string | Width of the divider.
Default value: **1**
Since API version 9, this API is supported in ArkTS widgets.| +| strokeWidth | number \| string | Width of the divider.
Default value: **1**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute cannot be set to a percentage.| | lineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | Cap style of the divider.
Default value: **LineCapStyle.Butt**
Since API version 9, this API is supported in ArkTS widgets.| -## Events - -The universal events are not supported. - - ## Example ```ts diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-image.md b/en/application-dev/reference/arkui-ts/ts-basic-components-image.md index 1562815bc640f37d2c83043be7d4c45bf0de2c8b..ed564ed02da8ab3d1c7332aaeb4e4a05543685b9 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-image.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-image.md @@ -81,11 +81,11 @@ Since API version 9, this API is supported in ArkTS widgets. In addition to the [universal events](ts-universal-events-click.md), the following events are supported. -| Name | Description | +| Name | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| onComplete(callback: (event?: { width: number, height: number, componentWidth: number,
componentHeight: number, loadingStatus: number }) => void) | Triggered when an image is successfully loaded. The size of the loaded image is returned.
- **width**: width of the image, in pixels.
- **height**: height of the image, in pixels.
- **componentWidth**: width of the container component, in pixels.
- **componentHeight**: height of the container component, in pixels.
- **loadingStatus**: image loading status.
Since API version 9, this API is supported in ArkTS widgets.| -| onError(callback: (event?: { componentWidth: number, componentHeight: number , message9+: string }) => void) | Triggered when an exception occurs during image loading.
- **componentWidth**: width of the container component, in pixels.
- **componentHeight**: height of the container component, in pixels.
Since API version 9, this API is supported in ArkTS widgets.| -| onFinish(event: () => void) | Triggered when the animation playback in the loaded SVG image is complete. If the animation is an infinite loop, this callback is not triggered.
Since API version 9, this API is supported in ArkTS widgets.| +| onComplete(callback: (event?: { width: number, height: number, componentWidth: number,
componentHeight: number, loadingStatus: number }) => void) | Triggered when an image is successfully loaded. The size of the loaded image is returned.
- **width**: width of the image, in pixels.
- **height**: height of the image, in pixels.
- **componentWidth**: width of the container component, in pixels.
- **componentHeight**: height of the container component, in pixels.
- **loadingStatus**: image loading status. The value **1** means that the image is successfully loaded, and **0** means the opposite.
Since API version 9, this API is supported in ArkTS widgets. | +| onError(callback: (event?: { componentWidth: number, componentHeight: number , message9+: string }) => void) | Triggered when an exception occurs during image loading.
- **componentWidth**: width of the container component, in pixels.
- **componentHeight**: height of the container component, in pixels.
Since API version 9, this API is supported in ArkTS widgets. | +| onFinish(event: () => void) | Triggered when the animation playback in the loaded SVG image is complete. If the animation is an infinite loop, this callback is not triggered.
Since API version 9, this API is supported in ArkTS widgets. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md b/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md index e5dfa9aa5304d58c76fdfe87aaf7ade4623db417..85745ba42d26583d369fe5f652c756ae318440f5 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md @@ -36,7 +36,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ## Events -Among all the universal events, only the [click event](ts-universal-events-click.md) is supported. +Among the universal events, the [click event](ts-universal-events-click.md), [touch event](ts-universal-events-touch.md), and [show/hide event](ts-universal-events-show-hide.md) are supported. ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md b/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md index d78f3a705501daf305b4d3ee01a33a57c568a6a0..eb3d4489f8cadd3df86f727fe68be24596b407ee 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md @@ -32,7 +32,7 @@ Since API version 9, this API is supported in ArkTS widgets. | -------- | -------- | -------- | | stars | number | Total number of stars.
Default value: **5**
Since API version 9, this API is supported in ArkTS widgets.| | stepSize | number | Step of an operation.
Default value: **0.5**
Since API version 9, this API is supported in ArkTS widgets.| -| starStyle | {
backgroundUri: string,
foregroundUri: string,
secondaryUri?: string
} | **backgroundUri**: image link of the unselected star. You can use the default image or a custom local image.
**foregroundUri**: image path of the selected star. You can use the default image or a custom local image.
**secondaryUir**: image path of the partially selected star. You can use the default image or a custom local image.
Since API version 9, this API is supported in ArkTS widgets.| +| starStyle | {
backgroundUri: string,
foregroundUri: string,
secondaryUri?: string
} | Star style.
**backgroundUri**: image path for the unselected star. You can use the default system image or a custom image.
**foregroundUri**: image path for the selected star. You can use the default system image or a custom image.
**secondaryUir**: image path for the partially selected star. You can use the default system image or a custom image.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
For details about the image types supported by the **startStyle** attribute, see [Image](ts-basic-components-image.md).
Local and online images are supported, but not **PixelMap** and **Resource** objects.
By default, the image is loaded in asynchronous mode. Synchronous loading is not supported.| ## Events diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-search.md b/en/application-dev/reference/arkui-ts/ts-basic-components-search.md index 9f1d13ee9981696905d9383abfde395aa2162c1b..1086c3e68b3f5ca5d7d4383a62477d429ea122e4 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-search.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-search.md @@ -12,14 +12,14 @@ Not supported ## APIs -Search(options?: { value?: string; placeholder?: string; icon?: string; controller?: SearchController }) +Search(options?: { value?: string; placeholder?: ResourceStr; icon?: string; controller?: SearchController }) **Parameters** | Name | Type | Mandatory| Description | | ----------- | ---------------- | ---- | ------------------------------------------------------------ | -| value | string | No | Text input in the search text box. | -| placeholder | string | No | Text displayed when there is no input. | +| value | string | No | Text input in the search text box. | +| placeholder | [ResourceStr](ts-types.md#resourcestr)10+ | No | Text displayed when there is no input. | | icon | string | No | Path to the search icon. By default, the system search icon is used. The supported icon formats are .svg, .jpg, and .png.| | controller | SearchController | No | Controller of the **\** component. | @@ -29,12 +29,46 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name | Type | Description | | ----------------------- | ------------------------------------------------ | ---------------------------------------------- | -| searchButton | string | Text on the search button located next to the search text box. By default, there is no search button. | +| searchButton10+ | value: string,
option?: [SearchButtonOption](#searchbuttonoption10) | Text on the search button located next to the search text box. By default, there is no search button. | | placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | Placeholder text color. | | placeholderFont | [Font](ts-types.md#font) | Placeholder text font. | | textFont | [Font](ts-types.md#font) | Text font for the search text box. | | textAlign | [TextAlign](ts-appendix-enums.md#textalign) | Text alignment mode in the search text box.
Default value: **TextAlign.Start** | | copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed. | +| searchIcon10+ | [IconOptions](#iconoptions10) | Style of the search icon on the left. | +| cancelButton10+ | {
style? : [CancelButtonStyle](#cancelbuttonstyle10)
icon?: [IconOptions](#iconoptions10)
} | Style of the Cancel button on the right. | +| fontColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Font color of the input text. | +| caretStyle10+ | [CaretStyle](#caretstyle10) | Caret style. | + +## IconOptions10+ + +| Name| Type | Mandatory| Description | +| ------ | ------------------------------------------ | ---- | ----------- | +| size | [Length](ts-types.md#length) | No | Icon size. | +| color | [ResourceColor](ts-types.md#resourcecolor) | No | Icon color. | +| src | [ResourceStr](ts-types.md#resourcestr) | No | Image source of the icon.| + +## CaretStyle10+ + +| Name| Type | Mandatory| Description| +| ------ | ------------------------------------------ | ---- | -------- | +| width | [Length](ts-types.md#length) | No | Caret width.| +| color | [ResourceColor](ts-types.md#resourcecolor) | No | Caret color.| + +## SearchButtonOption10+ + +| Name | Type | Mandatory| Description | +| --------- | ------------------------------------------ | ---- | ---------------- | +| fontSize | [Length](ts-types.md#length) | No | Font size of the button.| +| fontColor | [ResourceColor](ts-types.md#resourcecolor) | No | Font color of the button.| + +## CancelButtonStyle10+ + +| Name | Description | +| ----------------------- | ---------------- | +| CONSTANT10+ | The Cancel button is always displayed.| +| INVISIBLE10+ | The Cancel button is always hidden.| +| INPUT10+ | The Cancel button is displayed when there is text input.| ## Events diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md b/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md index bea534a1a1861e1ad2183d0ed1455127f762c65c..4c32cb2686c2f6e3abc7dd4b3ee4af2c9355d6fa 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md @@ -50,9 +50,35 @@ Except touch target attributes, the universal attributes are supported. | trackColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the slider.
Since API version 9, this API is supported in ArkTS widgets.| | selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the selected part of the slider track.
Since API version 9, this API is supported in ArkTS widgets.| | showSteps | boolean | Whether to display the current step.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| -| showTips | boolean | Whether to display a bubble to indicate the percentage when the user drags the slider.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| +| showTips | boolean | Whether to display a bubble to indicate the percentage when the user drags the slider.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
When **direction** is set to **Axis.Horizontal**, the bubble is displayed right above the slider. When **direction** is set to **Axis.Vertical**, the bubble is displayed on the left of the slider.
The drawing area of the bubble is the overlay of the slider.
If no margin is set for the slider or the margin is not large enough, the bubble will be clipped.| | trackThickness | [Length](ts-types.md#length) | Track thickness of the slider.
Since API version 9, this API is supported in ArkTS widgets.| +| blockBorderColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Border color of the slider in the block direction.| +| blockBorderWidth10+ | [Length](ts-types.md#length) | Border width of the slider in the block direction.| +| stepColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Step color.| +| trackBorderRadius10+ | [Length](ts-types.md#length) | Radius of the rounded corner of the slider track.| +| blockSize10+ | [SizeOptions](ts-types.md#sizeoptions) | Size of the slider in the block direction.| +| blockStyle10+ | [SliderBlockStyle](#sliderblockstyle10) | Style of the slider in the block direction.| +| stepSize10+ | [Length](ts-types.md#length) | Step size (diameter).| +## SliderBlockStyle10+ + +Desribes the style of the slider in the block direction. + +| Name | Type | Mandatory| Description | +| ----- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| type | [SliderBlockType](#sliderblocktype10) | Yes | Type of the slider in the block direction.
Default value: **SliderBlockType.DEFAULT**, indicating the round slider.| +| image | [ResourceStr](ts-types.md#resourcestr) | No | Image resource of the slider.
The area size for displaying the image is subject to the **blockSize** attribute. Be mindful of the image size when selecting an image.| +| shape | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md) | No | Custom shape of the slider. | + +## SliderBlockType10+ + +Enumerates the types of the slider in the block direction. + +| Name | Description | +| ------- | ---------------------- | +| DEFAULT | Round slider. | +| IMAGE | Slider with an image background. | +| SHAPE | Slider in a custom shape.| ## Events @@ -60,7 +86,7 @@ In addition to the **OnAppear** and **OnDisAppear** universal events, the follow | Name| Description| | -------- | -------- | -| onChange(callback: (value: number, mode: SliderChangeMode) => void) | Invoked when the slider slides.
**value**: current slider value. If the return value contains decimals, you can use **Math.toFixed()** to process the data to the desired precision.
**mode**: dragging state.
Since API version 9, this API is supported in ArkTS widgets.| +| onChange(callback: (value: number, mode: SliderChangeMode) => void) | Invoked when the slider is dragged or clicked.
**value**: current slider value. If the return value contains decimals, you can use **Math.toFixed()** to process the data to the desired precision.
**mode**: state triggered by the event.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The **Begin** and **End** states are triggered when the slider is clicked with a gesture. The **Moving** and **Click** states are triggered when the value of **value** changes.
If the coherent action is a drag action, the **Click** state will not be triggered.
The value range of **value** is the **steps** value array.| ## SliderChangeMode @@ -68,9 +94,9 @@ Since API version 9, this API is supported in ArkTS widgets. | Name| Value| Description| | -------- | -------- | -------- | -| Begin | 0 | The user starts to drag the slider.| +| Begin | 0 | The user touches or presses the slider with a gesture or mouse.| | Moving | 1 | The user is dragging the slider.| -| End | 2 | The user stops dragging the slider.| +| End | 2 | The user stops dragging the slider by lifting their finger or releasing the mouse.| | Click | 3 | The user moves the slider by touching the slider track.| diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-text.md b/en/application-dev/reference/arkui-ts/ts-basic-components-text.md index 9f2fdd7b839eaa85f8900968ce42a7e7d5304a40..d20ad37b35f6184fb9f3c2b9b626d232fa6a3a6a 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-text.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-text.md @@ -2,7 +2,7 @@ The **\** component is used to display a piece of textual information. -> **NOTE**
+> **NOTE** > > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. @@ -31,16 +31,18 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name | Type | Description | | ----------------------- | ----------------------------------- | ------------------------------------------- | | textAlign | [TextAlign](ts-appendix-enums.md#textalign) | Horizontal alignment mode of the text.
Default value: **TextAlign.Start**
**NOTE**
The text takes up the full width of the **\** component. To set the vertical alignment for the text, use the [align](ts-universal-attributes-location.md) attribute.
Since API version 9, this API is supported in ArkTS widgets.| -| textOverflow | {overflow: [TextOverflow](ts-appendix-enums.md#textoverflow)} | Display mode when the text is too long.
Default value: **{overflow: TextOverflow.Clip}**
**NOTE**
Text is clipped at the transition between words. To clip text in the middle of a word, add **\u200B** between characters.
This attribute must be used with `maxLines` to take effect.
Since API version 9, this API is supported in ArkTS widgets.| -| maxLines | number | Maximum number of lines in the text.
Default value: **Infinity**
**NOTE**
By default, text is automatically folded. If this attribute is specified, the text will not exceed the specified number of lines. If there is extra text, you can use **textOverflow** to specify how it is displayed.
Since API version 9, this API is supported in ArkTS widgets.| +| textOverflow | {overflow: [TextOverflow](ts-appendix-enums.md#textoverflow)} | Display mode when the text is too long.
Default value: **{overflow: TextOverflow.Clip}**
**NOTE**
Text is clipped at the transition between words. To clip text in the middle of a word, add **\u200B** between characters.
This attribute must be used with **maxLines** to take effect.
Since API version 9, this API is supported in ArkTS widgets. | +| maxLines | number | Maximum number of lines in the text.
Default value: **Infinity**
**NOTE**
By default, text is automatically folded. If this attribute is specified, the text will not exceed the specified number of lines. If there is extra text, you can use **textOverflow** to specify how it is displayed.
Since API version 9, this API is supported in ArkTS widgets. | | lineHeight | string \| number \| [Resource](ts-types.md#resource) | Text line height. If the value is less than or equal to **0**, the line height is not limited and the font size is adaptive. If the value of the number type, the unit fp is used.
Since API version 9, this API is supported in ArkTS widgets.| | decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | Style and color of the text decorative line.
Default value: {
type: TextDecorationType.None,
color: Color.Black
}
Since API version 9, this API is supported in ArkTS widgets.| | baselineOffset | number \| string | Baseline offset of the text. The default value is **0**.
Since API version 9, this API is supported in ArkTS widgets. | | letterSpacing | number \| string | Letter spacing.
Since API version 9, this API is supported in ArkTS widgets. | -| minFontSize | number \| string \| [Resource](ts-types.md#resource) | Minimum font size.
For the setting to take effect, this attribute must be used together with **maxFontSize**, **maxline**, or a layout size constraint.
Since API version 9, this API is supported in ArkTS widgets. | -| maxFontSize | number \| string \| [Resource](ts-types.md#resource) | Maximum font size.
For the setting to take effect, this attribute must be used together with **minFontSize**, **maxline**, or a layout size constraint.
Since API version 9, this API is supported in ArkTS widgets. | +| minFontSize | number \| string \| [Resource](ts-types.md#resource) | Minimum font size.
For the setting to take effect, this attribute must be used together with **maxFontSize**, **maxLines**, or layout constraint settings.
Since API version 9, this API is supported in ArkTS widgets. | +| maxFontSize | number \| string \| [Resource](ts-types.md#resource) | Maximum font size.
For the setting to take effect, this attribute must be used together with **minFontSize**, **maxLines**, or layout constraint settings.
Since API version 9, this API is supported in ArkTS widgets. | | textCase | [TextCase](ts-appendix-enums.md#textcase) | Text case.
Default value: **TextCase.Normal**
Since API version 9, this API is supported in ArkTS widgets.| | copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
Default value: **CopyOptions.None**
This API is supported in ArkTS widgets.| +| textShadow10+ | [ShadowOptions](ts-universal-attributes-image-effect.md#shadowoptions) | Text shadow.| +| heightAdaptivePolicy10+ | [TextHeightAdaptivePolicy](ts-appendix-enums.md#TextHeightAdaptivePolicy10) | How the adaptive height is determined for the text.| > **NOTE** > diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md index e4b6ba1ad47c9e06f3f26e6b47f4afd505b6aa36..0a05c9ce7311a0ab826543540dc95dda25699987 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md @@ -38,6 +38,10 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | inputFilter8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.
- **value**: regular expression to set.
- **error**: filtered-out content to return when regular expression matching fails.| | copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.| +> **NOTE** +> +> The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows: { top: 8 vp, right: 16 vp, bottom: 16 vp, left: 8 vp } + ## Events @@ -72,6 +76,18 @@ Sets the position of the caret. | ------ | -------- | ---- | -------------------------------------- | | value | number | Yes | Length from the start of the string to the position where the caret is located.| +### setTextSelection10+ + +setTextSelection(selectionStart: number, selectionEnd: number): void + +Sets the text selection range. + +**Parameters** + +| Name | Type| Mandatory| Description | +| -------------- | -------- | ---- | ------------------ | +| selectionStart | number | Yes | Start of the selection range.| +| selectionEnd | number | Yes | End of the selection range.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md index 3769a949422ac922318ad203fb2a7bebd676e44c..4a6457aeda349129f035fa428710b36f32e68d3b 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md @@ -34,14 +34,21 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | type | [InputType](#inputtype) | Input box type.
Default value: **InputType.Normal** | | placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | Placeholder text color.| | placeholderFont | [Font](ts-types.md#font) | Placeholder text font.| -| enterKeyType | [EnterKeyType](#enterkeytype) | Type of the Enter key. Currently, only the default value is supported.
Default value: **EnterKeyType.Done**| +| enterKeyType | [EnterKeyType](#enterkeytype) | Type of the Enter key. Only the default value is supported.
Default value: **EnterKeyType.Done**| | caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. | | maxLength | number | Maximum number of characters in the text input. | -| inputFilter8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.
- **value**: regular expression to set.
- **error**: filtered-out content to return when regular expression matching fails.| +| inputFilter8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The regular expression can match single characters, but not strings.
- **value**: regular expression to set.
- **error**: filtered-out content to return when regular expression matching fails.| | copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.| | showPasswordIcon9+ | boolean | Whether to display the show password icon at the end of the password text box.
Default value: **true**| | style9+ | [TextInputStyle](#textinputstyle9) | Text input style.
Default value: **TextInputStyle.Default**| | textAlign9+ | [TextAlign](ts-appendix-enums.md#textalign) | Alignment mode of the text in the text box.
Default value: **TextAlign.Start** | +| selectedBackgroundColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Background color of the selected text.| +| caretStyle10+ | {
caretWidth: [Length](ts-types.md#length)
} | Caret style. | +| caretPosition10+ | number | Caret position.| + +> **NOTE** +> +> The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows:
{
top: 8 vp,
right: 16 vp,
bottom: 16 vp,
left: 8 vp
} ## EnterKeyType @@ -103,7 +110,18 @@ Sets the position of the caret. | Name| Type| Mandatory| Description | | ------ | -------- | ---- | -------------------------------------- | | value | number | Yes | Length from the start of the string to the position where the caret is located.| +### setTextSelection10+ + +setTextSelection(selectionStart: number, selectionStart: number): void + +Sets the text selection area, which will be highlighted. + +**Parameters** +| Name | Type| Mandatory| Description | +| -------------- | -------- | ---- | ---------------------- | +| selectionStart | number | Yes | Start position of the text selection area. The start position of the text in the text box is 0.| +| selectionEnd | number | Yes | End position of the text selection area.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-toggle.md b/en/application-dev/reference/arkui-ts/ts-basic-components-toggle.md index 7c3994074a9bf4124800346196515150f020ffc6..f5acbb698cb3c77954cd8bd51a8e489f3ad2f1d4 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-toggle.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-toggle.md @@ -35,9 +35,9 @@ Since API version 9, this API is supported in ArkTS widgets. | Name | Description | | -------- | ---------------- | -| Checkbox | Check box type.
**NOTE**
The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows:
{
top: 14 vp,
right: 6 vp,
bottom: 14 vp,
left: 6 vp
} | +| Checkbox | Check box type.
**NOTE**
The default value of the universal attribute [margin](ts-universal-attributes-size.md) is as follows:
{
top: 12 vp,
right: 12 vp,
bottom: 12 vp,
left: 12 vp
} | | Button | Button type. The set string, if any, will be displayed inside the button. | -| Switch | Switch type.
**NOTE**
The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows:
{
top: 12 vp,
right: 12 vp,
bottom: 12 vp,
left: 12 vp
} | +| Switch | Switch type.
**NOTE**
The default value of the universal attribute [margin](ts-universal-attributes-size.md) is as follows:
{
top: 14 vp,
right:6 vp,
bottom: 6 vp,
left: 14 vp
} | ## Attributes diff --git a/en/application-dev/reference/arkui-ts/ts-container-flex.md b/en/application-dev/reference/arkui-ts/ts-container-flex.md index 6a5908578950850fbedda096b33f03c858097cd0..8a98f8237eb7656f48eeb5b2eeba442a64b9b4c6 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-flex.md +++ b/en/application-dev/reference/arkui-ts/ts-container-flex.md @@ -5,7 +5,8 @@ The **\** component allows for flexible layout of child components. > **NOTE** > > - This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. -> - The **\** component adapts the layout of flex items during rendering. This may affect the performance. Therefore, you are advised to use **[\](ts-container-column.md)** or **[\](ts-container-row.md)** instead under scenarios where consistently high performance is required. +> - The **\** component adapts the layout of flex items during rendering. This may affect the performance. Therefore, you are advised to use **[Column](ts-container-column.md)** or **[Row](ts-container-row.md)** instead under scenarios where consistently high performance is required. +> - If the main axis of the **\** component is not set, it follows the size of the parent container. On the contrary, if the main axis of the [\](ts-container-column.md) or [\](ts-container-row.md) component is not set, it follows the size of their child component. ## Child Components diff --git a/en/application-dev/reference/arkui-ts/ts-container-list.md b/en/application-dev/reference/arkui-ts/ts-container-list.md index 20754962479003639e3e000f799b42946c3077ad..9efd6ab6e939ee495789cde41a294e15da37a3a7 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-list.md +++ b/en/application-dev/reference/arkui-ts/ts-container-list.md @@ -76,7 +76,7 @@ This API is supported in ArkTS widgets. | onScrollIndex(event: (start: number, end: number) => void) | Triggered when scrolling starts.
When calculating the index value, the **\** accounts for one index value as a whole, and the index values of the list items within are not calculated.
- **start**: index of the scroll start position.
- **end**: index of the scroll end position.
Since API version 9, this API is supported in ArkTS widgets.| | onReachStart(event: () => void) | Triggered when the list reaches the start position.
Since API version 9, this API is supported in ArkTS widgets.| | onReachEnd(event: () => void) | Triggered when the list reaches the end position.
Since API version 9, this API is supported in ArkTS widgets.| -| onScrollFrameBegin9+(event: (offset: number, state: ScrollState) => { offsetRemain }) | Triggered when the list starts to scroll. The input parameters indicate the amount by which the list will scroll. The event handler then works out the amount by which the list needs to scroll based on the real-world situation and returns the result.
\- **offset**: amount to scroll by.
\- **state**: current sliding status.
- **offsetRemain**: actual amount by which the list scrolls.
This API is supported in ArkTS widgets.| +| onScrollFrameBegin9+(event: (offset: number, state: ScrollState) => { offsetRemain }) | Triggered when the list starts to scroll. The input parameters indicate the amount by which the list will scroll. The event handler then works out the amount by which the list needs to scroll based on the real-world situation and returns the result.
\- **offset**: amount to scroll by.
\- **state**: current sliding status.
- **offsetRemain**: actual amount by which the list scrolls.
This API is supported in ArkTS widgets.
**NOTE**
If **listDirection** is set to **Axis.Vertical**, the return value is the amount by which the list needs to scroll in the vertical direction. If **listDirection** is set to **Axis.Horizontal**, the return value is the amount by which the list needs to scroll in the horizontal direction.| | onScrollStart9+(event: () => void) | Triggered when the list starts scrolling initiated by the user's finger dragging the **\** component or its scrollbar. This event is also triggered when the animation contained in the scrolling triggered by [Scroller](ts-container-scroll.md#scroller) starts.
This API is supported in ArkTS widgets.| | onScrollStop(event: () => void) | Triggered when the list stops scrolling after the user's finger leaves the screen. This event is also triggered when the animation contained in the scrolling triggered by [Scroller](ts-container-scroll.md#scroller) stops.
Since API version 9, this API is supported in ArkTS widgets.| | onItemMove(event: (from: number, to: number) => boolean) | Triggered when a list item moves.
- **from**: index of the item before moving.
- **to**: index of the item after moving.| diff --git a/en/application-dev/reference/arkui-ts/ts-explicit-animation.md b/en/application-dev/reference/arkui-ts/ts-explicit-animation.md index 1cee9be56077b524b2bb71e098336701e7dd9593..3e756f519e74b7f851b3af2401e7272eb133a4a9 100644 --- a/en/application-dev/reference/arkui-ts/ts-explicit-animation.md +++ b/en/application-dev/reference/arkui-ts/ts-explicit-animation.md @@ -42,7 +42,7 @@ struct AnimateToExample { build() { Column() { - Button('change width and height') + Button('change size') .width(this.widthSize) .height(this.heightSize) .margin(30) @@ -57,8 +57,8 @@ struct AnimateToExample { console.info('play end') } }, () => { - this.widthSize = 100 - this.heightSize = 50 + this.widthSize = 150 + this.heightSize = 60 }) } else { animateTo({}, () => { @@ -77,7 +77,7 @@ struct AnimateToExample { curve: Curve.Friction, delay: 500, iterations: -1, // The value -1 indicates that the animation is played for an unlimited number of times. - playMode: PlayMode.AlternateReverse, + playMode: PlayMode.Alternate, onFinish: () => { console.info('play end') } @@ -90,10 +90,4 @@ struct AnimateToExample { } ``` -The figure below shows two buttons in their initial state. - -![animation](figures/animation.PNG) - -Clicking the first button plays the animation of resizing the button, and clicking the second button plays the animation of rotating the button clockwise by 90 degrees. The figure below shows the two buttons when the animations have finished. - -![animation1](figures/animation1.PNG) +![animation1](figures/animation1.gif) diff --git a/en/application-dev/reference/arkui-ts/ts-media-components-video.md b/en/application-dev/reference/arkui-ts/ts-media-components-video.md index feb0d96571dd263205252f8c849b5a0f6ee967b1..0c143bd234578db616fb7a86fccca80cb592b983 100644 --- a/en/application-dev/reference/arkui-ts/ts-media-components-video.md +++ b/en/application-dev/reference/arkui-ts/ts-media-components-video.md @@ -118,9 +118,9 @@ Requests full-screen mode. **Parameters** -| Name | Type | Mandatory | Description | -| ----- | ------- | ---- | --------------------- | -| value | boolean | Yes | Whether the playback is in full-screen mode.
Default value: **false**| +| Name| Type| Mandatory| Description | +| ------ | -------- | ---- | -------------------------------------------------- | +| value | boolean | Yes | Whether to play the video in full screen mode within the application window.
Default value: **false**| ### exitFullscreen @@ -173,7 +173,7 @@ struct VideoCreateComponent { previewUri: this.previewUri, currentProgressRate: this.curRate, controller: this.controller - }).width(800).height(600) + }).width('100%').height(600) .autoPlay(this.isAutoPlay) .controls(this.showControls) .onStart(() => { @@ -186,7 +186,7 @@ struct VideoCreateComponent { console.info('onFinish') }) .onError(() => { - console.info('onFinish') + console.info('onError') }) .onPrepared((e) => { console.info('onPrepared is ' + e.duration) diff --git a/en/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md b/en/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md index 3588277a411f29ff33929ecd92d501e1686c1d00..db8ca389e215c3a8ffd750b672212f0db0453ff9 100644 --- a/en/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md +++ b/en/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md @@ -11,7 +11,7 @@ You can set the text content and response callback for an alert dialog box. | Name | Type | Description| | ---- | --------------- | -------- | -| show | [AlertDialogParamWithConfirm](#alertdialogparamwithconfirm) \| [AlertDialogParamWithButtons](#alertdialogparamwithbuttons) | Defines and displays the **** component.| +| show | [AlertDialogParamWithConfirm](#alertdialogparamwithconfirm) \| [AlertDialogParamWithButtons](#alertdialogparamwithbuttons) | Defines and displays the **\** component. | ## AlertDialogParamWithConfirm | Name | Type | Mandatory | Description | diff --git a/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md b/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md index f32762ea1dd342ff52e4ff80c4bc7fb4245b6137..37f51638b8383dfab8aba2ddb3f6e7c441419b8a 100644 --- a/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md +++ b/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md @@ -11,7 +11,7 @@ The motion path animation is used to animate a component along a custom path. | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| motionPath | {
path: string,
from?: number,
to?: number,
rotatable?: boolean
}
**NOTE**
In a path, **start** and **end** can be used to replace the start point and end point. Example:
'Mstart.x start.y L50 50 Lend.x end.y Z'
For more information, see [Path Drawing](../../ui/ui-js-components-svg-path.md).| {
'',
0.0,
1.0,
false
} | Motion path of the component.
- **path**: motion path of the translation animation. The value is an SVG path string.
- **from**: start point of the motion path. The default value is **0.0**.
- **to**: end point of the motion path. The default value is **1.0**.
- **rotatable**: whether to rotate along the path. | +| motionPath | {
path: string,
from?: number,
to?: number,
rotatable?: boolean
}
**NOTE**
In a path, **start** and **end** can be used to replace the start point and end point. Example:
'Mstart.x start.y L50 50 Lend.x end.y Z'
For more information, see [Path Drawing](../../ui/ui-js-components-svg-path.md).| {
'',
0.0,
1.0,
false
} | Motion path of the component.
- **path**: motion path of the translation animation. The value is an SVG path string.
- **from**: start point of the motion path. The default value is **0.0**.
- **to**: end point of the motion path. The default value is **1.0**.
- **rotatable**: whether to rotate along the path.| ## Example @@ -25,7 +25,7 @@ struct MotionPathExample { build() { Column() { - Button('click me') + Button('click me').margin(50) // Execute the animation: Move from the start point to (300,200), then to (300,500), and finally to the end point. .motionPath({ path: 'Mstart.x start.y L300 200 L300 500 Lend.x end.y', from: 0.0, to: 1.0, rotatable: true }) .onClick(() => { @@ -38,4 +38,4 @@ struct MotionPathExample { } ``` -![en-us_image_0000001212378420](figures/en-us_image_0000001212378420.gif) +![en-us_image_0000001174104400](figures/en-us_image_0000001174104400.gif) diff --git a/en/application-dev/reference/arkui-ts/ts-types.md b/en/application-dev/reference/arkui-ts/ts-types.md index 78d1c4fb2c2fc836b19e1ea17e96c662f72075c7..fac677383a0eedcbd12c7a913d30cc3d2d679845 100644 --- a/en/application-dev/reference/arkui-ts/ts-types.md +++ b/en/application-dev/reference/arkui-ts/ts-types.md @@ -124,8 +124,8 @@ The **ResourceColor** type is used to describe the color types of resources. | Type | Description | | ---------------------------------------- | ------------------------------------------------- | | [Color](ts-appendix-enums.md#color) | Color enums. | -| number | Color in hexadecimal notation. | -| string | Color in RGB or RGBA notation. | +| number | Color in hexadecimal notation. RGB is supported. | +| string | Color in RGB or ARGB notation. | | [Resource](#resource) | Color referenced from system or application resources.| ## ColoringStrategy @@ -134,7 +134,7 @@ The **ColoringStrategy** type is used to describe the foreground colors. | Name | Description | | --------- | ------- | -| Invert | Inverse of the component background color.| +| INVERT | Inverse of the component background color.| ## LengthConstrain @@ -225,3 +225,14 @@ The **CustomBuilder** type is used to define custom UI descriptions in component | Name | Type | Description | | ------------- | ---------------------- | ---------------------------------------- | | CustomBuilder | () => any | Must be decorated by **@Builder**. For details, see [@Builder](../../quick-start/arkts-dynamic-ui-elememt-building.md#builder).| + +## PixelStretchEffectOptions10+ + +Describes the pixel stretch effect options. + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | ---------- | +| left | [Length](#length) | No | Length by which a pixel is stretched towards the left edge of the image.| +| right | [Length](#length) | No | Length by which a pixel is stretched towards the right edge of the image.| +| top | [Length](#length) | No | Length by which a pixel is stretched towards the top edge of the image.| +| bottom | [Length](#length) | No | Length by which a pixel is stretched towards the bottom edge of the image.| diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md index 98da7c61fee51c2a6d99349a7de61b93fda1cede..4cc26a594e13004d77784cfbb2d5f0ed24f8976b 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md @@ -11,8 +11,8 @@ You can set the background of a component. | Name| Type| Description| | -------- | -------- | -------- | | backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the component.
Since API version 9, this API is supported in ArkTS widgets.| -| backgroundImage | src: [ResourceStr](ts-types.md#resourcestr),
repeat?: [ImageRepeat](ts-appendix-enums.md#imagerepeat) | **src**: image address, which can be the address of an Internet or a local image. (SVG images are not supported.)
**repeat**: whether the background image is repeatedly used. By default, the background image is not repeatedly used.
Since API version 9, this API is supported in ArkTS widgets.| -| backgroundImageSize | {
width?: [Length](ts-types.md#length),
height?: [Length](ts-types.md#length)
} \| [ImageSize](ts-appendix-enums.md#imagesize) | Width and height of the background image. If the input is a **{width: Length, height: Length}** object and only one attribute is set, the other attribute is the set value multiplied by the original aspect ratio of the image. By default, the original image aspect ratio remains unchanged.
Default value: **ImageSize.Auto**
Since API version 9, this API is supported in ArkTS widgets.| +| backgroundImage | src: [ResourceStr](ts-types.md#resourcestr),
repeat?: [ImageRepeat](ts-appendix-enums.md#imagerepeat) | **src**: image address, which can be the address of an Internet or a local image or a Base64 encoded image. SVG images are not supported.
**repeat**: whether the background image is repeatedly used. By default, the background image is not repeatedly used. If the set image has a transparent background and **backgroundColor** is set, the image is overlaid on the background color.
Since API version 9, this API is supported in ArkTS widgets.| +| backgroundImageSize | {
width?: [Length](ts-types.md#length),
height?: [Length](ts-types.md#length)
} \| [ImageSize](ts-appendix-enums.md#imagesize) | Width and height of the background image. If the input is a **{width: Length, height: Length}** object and only one attribute is set, the other attribute is the set value multiplied by the original aspect ratio of the image. By default, the original image aspect ratio remains unchanged.
The value range of **width** and **height** is [0, +∞).
Default value: **ImageSize.Auto**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
A value less than 0 evaluates to the value **0**. If **height** is set but **width** is not, the image width is adjusted based on the original aspect ratio of the image.| | backgroundImagePosition | [Position](ts-types.md#position8) \| [Alignment](ts-appendix-enums.md#alignment) | Position of the background image in the component, that is, the coordinates relative to the upper left corner of the component.
Default value:
{
x: 0,
y: 0
}
When **x** and **y** are set in percentage, the offset is calculated based on the width and height of the component.
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md index fdff66a475bb3987ab7574b14d99fe0ea50a6ff0..7697d92ebdae9512ebcebfe4d46d6a43cf0143c2 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md @@ -10,19 +10,16 @@ You can apply background blur effects to a component. ## Attributes -| Name | Type | Description | +| Name | Parameter | Description | | -------------------- | ----------------------- | ------------------------ | -| backgroundBlurStyle | [BlurStyle](#blurstyle) | Style of the blur between the background and content for the current component. The input parameter indicates a blur material.
This API is supported in ArkTS widgets.| +| backgroundBlurStyle | value:[BlurStyle](ts-appendix-enums.md#blurstyle9),
options10+?:[BackgroundBlurStyleOptions](#backgroundblurstyleoptions10) | Background blur style applied between the content and the background.
**value**: settings of the background blur style, including the blur radius, mask color, mask opacity, and saturation.
**options**: background blur options. This parameter is optional.
This API is supported in ArkTS widgets.| + +## BackgroundBlurStyleOptions10+ -## BlurStyle - -This API is supported in ArkTS widgets. - - | Name | Description | - | ------- | ---------- | - | Thin | Thin material. | - | Regular | Regular material. | - | Thick | Thick material. | +| Name| Type| Mandatory| Description| +| ----------- | ------| ------ | ------ | +| colorMode10+ | [ThemeColorMode](ts-appendix-enums.md#themecolormode10) | No| Color mode used for the background blur.
Default value: **ThemeColorMode.System**| +| adaptiveColor10+ | [AdaptiveColor](ts-appendix-enums.md#adaptivecolor10) | No| Adaptive color mode.
Default value: **AdaptiveColor.Default**| ## Example @@ -30,16 +27,16 @@ This API is supported in ArkTS widgets. // xxx.ets @Entry @Component -struct Index { +struct BackgroundBlurStyleDemo { build() { Column() { Row() { Text("Thin Material") } - .width(350) - .height(300) - .backgroundBlurStyle(BlurStyle.Thin) - .position({ x: "15%", y: "30%" }) + .width('50%') + .height('50%') + .backgroundBlurStyle(BlurStyle.Thin, { colorMode: ThemeColorMode.Light, adaptiveColor: AdaptiveColor.Default }) + .position({ x: '15%', y: '30%' }) } .height('100%') .width('100%') diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md index b989c3554a0c0725688fbd44b2aed9fc95d99022..11394a20c84757bfff4fc3d95fc72a7f2c3ee428 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md @@ -12,9 +12,9 @@ Create a more gorgeous look for a component by applying a gradient color effect | Name | Type | Description | | -------------- | -------------------------------------------- | ----------------------------------- | -| linearGradient | {
angle?: number \| string,
direction?: [GradientDirection](ts-appendix-enums.md#gradientdirection),
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Linear gradient.
- **angle**: start angle of the linear gradient. A positive value indicates a clockwise rotation from the origin, (0, 0).
Default value: **180**
- **direction**: direction of the linear gradient. It does not take effect when **angle** is set.
Default value: **GradientDirection.Bottom**
- **colors**: colors of the linear gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| -| sweepGradient | {
center: Point,
start?: number \| string,
end?: number \| string,
rotation?: number\|string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Sweep gradient, which can sweep around the specified center point in the 0–360 degree range. If the rotation angle exceeds the range, a monochrome color instead of a gradient will be drawn.
- **center**: center point of the sweep gradient, that is, the coordinates relative to the upper left corner of the current component.
- **start**: start point of the sweep gradient.
Default value: **0**
- **end**: end point of the sweep gradient.
Default value: **0**
- **rotation**: rotation angle of the sweep gradient.
Default value: **0**
- **colors**: colors of the sweep gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| -| radialGradient | {
center: Point,
radius: number \| string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Radial gradient.
- **center**: center point of the radial gradient, that is, the coordinates relative to the upper left corner of the current component.
- **radius**: radius of the radial gradient.
- **colors**: colors of the radial gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| +| linearGradient | {
angle?: number \| string,
direction?: [GradientDirection](ts-appendix-enums.md#gradientdirection),
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Linear gradient.
- **angle**: start angle of the linear gradient. A positive value indicates a clockwise rotation from the origin, (0, 0).
Default value: **180**
- **direction**: direction of the linear gradient. It does not take effect when **angle** is set.
Default value: **GradientDirection.Bottom**
- **colors**: colors of the linear gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| +| sweepGradient | {
center: Point,
start?: number \| string,
end?: number \| string,
rotation?: number\|string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Sweep gradient, which can sweep around the specified center point in the 0–360 degree range. If the rotation angle exceeds the range, a monochrome color instead of a gradient will be drawn.
- **center**: center point of the sweep gradient, that is, the coordinates relative to the upper left corner of the current component.
- **start**: start point of the sweep gradient.
Default value: **0**
- **end**: end point of the sweep gradient.
Default value: **0**
- **rotation**: rotation angle of the sweep gradient.
Default value: **0**
- **colors**: colors of the sweep gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
A value less than 0 evaluates to the value **0**. A value greater than 360 evaluates to the value **1**.
When the data type of **start**, **end**, and **rotation** is string, the value **"90"** or **"90%"** is equivalent to **90**. | +| radialGradient | {
center: Point,
radius: number \| string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Radial gradient.
- **center**: center point of the radial gradient, that is, the coordinates relative to the upper left corner of the current component.
- **radius**: radius of the radial gradient.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **0**.
- **colors**: colors of the radial gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md index ff40648d9b60813d533cb79eee781df523738bf8..d5273a2bf095ea4fa4f34e2e7306f7b467ff72db 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md @@ -12,7 +12,7 @@ | Name | Type | Description | | ----------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| useSizeType | {
xs?: number \| { span: number, offset: number },
sm?: number \| { span: number, offset: number },
md?: number \| { span: number, offset: number },
lg?: number \| { span: number, offset: number }
} | Number of occupied columns and offset columns for a specific device width type. **span** indicates the number of occupied columns, and **offset** indicates the number of offset columns.
If the value is of the number type, only the number of columns can be set. If the value is in the format of {"span": 1, "offset": 0}, both the number of occupied columns and the number of offset columns need to be set.
- **xs** indicates that the device width type is **SizeType.XS**.
- **sm** indicates that the device width type is **SizeType.SM**.
- **md** indicates that the device width type is **SizeType.MD**.
- **lg** indicates that the device width type is **SizeType.LG**.| +| useSizeType(deprecated) | {
xs?: number \| { span: number, offset: number },
sm?: number \| { span: number, offset: number },
md?: number \| { span: number, offset: number },
lg?: number \| { span: number, offset: number }
} | Number of occupied columns and offset columns for a specific device width type. **span** indicates the number of occupied columns, and **offset** indicates the number of offset columns.
If the value is of the number type, only the number of columns can be set. If the value is in the format of {"span": 1, "offset": 0}, both the number of occupied columns and the number of offset columns need to be set.
- **xs** indicates that the device width type is **SizeType.XS**.
- **sm** indicates that the device width type is **SizeType.SM**.
- **md** indicates that the device width type is **SizeType.MD**.
- **lg** indicates that the device width type is **SizeType.LG**.
This attribute is deprecated since API version 9. You are advised to use [GridCol](ts-container-gridcol.md) and [GridRow](ts-container-gridrow.md) instead. | | gridSpan | number | Default number of occupied columns, that is, the number of occupied columns when **span** in **useSizeType** is not set.
**NOTE**
If the **span** attribute is set, the component width is determined by the grid layout.
Default value: **1**| | gridOffset | number | Default number of offset columns, that is, the number of offset columns in the start direction of the parent component (which is also the nth column that the component is in) when **offset** in **useSizeType** is not set.
**NOTE**
- After this attribute is set, the horizontal layout of the current component does not follow the original layout of the parent component. Instead, it offsets along the start direction of the parent component.
- Offset = (Column width + Gap) \* Number of columns.
- After this attribute is set, sibling components will be arranged relatively to this component, as in the relative layout.
Default value: **0**| diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md index 4d4e1e7440c93e9b80972d5582b0edfe8800a176..721a7a425c5153ed672c718921dcfe593958e481 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md @@ -12,16 +12,16 @@ Image effects include blur, shadow, and much more. | Name | Type | Default Value| Description | | ----------------------------- | ------------------------------------------------------------ | ------ | ------------------------------------------------------------ | -| blur | number | - | Applies the content blur effect to the current component. The input parameter is the blur radius. The larger the radius is, the more blurred the content is. If the value is **0**, the content is not blurred.
Since API version 9, this API is supported in ArkTS widgets.| -| backdropBlur | number | - | Applies the background blur effect to the current component. The input parameter is the blur radius. The larger the radius is, the more blurred the background is. If the value is **0**, the background is not blurred.
Since API version 9, this API is supported in ArkTS widgets.| -| shadow | [ShadowOptions](#shadowoptions) \| [ShadowStyle](#shadowstyle10) | - | Applies a shadow effect to the current component.
When the value type is **ShadowOptions**, the blur radius, shadow color, and offset along the x-axis and y-axis can be specified.
When the value type is **ShadowStyle**, the shadow style can be specified.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
ArkTS widgets do not support the [ShadowStyle](#shadowstyle10) value type. | -| grayscale | number | 0.0 | Converts the input image to grayscale. The value indicates the grayscale conversion ratio. If the input value is **1.0**, the image is converted into a grayscale image. If the input value is **0.0**, the image does not change. If the input value is between **0.0** and **1.0**, the effect changes in linear mode. The unit is percentage.
Since API version 9, this API is supported in ArkTS widgets.| -| brightness | number | 1.0 | Applies a brightness to the current component. The input parameter is a brightness ratio. The value **1** indicates no effects. The value **0** indicates the complete darkness. If the value is less than **1**, the brightness decreases. If the value is greater than **1**, the brightness increases. A larger value indicates a higher brightness.
Since API version 9, this API is supported in ArkTS widgets.| -| saturate | number | 1.0 | Applies the saturation effect to the current component. The saturation is the ratio of the chromatic component to the achromatic component (gray) in a color. When the input value is **1**, the source image is displayed. When the input value is greater than **1**, a higher percentage of the chromatic component indicates a higher saturation. When the input value is less than **1**, a higher percentage of the achromatic component indicates a lower saturation. The unit is percentage.
Since API version 9, this API is supported in ArkTS widgets.| -| contrast | number | 1.0 | Applies the contrast effect to the current component. The input parameter is a contrast value. If the value is **1**, the source image is displayed. If the value is greater than **1**, a larger value indicates a higher contrast and a clearer image. If the value is less than **1**, a smaller value indicates a lower contrast is. If the value is **0**, the image becomes all gray. The unit is percentage.
Since API version 9, this API is supported in ArkTS widgets.| -| invert | number | 0 | Inverts the input image. The input parameter is an image inversion ratio. The value **1** indicates complete inversion. The value **0** indicates that the image does not change. The unit is percentage.
Since API version 9, this API is supported in ArkTS widgets.| -| sepia | number | 0 | Converts the image color to sepia. The input parameter is an image inversion ratio. The value **1** indicates the image is completely sepia. The value **0** indicates that the image does not change. The unit is percentage.
Since API version 9, this API is supported in ArkTS widgets.| -| hueRotate | number \| string | '0deg' | Applies the hue rotation effect to the current component. The input parameter is a rotation angle.
Since API version 9, this API is supported in ArkTS widgets.| +| blur | number | - | Applies the content blur effect to the current component. The input parameter is the blur radius. The larger the radius is, the more blurred the content is. If the value is **0**, the content is not blurred.
Value range: [0, +∞)
Since API version 9, this API is supported in ArkTS widgets.| +| backdropBlur | number | - | Applies the background blur effect to the current component. The input parameter is the blur radius. The larger the radius is, the more blurred the background is. If the value is **0**, the background is not blurred.
Value range: [0, +∞)
Since API version 9, this API is supported in ArkTS widgets.| +| shadow | [ShadowOptions](#shadowoptions) \| [ShadowStyle](#shadowstyle10) | - | Applies a shadow effect to the current component.
When the value type is **ShadowOptions**, the blur radius, shadow color, and offset along the x-axis and y-axis can be specified.
When the value type is **ShadowStyle**, the shadow style can be specified.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
ArkTS widgets do not support the [ShadowStyle](#shadowstyle10) value type.| +| grayscale | number | 0.0 | Converts the input image to grayscale. The value indicates the grayscale conversion ratio. If the input value is **1.0**, the image is converted into a grayscale image. If the input value is **0.0**, the image does not change. If the input value is between **0.0** and **1.0**, the effect changes in linear mode. The unit is percentage.
Value range: [0, 1]
**NOTE**
A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.
Since API version 9, this API is supported in ArkTS widgets.| +| brightness | number | 1.0 | Applies a brightness to the current component. The input parameter is a brightness ratio. The value **1** indicates no effects. The value **0** indicates the complete darkness. If the value is less than **1**, the brightness decreases. If the value is greater than **1**, the brightness increases. A larger value indicates a higher brightness.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **0**.
Since API version 9, this API is supported in ArkTS widgets.| +| saturate | number | 1.0 | Applies the saturation effect to the current component. The saturation is the ratio of the chromatic component to the achromatic component (gray) in a color. When the input value is **1**, the source image is displayed. When the input value is greater than **1**, a higher percentage of the chromatic component indicates a higher saturation. When the input value is less than **1**, a higher percentage of the achromatic component indicates a lower saturation. The unit is percentage.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **0**.
Since API version 9, this API is supported in ArkTS widgets.| +| contrast | number | 1.0 | Applies the contrast effect to the current component. The input parameter is a contrast value. If the value is **1**, the source image is displayed. If the value is greater than 1, a larger value indicates a higher contrast and a clearer image. If the value is less than 1, a smaller value indicates a lower contrast is. If the value is **0**, the image becomes all gray. The unit is percentage.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **0**.
Since API version 9, this API is supported in ArkTS widgets.| +| invert | number | 0 | Inverts the input image. The input parameter is an image inversion ratio. The value **1** indicates complete inversion, and **0** indicates that the image does not change. The unit is percentage.
Value range: [0, 1]
**NOTE**
A value less than 0 evaluates to the value **0**.
Since API version 9, this API is supported in ArkTS widgets.| +| sepia | number | 0 | Converts the image color to sepia. The input parameter is an image conversion ratio. The value **1** indicates the image is completely sepia, and **0** indicates that the image does not change. The unit is percentage.
Since API version 9, this API is supported in ArkTS widgets.| +| hueRotate | number \| string | '0deg' | Applies the hue rotation effect to the current component. The input parameter is a rotation angle.
Value range: (-∞, +∞)
**NOTE**
A rotation of 360 degrees leaves the color unchanged. A rotation of 180 degrees and then –180 degrees also leaves the color unchanged. When the data type is number, the value 90 is equivalent to **'90deg'**.
Since API version 9, this API is supported in ArkTS widgets.| | colorBlend 8+ | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource) | - | Applies the color blend effect to the current component. The input parameter is the blended color.
Since API version 9, this API is supported in ArkTS widgets.| ## ShadowOptions @@ -32,8 +32,8 @@ Since API version 9, this API is supported in ArkTS widgets. | Name | Type | Mandatory | Description | | ------ | ------ | ---- | --------------- | -| radius | number \| [Resource](ts-types.md#resource) | Yes | Blur radius of the shadow. | -| color | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource) | No | Color of the shadow.
The default value is gray.| +| radius | number \| [Resource](ts-types.md#resource) | Yes | Blur radius of the shadow.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **0**.| +| color | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource) | No | Color of the shadow.
The default color is black.| | offsetX | number \| [Resource](ts-types.md#resource) | No | Offset of the shadow along the x-axis.
The default value is **0**. | | offsetY | number \| [Resource](ts-types.md#resource) | No | Offset of the shadow along the y-axis.
The default value is **0**.| diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md index 2c43828da9bc9d793b0fb75047e76cf862892712..37c96bd580acac247e9b7cbc51c7e30618ceb741 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md @@ -32,19 +32,15 @@ struct PositionExample1 { Column({ space: 10 }) { // When the component content is within the area specified by the component width and height, set the alignment mode of the content in the component. Text('align').fontSize(9).fontColor(0xCCCCCC).width('90%') - Text('top start') - .align(Alignment.TopStart) - .height(50) - .width('90%') - .fontSize(16) - .backgroundColor(0xFFE4C4) - - Text('Bottom end') - .align(Alignment.BottomEnd) - .height(50) - .width('90%') - .fontSize(16) - .backgroundColor(0xFFE4C4) + Stack() { + Text('First show in bottom end').height('65%').backgroundColor(0xD2B48C) + Text('Second show in bottom end').backgroundColor(0xF5DEB3).opacity(0.9) + }.width('90%').height(50).margin({ top: 5 }).backgroundColor(0xFFE4C4) + .align(Alignment.BottomEnd) + Stack() { + Text('top start') + }.width('90%').height(50).margin({ top: 5 }).backgroundColor(0xFFE4C4) + .align(Alignment.TopStart) // To arrange the child components from left to right, set direction of the parent container to Direction.Ltr. Text('direction').fontSize(9).fontColor(0xCCCCCC).width('90%') @@ -86,6 +82,7 @@ struct PositionExample2 { Text('position').fontSize(12).fontColor(0xCCCCCC).width('90%') Row() { Text('1').size({ width: '30%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('2 position(30, 10)') .size({ width: '60%', height: '30' }) .backgroundColor(0xbbb2cb) @@ -94,6 +91,7 @@ struct PositionExample2 { .align(Alignment.Start) .position({ x: 30, y: 10 }) Text('3').size({ width: '45%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('4 position(50%, 70%)') .size({ width: '50%', height: '50' }) .backgroundColor(0xbbb2cb) @@ -110,14 +108,20 @@ struct PositionExample2 { .size({ width: '100', height: '100' }) .backgroundColor(0xdeb887) Text('text') + .fontSize('30px') + .textAlign(TextAlign.Center) .size({ width: 25, height: 25 }) .backgroundColor(Color.Green) .markAnchor({ x: 25, y: 25 }) Text('text') + .fontSize('30px') + .textAlign(TextAlign.Center) .size({ width: 25, height: 25 }) .backgroundColor(Color.Green) .markAnchor({ x: -100, y: -25 }) Text('text') + .fontSize('30px') + .textAlign(TextAlign.Center) .size({ width: 25, height: 25 }) .backgroundColor(Color.Green) .markAnchor({ x: 25, y: -25 }) @@ -127,6 +131,7 @@ struct PositionExample2 { Text('offset').fontSize(12).fontColor(0xCCCCCC).width('90%') Row() { Text('1').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('2 offset(15, 30)') .size({ width: 120, height: '50' }) .backgroundColor(0xbbb2cb) @@ -135,6 +140,7 @@ struct PositionExample2 { .align(Alignment.Start) .offset({ x: 15, y: 30 }) Text('3').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('4 offset(-10%, 20%)') .size({ width: 100, height: '50' }) .backgroundColor(0xbbb2cb) diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md index 3fe2fd67e04bb818ccc5625f7f7d9d61e9347ea2..bba053499cccf91804f860a217b78af3ace9c390 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md @@ -1,6 +1,6 @@ -# Text Style +# Universal Text Attributes -The text style attributes set the style for text in a component. +Universal text attributes include text style attributes applicable to text containers. > **NOTE** > @@ -18,6 +18,8 @@ The text style attributes set the style for text in a component. | fontStyle | [FontStyle](ts-appendix-enums.md#fontstyle) | Font style.
Default value: **FontStyle.Normal** | | fontWeight | number \| [FontWeight](ts-appendix-enums.md#fontweight) \| string | Font weight. For the number type, the value ranges from 100 to 900, at an interval of 100. The default value is **400**. A larger value indicates a larger font weight. The string type supports only the string of the number type, for example, **400**, **"bold"**, **"bolder"**, **"lighter"**, **"regular"**, and **"medium"**, which correspond to the enumerated values in **FontWeight**.
Default value: **FontWeight.Normal** | | fontFamily | string \| [Resource](ts-types.md#resource) | Font family.
Default value: **'HarmonyOS Sans'**
Currently, only the default font is supported. | +| lineHeight | string \| number \| [Resource](ts-types.md#resource) | Text line height. If the value is less than or equal to **0**, the line height is not limited and the font size is adaptive. If the value of the number type, the unit fp is used.| +| decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | Style and color of the text decorative line.
Default value: {
type: TextDecorationType.None,
color: Color.Black
} | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md b/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md index 47d797b263a133c740bcf5864b6347ed76af30b6..64ff5cd450da4f88e462bdf3f6e80858adcda14e 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md @@ -10,7 +10,7 @@ A drag event is triggered when a component is dragged. | Name | Bubbling Supported| Description | | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ | -| onDragStart(event: (event?: [DragEvent](#dragevent), extraParams?: string) => [CustomBuilder](ts-types.md#custombuilder8) \| [DragItemInfo](#dragiteminfo)) | No | Triggered when the component bound to the event is dragged for the first time.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **[extraParams](#extraparams)**.
Return value: object being dragged, which is used for prompts displayed when the object is dragged.
A drag event can be triggered by a 150 ms long press. If the duration of a long-press gesture is set to less than or equal to 150 ms, the callback for the long-press gesture takes precedence. Otherwise, the callback for the drag event takes precedence.| +| onDragStart(event: (event?: [DragEvent](#dragevent), extraParams?: string) => [CustomBuilder](ts-types.md#custombuilder8) \| [DragItemInfo](#dragiteminfo)) | No | Triggered when the component bound to the event is dragged for the first time.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **[extraParams](#extraparams)**.
Return value: object being dragged, which is used for prompts displayed when the object is dragged.
A drag event can be triggered by a 500 ms long press. If the duration of a long-press gesture is set to less than or equal to 500 ms, the callback for the long-press gesture takes precedence. Otherwise, the callback for the drag event takes precedence.| | onDragEnter(event: (event?: [DragEvent](#dragevent), extraParams?: string) => void) | No | Triggered when the dragged item enters a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **[extraParams](#extraparams)**.
This event is valid only when a listener for the **onDrop** event is enabled.| | onDragMove(event: (event?: [DragEvent](#dragevent), extraParams?: string) => void) | No | Triggered when the dragged item moves in a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **[extraParams](#extraparams)**.
This event is valid only when a listener for the **onDrop** event is enabled.| | onDragLeave(event: (event?: [DragEvent](#dragevent), extraParams?: string) => void) | No | Triggered when the dragged item leaves a valid drop target.
- **event**: information about the drag event, including the coordinates of the item that is being dragged.
- **extraParams**: additional information about the drag event. For details, see **[extraParams](#extraparams)**.
This event is valid only when a listener for the **onDrop** event is enabled.| @@ -67,7 +67,7 @@ struct DragExample { @State bananaVisible: Visibility = Visibility.Visible private dragList: string[] = ['apple', 'orange', 'banana'] @State fruitVisible: Visibility[] = [Visibility.Visible, Visibility.Visible, Visibility.Visible] - @State index: number = 0 + @State idx: number = 0 // Customize the content displayed during dragging. @Builder pixelMapBuilder() { @@ -104,7 +104,7 @@ struct DragExample { .onTouch((event: TouchEvent) => { if (event.type === TouchType.Down) { this.eventType = 'Down' - this.index = index + this.idx = index } if (event.type === TouchType.Up) { this.eventType = 'Up' @@ -157,7 +157,7 @@ struct DragExample { this.numbers.splice(jsonString.insertIndex, 0, this.text) this.bool = false } - this.fruitVisible[this.index] = Visibility.None + this.fruitVisible[this.idx] = Visibility.None }) }.width('100%').height('100%').padding({ top: 20 }).margin({ top: 20 }) } diff --git a/en/application-dev/telephony/telephony-call.md b/en/application-dev/telephony/telephony-call.md index 8fc44ed193a78137b73a29854e539494147b9bc2..2f87fb62656f10b9185ebcd94b46c70fc3bd32e6 100644 --- a/en/application-dev/telephony/telephony-call.md +++ b/en/application-dev/telephony/telephony-call.md @@ -108,9 +108,3 @@ This permission is of the **system\_basic** level. Before applying for the permi console.log("call state change, data is:" + JSON.stringify(data)); }); ``` - -## Samples - -The following sample is provided to help you better understand how to develop the call service: - -- [Call](https://gitee.com/openharmony/applications_app_samples/tree/master/Telephony/Call) diff --git a/en/application-dev/telephony/telephony-sms.md b/en/application-dev/telephony/telephony-sms.md index a8cf16532ae4537e2628821d2af933f7d0a0a176..714d2f182b9e5452065db19f171b5dc45e522f73 100644 --- a/en/application-dev/telephony/telephony-sms.md +++ b/en/application-dev/telephony/telephony-sms.md @@ -110,9 +110,3 @@ The Short Messaging Service (SMS) module provides basic SMS management functions } } ``` - - -## Samples - -The following sample is provided to help you better understand how to develop the SMS service: -- [SMS](https://gitee.com/openharmony/applications_app_samples/tree/master/Telephony/Message) diff --git a/en/application-dev/ui/ui-ts-animation-feature.md b/en/application-dev/ui/ui-ts-animation-feature.md index f7933b9555ff6fb6312c4e8fabc1d2a5be30d168..3d6467e08cc112b6b9a953aa4d0a649486042bd2 100644 --- a/en/application-dev/ui/ui-ts-animation-feature.md +++ b/en/application-dev/ui/ui-ts-animation-feature.md @@ -132,7 +132,7 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte .onAppear(() => { animateTo({ - duration: 2000, + duration: 1000, curve: this.curve1, delay: 100, onFinish: () => { @@ -199,7 +199,7 @@ The splash screen animation refers to the fade-in and fade-out of the logo. Afte .opacity(this.opacityValue) .onAppear(() => { animateTo({ - duration: 2000, + duration: 1000, curve: this.curve1, delay: 100, onFinish: () => { diff --git a/en/application-dev/ui/ui-ts-layout-mediaquery.md b/en/application-dev/ui/ui-ts-layout-mediaquery.md index 205265a30d244ad6100e0f1fc0a19c81859ae3d3..c37468c67f14b37878f22c9138612aebba805975 100644 --- a/en/application-dev/ui/ui-ts-layout-mediaquery.md +++ b/en/application-dev/ui/ui-ts-layout-mediaquery.md @@ -10,32 +10,32 @@ ## Usage -Invoke the **mediaquery** API to set the media query condition and the callback, and change the page layout or implement service logic in the callback corresponding to the condition. +Invoke the **mediaquery** API to set the media query condition and the callback, and change the page layout or implement service logic in the callback corresponding to the condition. The procedure is as follows: -First, import the **mediaquery** module, as shown below: +1. Import the **mediaquery** module, as shown below: -```ts -import mediaquery from '@ohos.mediaquery' -``` + ```ts + import mediaquery from '@ohos.mediaquery' + ``` -Then, use the **matchMediaSync** API to set the media query condition and save the returned listener, as shown below: +2. Use the **matchMediaSync** API to set the media query condition and save the returned listener, as shown below: -```ts -listener = mediaquery.matchMediaSync('(orientation: landscape)') -``` + ```ts + listener = mediaquery.matchMediaSync('(orientation: landscape)') + ``` -Finally, register the **onPortrait** callback using the saved listener, and change the page layout or implement service logic in the callback. When the media query condition is matched, the callback is triggered. The sample code is as follows: +3. Register the **onPortrait** callback using the saved listener, and change the page layout or implement service logic in the callback. When the media query condition is matched, the callback is triggered. The sample code is as follows: -```ts -onPortrait(mediaQueryResult) { - if (mediaQueryResult.matches) { - // do something here - } else { - // do something here - } -} -listener.on('change', onPortrait) -``` + ```ts + onPortrait(mediaQueryResult) { + if (mediaQueryResult.matches) { + // do something here + } else { + // do something here + } + } + listener.on('change', onPortrait) + ``` ## Media Query Conditions @@ -95,10 +95,10 @@ At MediaQuery Level 4, range query is imported so that you can use the operators | height | Height of the display area on the application page. | | min-height | Minimum height of the display area on the application page. | | max-height | Maximum height of the display area on the application page. | -| width | Width of the display area on the app page. | +| width | Width of the display area on the application page. | | min-width | Minimum width of the display area on the application page. | | max-width | Maximum width of the display area on the application page. | -| resolution | Resolution of the device. The unit can be dpi, dppx, or dpcm.
- **dpi** indicates the number of physical pixels per inch. 1 dpi ≈ 0.39 dpcm.
- **dpcm** indicates the number of physical pixels per centimeter. 1 dpcm ≈ 2.54 dpi.
- **dppx** indicates the number of physical pixels in each pixel. (This unit is calculated based on this formula: 96 px = 1 inch, which is different from the calculation method of the px unit on the page.) 1 dppx = 96 dpi.| +| resolution | Resolution of the device. The unit can be dpi, dppx, or dpcm.
- **dpi** indicates the number of physical pixels per inch. 1 dpi ≈ 0.39 dpcm.
- **dpcm** indicates the number of physical pixels per centimeter. 1 dpcm ≈ 2.54 dpi.
- **dppx** indicates the number of physical pixels in each pixel. (This unit is calculated based on this formula: 96 px = 1 inch, which is different from the calculation method of the px unit on the page.) 1 dppx = 96 dpi.| | min-resolution | Minimum device resolution. | | max-resolution | Maximum device resolution. | | orientation | Screen orientation.
Options are as follows:
- orientation: portrait
- orientation: landscape| @@ -106,7 +106,7 @@ At MediaQuery Level 4, range query is imported so that you can use the operators | min-device-height | Minimum height of the device. | | max-device-height | Maximum height of the device. | | device-width | Width of the device. | -| device-type | Type of the device.
Value range: **default** | +| device-type | Type of the device.
Options: **default** and tablet | | min-device-width | Minimum width of the device. | | max-device-width | Maximum width of the device. | | round-screen | Screen type. The value **true** means that the screen is round, and **false** means the opposite. | diff --git a/en/contribute/documentation-contribution.md b/en/contribute/documentation-contribution.md index 8901080d124e33855949e5594f1a0e2fb3fd5a46..936327860ae68817d01c716a8714033ede45a5a0 100755 --- a/en/contribute/documentation-contribution.md +++ b/en/contribute/documentation-contribution.md @@ -26,15 +26,15 @@ Your feedback matters. Submit issues and leave as detailed information as possib 1. On the Gitee page, click the **Issues** tab. On the displayed page, click **New issue**. Then enter the issue title and issue details. 2. Click **New** to submit the issue. The Docs team will confirm the issue. ->![](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> +> **How can I provide a high-quality issue?** > ->**How can I provide a high-quality issue?** -> ->- Provide a clear description of the issue, including the missing, outdated, incorrect, or to-be-improved content. ->- Explain the impact of this issue on users. ->- Limit the scope of the given issue to a specific task. If multiple fields are involved, break the issue down into smaller ones. For example, "Documents need to be optimized" is a broad issue, whereas "XX development guide lacks introduction to step XXX" is specific and operable. ->- Search the list of existing issues to see if any related or similar issues have been submitted. ->- If an issue is associated with another issue or a pull request (PR), you can use its full URL or the combination of the number sign (#) and PR number to reference it. +> - Provide a clear description of the issue, including the missing, outdated, incorrect, or to-be-improved content. +> - Explain the impact of this issue on users. +> - Limit the scope of the given issue to a specific task. If multiple fields are involved, break the issue down into smaller ones. For example, "Documents need to be optimized" is a broad issue, whereas "XX development guide lacks introduction to step XXX" is specific and operable. +> - Search the list of existing issues to see if any related or similar issues have been submitted. +> - If an issue is associated with another issue or a pull request (PR), you can use its full URL or the combination of the number sign (#) and PR number to reference it. ### Editing Existing Documents diff --git a/en/contribute/writing-instructions.md b/en/contribute/writing-instructions.md index f1ff49c6bd1e3e066a5883c5d65e2e0aad7a7dbf..f98e1ea7eb6cfba9c43e4092886997d5bfa7618c 100755 --- a/en/contribute/writing-instructions.md +++ b/en/contribute/writing-instructions.md @@ -60,8 +60,8 @@ Pictures used in **OpenHarmony\_DOCUMENTS/docs/quick-start/writing-instructions Use relative paths to reference pictures in the document. ->![](public_sys-resources/icon-caution.gif) **CAUTION:** ->Use the original pictures to avoid intellectual property infringement risks. +> **CAUTION** +> Use the original pictures to avoid intellectual property infringement risks. - Pictures are clear and complete. For example, a flowchart has a start and an end. - The graphics has clear logic and are provided with text descriptions. Do not separate the graphics from the text. @@ -69,9 +69,9 @@ Use relative paths to reference pictures in the document. - The text on pictures should be Chinese in Chinese documents and English in English documents. - It is recommended that pictures be named based on the content. Using only a number is difficult for picture inheritance. ->![](public_sys-resources/icon-note.gif) **NOTE:** ->Reference: ->!\[\]\(./pic/pic-standard.png\) +> **NOTE:** +> Reference: +> !\[\]\(./pic/pic-standard.png\) If a self-made picture is used, refer to the following figure to configure the color. The format can be **png**, **jpg**, **gif**, and so on. diff --git a/en/device-dev/subsystems/Readme-EN.md b/en/device-dev/subsystems/Readme-EN.md index 3c97fc6d362ffb32a79bab32490658047cde7aad..48abe9e925388d38780f85266985ff7532988f89 100644 --- a/en/device-dev/subsystems/Readme-EN.md +++ b/en/device-dev/subsystems/Readme-EN.md @@ -50,10 +50,6 @@ - [Sensor Overview](subsys-sensor-overview.md) - [Sensor Usage Guidelines](subsys-sensor-guide.md) - [Sensor Usage Example](subsys-sensor-demo.md) -- USB - - [USB Overview](subsys-usbservice-overview.md) - - [USB Usage Guidelines](subsys-usbservice-guide.md) - - [USB Usage Example](subsys-usbservice-demo.md) - Application Framework - [Application Framework Overview](subsys-application-framework-overview.md) - [Setting Up a Development Environment](subsys-application-framework-envbuild.md) diff --git a/en/device-dev/subsystems/subsys-usbservice-demo.md b/en/device-dev/subsystems/subsys-usbservice-demo.md deleted file mode 100644 index e78028f32a2f5b20d27267809d35b6bdcd1a0369..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/subsys-usbservice-demo.md +++ /dev/null @@ -1,185 +0,0 @@ -# USB Usage Example - - -```cpp -#include -#include -#include -#include -#include -#include -#include "if_system_ability_manager.h" -#include "ipc_skeleton.h" -#include "iremote_object.h" -#include "iservice_registry.h" -#include "iusb_srv.h" -#include "string_ex.h" -#include "system_ability_definition.h" -#include "usb_common.h" -#include "usb_device.h" -#include "usb_errors.h" -#include "usb_request.h" -#include "usb_server_proxy.h" -#include "usb_srv_client.h" - -const int32_t REQUESTYPE = ((1 << 7) | (0 << 5) | (0 & 0x1f)); -const int32_t REQUESTCMD = 6; -const int32_t VALUE = (2 << 8) + 0; -const int32_t TIMEOUT = 5000; -const int32_t ITFCLASS = 10; -const int32_t PRAMATYPE = 2; -const int32_t BUFFERLENGTH = 21; - -void GetType(OHOS::USB::USBEndpoint &tep, OHOS::USB::USBEndpoint &outEp, bool &outEpFlg) -{ - if ((tep.GetType() == PRAMATYPE)) { - if (tep.GetDirection() == 0) { - outEp = tep; - outEpFlg = true; - } - } -} - -bool SelectEndpoint(OHOS::USB::USBConfig config, - std::vector interfaces, - OHOS::USB::UsbInterface &interface, - OHOS::USB::USBEndpoint &outEp, - bool &outEpFlg) -{ - for (int32_t i = 0; i < config.GetInterfaceCount(); ++i) { - OHOS::USB::UsbInterface tif = interfaces[i]; - std::vector mEndpoints = tif.GetEndpoints(); - for (int32_t j = 0; j < tif.GetEndpointCount(); ++j) { - OHOS::USB::USBEndpoint tep = mEndpoints[j]; - if ((tif.GetClass() == ITFCLASS) && (tif.GetSubClass() == 0) && (tif.GetProtocol() == PRAMATYPE)) { - GetType(tep, outEp, outEpFlg); - } - } - if (outEpFlg) { - interface = interfaces[i]; - return true; - } - std::cout << std::endl; - } - return false; -} - -int OpenDeviceTest(OHOS::USB::UsbSrvClient &Instran, OHOS::USB::UsbDevice device, OHOS::USB::USBDevicePipe &pip) -{ - int ret = Instran.RequestRight(device.GetName()); - std::cout << "device RequestRight ret = " << ret << std::endl; - if (0 != ret) { - std::cout << "device RequestRight failed = " << ret << std::endl; - } - ret = Instran.OpenDevice(device, pip); - return ret; -} - -int CtrTransferTest(OHOS::USB::UsbSrvClient &Instran, OHOS::USB::USBDevicePipe &pip) -{ - std::cout << "usb_device_test : << Control Transfer >> " << std::endl; - std::vector vData; - const OHOS::USB::UsbCtrlTransfer tctrl = {REQUESTYPE, REQUESTCMD, VALUE, 0, TIMEOUT}; - int ret = Instran.ControlTransfer(pip, tctrl, vData); - if (ret != 0) { - std::cout << "control message read failed width ret = " << ret << std::endl; - } else { - } - std::cout << "control message read success" << std::endl; - - return ret; -} - -int ClaimTest(OHOS::USB::UsbSrvClient &Instran, - OHOS::USB::USBDevicePipe &pip, - OHOS::USB::UsbInterface &interface, - bool interfaceFlg) -{ - if (interfaceFlg) { - std::cout << "ClaimInterface InterfaceInfo:" << interface.ToString() << std::endl; - int ret = Instran.ClaimInterface(pip, interface, true); - if (ret != 0) { - std::cout << "ClaimInterface failed width ret = " << ret << std::endl; - } else { - std::cout << "ClaimInterface success" << std::endl; - } - } - return 0; -} - -int BulkTransferTest(OHOS::USB::UsbSrvClient &Instran, - OHOS::USB::USBDevicePipe &pip, - OHOS::USB::USBEndpoint &outEp, - bool interfaceFlg, - bool outEpFlg) -{ - if (interfaceFlg) { - std::cout << "usb_device_test : << Bulk transfer start >> " << std::endl; - if (outEpFlg) { - uint8_t buffer[50] = "hello world 123456789"; - std::vector vData(buffer, buffer + BUFFERLENGTH); - int ret = Instran.BulkTransfer(pip, outEp, vData, TIMEOUT); - if (ret != 0) { - std::cout << "Bulk transfer write failed width ret = " << ret << std::endl; - } else { - std::cout << "Bulk transfer write success" << std::endl; - } - return ret; - } - } - return 0; -} - -int main(int argc, char **argv) -{ - std::cout << "usb_device_test " << std::endl; - static OHOS::USB::UsbSrvClient &Instran = OHOS::USB::UsbSrvClient::GetInstance(); - // GetDevices - std::vector deviceList; - int32_t ret = Instran.GetDevices(deviceList); - if (ret != 0) { - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } - if (deviceList.empty()) { - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } - - OHOS::USB::UsbDevice device = deviceList[0]; - std::vector configs = device.GetConfigs(); - OHOS::USB::USBConfig config = configs[0]; - std::vector interfaces = config.GetInterfaces(); - OHOS::USB::UsbInterface interface; - OHOS::USB::USBEndpoint outEp; - bool interfaceFlg = false; - bool outEpFlg = false; - interfaceFlg = SelectEndpoint(config, interfaces, interface, outEp, outEpFlg); - - // OpenDevice - std::cout << "usb_device_test : << OpenDevice >> test begin -> " << std::endl; - OHOS::USB::USBDevicePipe pip; - ret = OpenDeviceTest(Instran, device, pip); - if (ret != 0) { - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } - - // ControlTransfer - CtrTransferTest(Instran, pip); - - // ClaimInterface - ClaimTest(Instran, pip, interface, interfaceFlg); - - // BulkTransferWrite - BulkTransferTest(Instran, pip, outEp, interfaceFlg, outEpFlg); - - // CloseDevice - std::cout << "usb_device_test : << Close Device >> " << std::endl; - ret = Instran.Close(pip); - if (ret == 0) { - std::cout << "Close device failed width ret = " << ret << std::endl; - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } else { - std::cout << "Close Device success" << std::endl; - } - return 0; -} -``` diff --git a/en/device-dev/subsystems/subsys-usbservice-guide.md b/en/device-dev/subsystems/subsys-usbservice-guide.md deleted file mode 100644 index 8f95d32cb3f671474f961ffc728729a86585c6dd..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/subsys-usbservice-guide.md +++ /dev/null @@ -1,55 +0,0 @@ -# USB Usage Guidelines - - -The following procedure uses bulk transfer as an example. - -## Procedure - -1. Obtain a USB service instance. - -```cpp -static OHOS::USB::UsbSrvClient &g_usbClient = OHOS::USB::UsbSrvClient::GetInstance(); -``` - -2. Obtain the USB device list. - -```cpp -std::vector deviceList; -int32_t ret = g_usbClient.GetDevices(deviceList); -``` - -3. Apply for device access permissions. - -```cpp -int32_t ret = g_usbClient.RequestRight(device.GetName()); -``` - -4. Open the USB device. - -```cpp -USBDevicePipe pip; -int32_t et = g_usbClient.OpenDevice(device, pip); -``` - -5. Configure the USB interface. - -```cpp -ret = g_usbClient.ClaimInterface(pip, interface, true); // **interface** indicates an interface of the USB device in **deviceList**. -``` - -6. Transfer data. - -```cpp -srvClient.BulkTransfer(pipe, endpoint, vdata, timeout); -``` -Parameter description: -- **pipe**: pipe for data transfer of the USB device opened. -- **endpoint**: endpoint for data transfer on the USB device. -- **vdata**: binary data block to be transferred or read. -- **timeout**: timeout duration of data transfer. - -7. Close the USB device. - -```cpp -ret = g_usbClient.Close(pip); -``` diff --git a/en/device-dev/subsystems/subsys-usbservice-overview.md b/en/device-dev/subsystems/subsys-usbservice-overview.md deleted file mode 100644 index e4cc9c9ccd95ee4f8d72f949b778360cae860c1a..0000000000000000000000000000000000000000 --- a/en/device-dev/subsystems/subsys-usbservice-overview.md +++ /dev/null @@ -1,338 +0,0 @@ -# USB - -## Introduction - -### Function Description - -USB devices are classified into two types: USB host and USB device. On OpenHarmony, you can use the port service to switch between the host mode and device mode. In host mode, you can obtain the list of connected USB devices, manage device access permissions, and perform bulk transfer or control transfer between the host and connected devices. In device mode, you can switch between functions including HDC (debugging), ACM (serial port), and ECM (Ethernet port). - -### Basic Concepts - -- USB service - - An abstraction of underlying hardware-based USB devices. Your application can access the USB devices via the USB service. With the APIs provided by the USB service, you can obtain the list of connected USB devices, manage device access permissions, and perform data transfer or control transfer between the host and connected devices. - -- USB API - - A collection of JS APIs provided for the upper layer through NAPI. Your application can use USB APIs to implement various basic functions, for example, query of the USB device list, USB device plug notification, USB host and device mode switching, bulk transfer, control transfer, right management, and function switching in device mode. - -- USB Service layer - - A layer implemented by using the C++ programming language. It consists of four modules: Host, Device, Port, and Right. HDI-based APIs provided by USB Service are mainly used to implement management of USB device list, USB functions, USB ports, and USB device access permissions. The USB Service layer interacts with the HAL layer to receive, parse, and distribute data, manages foreground and background policies, and performs USB device management and right control. - -- USB HAL layer - - A layer implemented by using the C programming language. Based on the Host Driver Development Kit (SDK) and Device DDK, USB HAL encapsulates basic USB device operations, provides C++ APIs for the upper layer, and receives information from the kernel through the Hardware Driver Foundation (HDF) framework. - -### Working Principles - -The USB subsystem logically consists of three parts: USB API, USB Service, and USB HAL. The following figure shows how the USB service is implemented. - - **Figure 1** USB service architecture - ![USB service architecture](figures/en-us_image_0000001267088285.png) - -- USB API: provides USB APIs that implement various basic functions, for example, query of the USB device list, bulk data transfer, control transfer, and right management. - -- USB Service: receives, parses, and distributes Hardware Abstraction Layer (HAL) data, manages and controls foreground and background policies, and manages devices. - -- USB HAL: provides driver capability APIs that can be directly called in user mode. - -## Usage Guidelines - -### When to Use - -In Host mode, you can obtain the list of connected devices, enable or disable the devices, manage device access permissions, and perform data transfer or control transfer. - -### APIs - - **Table 1** Host-specific APIs - -| API | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| int32_t OpenDevice(const UsbDevice &device, USBDevicePipe &pip); | Opens a USB device to set up a connection. | -| bool HasRight(std::string deviceName); | Checks whether the application has the permission to access the device. | -| int32_t RequestRight(std::string deviceName); | Requests the temporary permission for a given application to access the USB device. | -| int32_t GetDevices(std::vector &deviceList); | Obtains the USB device list. | -| int32_t ClaimInterface(USBDevicePipe &pip, const UsbInterface &interface, bool force); | Claims a USB interface exclusively. This must be done before data transfer. | -| int32_t ReleaseInterface(USBDevicePipe &pip, const UsbInterface &interface); | Releases a USB interface. This is usually done after data transfer. | -| int32_t BulkTransfer(USBDevicePipe &pip, const USBEndpoint &endpoint, std::vector &vdata, int32_t timeout); | Performs a bulk transfer on a specified endpoint. The data transfer direction is determined by the endpoint direction.| -| int32_t ControlTransfer(USBDevicePipe &pip, const UsbCtrlTransfer &ctrl, std::vector &vdata); | Performs control transfer for endpoint 0 of the device. The data transfer direction is determined by the request type. | -| int32_t SetConfiguration(USBDevicePipe &pip, const USBConfig &config); | Sets the current configuration of the USB device. | -| int32_t SetInterface(USBDevicePipe &pipe, const UsbInterface &interface); | Sets the alternate settings for the specified USB interface. This allows you to switch between two interfaces with the same ID but different alternate settings.| -| int32_t GetRawDescriptors(std::vector &vdata); | Obtains the raw USB descriptor. | -| int32_t GetFileDescriptor(); | Obtains the file descriptor. | -| bool Close(const USBDevicePipe &pip); | Closes a USB device to release all system resources related to the device. | -| int32_t PipeRequestWait(USBDevicePipe &pip, int64_t timeout, UsbRequest &req); | Obtains the isochronous transfer result. | -| int32_t RequestInitialize(UsbRequest &request); | Initializes the isochronous transfer request. | -| int32_t RequestFree(UsbRequest &request); | Frees the isochronous transfer request. | -| int32_t RequestAbort(UsbRequest &request); | Cancels the data transfer request to be processed. | -| int32_t RequestQueue(UsbRequest &request); | Sends or receives requests for isochronous transfer on a specified endpoint. The data transfer direction is determined by the endpoint direction.| -| int32_t RegBulkCallback(USBDevicePipe &pip, const USBEndpoint &endpoint, const sptr &cb); | Registers an asynchronous callback for bulk transfer. | -| int32_t UnRegBulkCallback(USBDevicePipe &pip, const USBEndpoint &endpoint); | Unregisters the asynchronous callback for bulk transfer. | -| int32_t BulkRead(USBDevicePipe &pip, const USBEndpoint &endpoint, sptr &ashmem); | Reads data asynchronously during bulk transfer. | -| int32_t BulkWrite(USBDevicePipe &pip, const USBEndpoint &endpoint, sptr &ashmem); | Writes data asynchronously during bulk transfer. | -| int32_t BulkCancel(USBDevicePipe &pip, const USBEndpoint &endpoint); | Cancels bulk transfer. The asynchronous read and write operations on the current USB interface will be cancelled. | - - **Table 2** Device-specific APIs - -| API | Description | -| -------------------------------------------------- | ------------------------------------------------------ | -| int32_t GetCurrentFunctions(int32_t &funcs); | Obtains the numeric mask combination for the current USB function list in Device mode. | -| int32_t SetCurrentFunctions(int32_t funcs); | Sets the current USB function list in Device mode. | -| int32_t UsbFunctionsFromString(std::string funcs); | Converts the string descriptor of a given USB function list to a numeric mask combination.| -| std::string UsbFunctionsToString(int32_t funcs); | Converts the numeric mask combination of a given USB function list to a string descriptor.| - - **Table 3** Port-specific APIs - -| API | Description | -| ------------------------------------------------------------ | -------------------------------------------------------- | -| int32_t GetSupportedModes(int32_t portId, int32_t &supportedModes); | Obtains the mask combination for the supported mode list of a given port. | -| int32_t SetPortRole(int32_t portId, int32_t powerRole, int32_t dataRole); | Sets the role types supported by a specified port, which can be **powerRole** (for charging) and **dataRole** (for data transfer).| -| int32_t GetPorts(std::vector &usbPorts); | Obtains the USB port descriptor list. | - -### How to Use - -The following uses bulk transfer as an example to illustrate the development procedure. - -1. Obtain a USB service instance. - - ```cpp - static OHOS::USB::UsbSrvClient &g_usbClient = OHOS::USB::UsbSrvClient::GetInstance(); - ``` - -2. Obtain the USB device list. - - ```cpp - std::vector deviceList; - int32_t ret = g_usbClient.GetDevices(deviceList); - ``` - -3. Apply for device access permissions. - - ```cpp - int32_t ret = g_usbClient.RequestRight(device.GetName()); - ``` - -4. Open a camera device. - - ```cpp - USBDevicePipe pip; - int32_t et = g_usbClient.OpenDevice(device, pip); - ``` - -5. Configure the USB interface. - - ```cpp - // interface indicates an interface of the USB device in deviceList. - ret = g_usbClient.ClaimInterface(pip, interface, true); - ``` - -6. Perform data transfer. - - ```cpp - // pipe indicates the pipe for data transfer after the USB device is opened. endpoint indicates the endpoint for data transfer on the USB device. vdata indicates the binary data block to be transferred or read. timeout indicates the timeout duration of data transfer. - srvClient.BulkTransfer(pipe, endpoint, vdata, timeout); - ``` - -7. Closes a device. - - ```cpp - ret = g_usbClient.Close(pip); - ``` - -### Sample Code - -```cpp -#include -#include -#include -#include -#include -#include -#include "if_system_ability_manager.h" -#include "ipc_skeleton.h" -#include "iremote_object.h" -#include "iservice_registry.h" -#include "iusb_srv.h" -#include "string_ex.h" -#include "system_ability_definition.h" -#include "usb_common.h" -#include "usb_device.h" -#include "usb_errors.h" -#include "usb_request.h" -#include "usb_server_proxy.h" -#include "usb_srv_client.h" - -const int32_t REQUESTYPE = ((1 << 7) | (0 << 5) | (0 & 0x1f)); -const int32_t REQUESTCMD = 6; -const int32_t VALUE = (2 << 8) + 0; -const int32_t TIMEOUT = 5000; -const int32_t ITFCLASS = 10; -const int32_t PRAMATYPE = 2; -const int32_t BUFFERLENGTH = 21; - -void GetType(OHOS::USB::USBEndpoint &tep, OHOS::USB::USBEndpoint &outEp, bool &outEpFlg) -{ - if ((tep.GetType() == PRAMATYPE)) { - if (tep.GetDirection() == 0) { - outEp = tep; - outEpFlg = true; - } - } -} - -bool SelectEndpoint(OHOS::USB::USBConfig config, - std::vector interfaces, - OHOS::USB::UsbInterface &interface, - OHOS::USB::USBEndpoint &outEp, - bool &outEpFlg) -{ - for (int32_t i = 0; i < config.GetInterfaceCount(); ++i) { - OHOS::USB::UsbInterface tif = interfaces[i]; - std::vector mEndpoints = tif.GetEndpoints(); - for (int32_t j = 0; j < tif.GetEndpointCount(); ++j) { - OHOS::USB::USBEndpoint tep = mEndpoints[j]; - if ((tif.GetClass() == ITFCLASS) && (tif.GetSubClass() == 0) && (tif.GetProtocol() == PRAMATYPE)) { - GetType(tep, outEp, outEpFlg); - } - } - if (outEpFlg) { - interface = interfaces[i]; - return true; - } - std::cout << std::endl; - } - return false; -} - -int OpenDeviceTest(OHOS::USB::UsbSrvClient &Instran, OHOS::USB::UsbDevice device, OHOS::USB::USBDevicePipe &pip) -{ - int ret = Instran.RequestRight(device.GetName()); - std::cout << "device RequestRight ret = " << ret << std::endl; - if (0 != ret) { - std::cout << "device RequestRight failed = " << ret << std::endl; - } - ret = Instran.OpenDevice(device, pip); - return ret; -} - -int CtrTransferTest(OHOS::USB::UsbSrvClient &Instran, OHOS::USB::USBDevicePipe &pip) -{ - std::cout << "usb_device_test : << Control Transfer >> " << std::endl; - std::vector vData; - const OHOS::USB::UsbCtrlTransfer tctrl = {REQUESTYPE, REQUESTCMD, VALUE, 0, TIMEOUT}; - int ret = Instran.ControlTransfer(pip, tctrl, vData); - if (ret != 0) { - std::cout << "control message read failed width ret = " << ret << std::endl; - } else { - } - std::cout << "control message read success" << std::endl; - - return ret; -} - -int ClaimTest(OHOS::USB::UsbSrvClient &Instran, - OHOS::USB::USBDevicePipe &pip, - OHOS::USB::UsbInterface &interface, - bool interfaceFlg) -{ - if (interfaceFlg) { - std::cout << "ClaimInterface InterfaceInfo:" << interface.ToString() << std::endl; - int ret = Instran.ClaimInterface(pip, interface, true); - if (ret != 0) { - std::cout << "ClaimInterface failed width ret = " << ret << std::endl; - } else { - std::cout << "ClaimInterface success" << std::endl; - } - } - return 0; -} - -int BulkTransferTest(OHOS::USB::UsbSrvClient &Instran, - OHOS::USB::USBDevicePipe &pip, - OHOS::USB::USBEndpoint &outEp, - bool interfaceFlg, - bool outEpFlg) -{ - if (interfaceFlg) { - std::cout << "usb_device_test : << Bulk transfer start >> " << std::endl; - if (outEpFlg) { - uint8_t buffer[50] = "hello world 123456789"; - std::vector vData(buffer, buffer + BUFFERLENGTH); - int ret = Instran.BulkTransfer(pip, outEp, vData, TIMEOUT); - if (ret != 0) { - std::cout << "Bulk transfer write failed width ret = " << ret << std::endl; - } else { - std::cout << "Bulk transfer write success" << std::endl; - } - return ret; - } - } - return 0; -} - -int main(int argc, char **argv) -{ - std::cout << "usb_device_test " << std::endl; - static OHOS::USB::UsbSrvClient &Instran = OHOS::USB::UsbSrvClient::GetInstance(); - // GetDevices - std::vector deviceList; - int32_t ret = Instran.GetDevices(deviceList); - if (ret != 0) { - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } - if (deviceList.empty()) { - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } - - OHOS::USB::UsbDevice device = deviceList[0]; - std::vector configs = device.GetConfigs(); - OHOS::USB::USBConfig config = configs[0]; - std::vector interfaces = config.GetInterfaces(); - OHOS::USB::UsbInterface interface; - OHOS::USB::USBEndpoint outEp; - bool interfaceFlg = false; - bool outEpFlg = false; - interfaceFlg = SelectEndpoint(config, interfaces, interface, outEp, outEpFlg); - - // OpenDevice - std::cout << "usb_device_test : << OpenDevice >> test begin -> " << std::endl; - OHOS::USB::USBDevicePipe pip; - ret = OpenDeviceTest(Instran, device, pip); - if (ret != 0) { - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } - - // ControlTransfer - CtrTransferTest(Instran, pip); - - // ClaimInterface - ClaimTest(Instran, pip, interface, interfaceFlg); - - // BulkTransferWrite - BulkTransferTest(Instran, pip, outEp, interfaceFlg, outEpFlg); - - // CloseDevice - std::cout << "usb_device_test : << Close Device >> " << std::endl; - ret = Instran.Close(pip); - if (ret == 0) { - std::cout << "Close device failed width ret = " << ret << std::endl; - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } else { - std::cout << "Close Device success" << std::endl; - } - return 0; -} -``` - -### Repositories Involved - -[Driver subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/driver.md) - -[drivers\_peripheral](https://gitee.com/openharmony/drivers_peripheral/blob/master/README_zh.md) - -[drivers\_framework](https://gitee.com/openharmony/drivers_framework/blob/master/README_zh.md) - -[drivers\_adapter](https://gitee.com/openharmony/drivers_adapter/blob/master/README_zh.md) - -[drivers\_adapter\_khdf\_linux](https://gitee.com/openharmony/drivers_adapter_khdf_linux/blob/master/README_zh.md) diff --git a/en/readme/xts.md b/en/readme/xts.md index 042f4e197ce6d59cfda94e0cd7c72d22fc0ecc79..c317bc53e5f7335fe3d2f2911812db99bc8aad7d 100644 --- a/en/readme/xts.md +++ b/en/readme/xts.md @@ -195,9 +195,9 @@ The HCTest framework is used to support test cases developed with the C language Test suites are built along with version build. The ACTS is built together with the debug version. - >![](public_sys-resources/icon-note.gif) **NOTE** - > - >The ACTS build middleware is a static library, which will be linked to the image. + > **NOTE** + > + > The ACTS build middleware is a static library, which will be linked to the image. ### C-based Test Case Execution \(for the Mini System\) @@ -334,9 +334,9 @@ The HCPPTest framework is enhanced and adapted based on the open-source framewor Test suites are built along with the version build. The ACTS is built together with the debug version. - >![](public_sys-resources/icon-note.gif) **NOTE** - > - >The ACTS for the small system is independently built to an executable file \(.bin\) and archived in the **suites\\acts** directory of the build result. + > **NOTE** + > + > The ACTS for the small system is independently built to an executable file \(.bin\) and archived in the **suites\\acts** directory of the build result. ### C++-based Test Case Execution \(for Standard and Small Systems\) diff --git a/zh-cn/application-dev/ability-deprecated/stage-ability.md b/zh-cn/application-dev/ability-deprecated/stage-ability.md index 6c01bfd65ab80f3928f36dca6d9462d373528872..caea71e25fe63b7e1ad19b1a18b05473f3792dcf 100644 --- a/zh-cn/application-dev/ability-deprecated/stage-ability.md +++ b/zh-cn/application-dev/ability-deprecated/stage-ability.md @@ -39,7 +39,7 @@ AbilityStage功能如下(AbilityStage类,拥有context属性,具体的API |onAcceptWant(want: Want): string|启动指定Ability时被调用。| |onConfigurationUpdated(config: Configuration): void|全局配置发生变更时被调用。| -Ability功能如下(Ability类,具体的API详见[接口文档](../reference/apis/js-apis-application-ability.md)): +Ability功能如下(Ability类,具体的API详见[接口文档](../reference/apis/js-apis-app-ability-uiAbility.md)): **表2** Ability API接口功能介绍 @@ -190,7 +190,7 @@ export default class EntryAbility extends UIAbility { ``` ## 启动Ability ### 接口说明 -Ability类拥有context属性,context属性为AbilityContext类,AbilityContext类拥有abilityInfo、currentHapModuleInfo等属性,启动Ability等方法。具体的API详见[接口文档](../reference/apis/js-apis-ability-context.md)。 +Ability类拥有context属性,context属性为AbilityContext类,AbilityContext类拥有abilityInfo、currentHapModuleInfo等属性,启动Ability等方法。具体的API详见[接口文档](../reference/apis/js-apis-inner-application-uiAbilityContext.md)。 **表3** AbilityContext API接口功能介绍 |接口名|描述| @@ -207,7 +207,7 @@ Ability类拥有context属性,context属性为AbilityContext类,AbilityConte 应用可以通过`this.context`获取Ability实例的上下文,进而使用AbilityContext中的StartAbility相关接口启动Ability。启动Ability可指定Want、StartOptions、accountId,通过callback形式或promise形式实现。具体示例代码如下: ```ts let context = this.context -var want = { +let want = { "deviceId": "", "bundleName": "com.example.MyApplication", "abilityName": "EntryAbility" @@ -224,7 +224,7 @@ context.startAbility(want).then(() => { 跨设备场景下,需指定对端设备deviceId,具体示例代码如下: ```ts let context = this.context -var want = { +let want = { "deviceId": getRemoteDeviceId(), "bundleName": "com.example.MyApplication", "abilityName": "EntryAbility" @@ -239,9 +239,9 @@ context.startAbility(want).then(() => { ```ts import deviceManager from '@ohos.distributedHardware.deviceManager'; function getRemoteDeviceId() { - if (typeof dmClass === 'object' && dmClass != null) { - var list = dmClass.getTrustedDeviceListSync(); - if (typeof (list) == 'undefined' || typeof (list.length) == 'undefined') { + if (typeof dmClass === 'object' && dmClass !== null) { + let list = dmClass.getTrustedDeviceListSync(); + if (typeof (list) === 'undefined' || typeof (list.length) === 'undefined') { console.log("EntryAbility onButtonClick getRemoteDeviceId err: list is null"); return; } diff --git a/zh-cn/application-dev/application-dev-guide.md b/zh-cn/application-dev/application-dev-guide.md index 4febc5121809eda48ffcb612229db596840f0907..000525a35348eed5f6dc4f6d08862f2186569555 100644 --- a/zh-cn/application-dev/application-dev-guide.md +++ b/zh-cn/application-dev/application-dev-guide.md @@ -4,7 +4,7 @@ 在应用开发的文档中,您可以获取到如下几方面的内容: -### 入门 +## 入门 [入门](quick-start/start-overview.md)可以帮助开发者了解应用开发的基本方法。 @@ -12,7 +12,7 @@ 开发的基础知识包含了OpenHarmony应用程序的包结构配置文件说明,以及资源文件的使用指导。 -### 开发 +## 开发 为了帮助开发者更好的理解OpenHarmony提供的能力,我们对重点功能提供了开发指导,辅助开发者完成应用的开发。 @@ -32,39 +32,38 @@ - [网络与连接](connectivity/ipc-rpc-overview.md) - [电话服务](telephony/telephony-overview.md) - [数据管理](database/database-mdds-overview.md) +- [文件管理](file-management/medialibrary-overview.md) - [任务管理](task-management/background-task-overview.md) - [设备管理](device/usb-overview.md) - [设备使用信息统计](device-usage-statistics/device-usage-statistics-overview.md) - [DFX](dfx/hiappevent-guidelines.md) - [国际化](internationalization/international-overview.md) - [应用测试](application-test/arkxtest-guidelines.md) +- [一次开发,多端部署](key-features/multi-device-app-dev/foreword.md) - [IDL工具规格及使用说明书](IDL/idl-guidelines.md) - [Native API的相关指导](napi/napi-guidelines.md) -- [文件管理](file-management/medialibrary-overview.md) -- [一次开发,多端部署](key-features/multi-device-app-dev/foreword.md) - -### 工具 +## 工具 DevEco Studio工具是OpenHarmony应用开发的推荐IDE工具。 在[工具](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-deveco-studio-overview-0000001263280421)部分,讲解了DevEco Studio工具的详细用法,包括使用该工具进行工程创建、应用签名、应用调试、应用安装运行的指导。 -### 示例教程 +## 示例教程 我们提供了[Sample工程](https://gitee.com/openharmony/applications_app_samples/blob/master/README_zh.md)和[Codelab](https://gitee.com/openharmony/codelabs/blob/master/README.md)这两种形式的示例教程,为开发者提供更丰富的开发参考,辅助开发者理解功能逻辑,提升开发效率。 -### API参考 +## API参考 API参考提供了OpenHarmony全量组件和接口的参考文档,可以帮助开发者快速查找到指定接口的详细描述和调用方法。 内容包括: -- [组件参考(基于TS扩展的声明式开发范式)](reference/arkui-ts/Readme-CN.md) -- [组件参考(兼容JS的类Web开发范式-ArkUI.Full)](reference/arkui-js/Readme-CN.md) -- [组件参考(兼容JS的类Web开发范式-ArkUI.Lite)](reference/arkui-js-lite/Readme-CN.md) -- [JS服务卡片UI组件参考](reference/js-service-widget-ui/Readme-CN.md) -- [接口参考(JS及TS API)](reference/apis/js-apis-ability-dataUriUtils.md) +- [组件参考(基于TS扩展的声明式开发范式)](reference/arkui-ts/ts-components-summary.md) +- [组件参考(兼容JS的类Web开发范式-ArkUI.Full)](reference/arkui-js/js-components-common-attributes.md) +- [组件参考(兼容JS的类Web开发范式-ArkUI.Lite)](reference/arkui-js-lite/js-framework-file.md) +- [JS服务卡片UI组件参考](reference/js-service-widget-ui/js-service-widget-file.md) +- [接口参考(ArkTS及JS API)](reference/apis/development-intro.md) - 接口参考(Native API) - - [OpenHarmony Native API](reference/native-apis/_o_h___native_x_component.md) - - [Native API标准库](reference/native-lib/third_party_libc/musl.md) - - [Node_API](reference/native-lib/third_party_napi/napi.md) + - [OpenHarmony Native API](reference/native-apis/_o_h___native_x_component.md) + - [Native API标准库](reference/native-lib/third_party_libc/musl.md) + - [Node_API](reference/native-lib/third_party_napi/napi.md) diff --git a/zh-cn/application-dev/application-models/create-pageability.md b/zh-cn/application-dev/application-models/create-pageability.md index 75ab7e6cac005796a2156e48db577400b2e61ed6..c653379c1c938e6fd595f3acd4f66b5061be577b 100644 --- a/zh-cn/application-dev/application-models/create-pageability.md +++ b/zh-cn/application-dev/application-models/create-pageability.md @@ -76,22 +76,22 @@ FA模型中,可以通过featureAbility的getContext接口获取应用上下文 通过getContext获取应用上下文并获取分布式目录的示例如下: ```ts -import featureAbility from '@ohos.ability.featureAbility' -import fileIo from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility'; +import fs from '@ohos.file.fs'; (async () => { - let dir: string + let dir: string; try { - console.info('Begin to getOrCreateDistributedDir') - dir = await featureAbility.getContext().getOrCreateDistributedDir() + console.info('Begin to getOrCreateDistributedDir'); + dir = await featureAbility.getContext().getOrCreateDistributedDir(); console.info('distribute dir is ' + dir) } catch (error) { - console.error('getOrCreateDistributedDir failed with ' + error) + console.error('getOrCreateDistributedDir failed with ' + error); } let fd: number; let path = dir + "/a.txt"; - fd = fileIo.openSync(path, 0o2 | 0o100, 0o666); - fileIo.close(fd); + fd = fs.openSync(path, fs.OpenMode.READ_WRITE).fd; + fs.close(fd); })() ``` diff --git a/zh-cn/application-dev/application-models/enterprise-extensionAbility.md b/zh-cn/application-dev/application-models/enterprise-extensionAbility.md index 158b3eb4801466805d8261919edc479a96f3b7b1..44a6d72a90593c6a04a34f94f9b714c20aa2cbbf 100644 --- a/zh-cn/application-dev/application-models/enterprise-extensionAbility.md +++ b/zh-cn/application-dev/application-models/enterprise-extensionAbility.md @@ -17,17 +17,17 @@ onAdminEnabled:由企业管理员或者员工部署MDM应用,激活设备管 onAdminDisabled:由系统或者员工去激活设备管理器,通知去激活DeviceAdmin权限,应用可以通知企业管理员设备已脱管。 -onBundleAdded: 企业应用管理场景下,企业管理员订阅应用安装卸载事件,端侧应用安装和卸载事件通知MDM应用,MDM应用可以在回调函数中进行事件上报,通知企业管理员。 +onBundleAdded: 企业应用管理场景下,企业管理员订阅应用安装事件,端侧应用安装和卸载事件通知MDM应用,MDM应用可以在回调函数中进行事件上报,通知企业管理员。 -onBundleRemoved: 企业应用管理场景下,企业管理员取消订阅应用安装卸载事件。 +onBundleRemoved: 企业应用管理场景下,企业管理员订阅应用卸载事件,端侧应用安装和卸载事件通知MDM应用,MDM应用可以在回调函数中进行事件上报,通知企业管理员。 ### 接口说明 | 类名 | 接口名称 | 描述 | | :------------------------------ | ----------------------------------------- | ---------------------------- | +| EnterpriseAdminExtensionAbility | onAdminEnabled(): void | 设备管理器应用激活回调方法 | | EnterpriseAdminExtensionAbility | onAdminDisabled(): void | 设备管理器应用去激活回调方法 | | EnterpriseAdminExtensionAbility | onBundleAdded(bundleName: string): void | 应用安装回调方法 | -| EnterpriseAdminExtensionAbility | onAdminEnabled(): void | 设备管理器应用激活回调方法 | | EnterpriseAdminExtensionAbility | onBundleRemoved(bundleName: string): void | 应用卸载回调方法 | ### 开发步骤 @@ -76,10 +76,9 @@ export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbil ## 使用示例 -通过@ohos.enterprise.adminManager模块中的subscribeManagedEvent接口和unsubscribeManagedEvent接口进行企业设备管理事件的订阅,订阅应用安装、卸载事件。当订阅成功后,端侧应用安装和卸载事件通知MDM应用,MDM应用可以在回调函数中进行事件上报,通知企业管理员。 +通过@ohos.enterprise.adminManager模块中的subscribeManagedEvent接口进行企业设备管理事件的订阅,订阅应用安装、卸载事件。当订阅成功后,端侧应用安装和卸载事件通知MDM应用,MDM应用可以在回调函数中进行事件上报,通知企业管理员。并可以通过unsubscribeManagedEvent接口进行企业设备管理事件的去订阅。 ```ts - @State managedEvents: Array = [0,1] @State subscribeManagedEventMsg: string = "" @State unsubscribeManagedEventMsg: string = "" diff --git a/zh-cn/application-dev/napi/drawing-guidelines.md b/zh-cn/application-dev/napi/drawing-guidelines.md index b746e15978646c5c9efed2cc24fc7ac1fac55768..4de946c8a781f1e3f5b16cc929b7cce5bd585ce9 100644 --- a/zh-cn/application-dev/napi/drawing-guidelines.md +++ b/zh-cn/application-dev/napi/drawing-guidelines.md @@ -189,7 +189,7 @@ Native Drawing模块提供了一系列的接口用于基本图形和字体的绘 OH_Drawing_CreateFontCollection()); OH_Drawing_TypographyHandlerPushTextStyle(handler, txtStyle); // 设置文字内容 - const char* text = "OpenHarmony\n"; + const char* text = "Hello World\n"; OH_Drawing_TypographyHandlerAddText(handler, text); OH_Drawing_TypographyHandlerPopTextStyle(handler); OH_Drawing_Typography* typography = OH_Drawing_CreateTypography(handler); diff --git a/zh-cn/application-dev/quick-start/application-package-structure-fa.md b/zh-cn/application-dev/quick-start/application-package-structure-fa.md index 3e75f3b114fc2865f54ebbcc70bd0f6e9d39ced6..a8fb2e327d19ad114f265994a07716ceb1d6ad72 100644 --- a/zh-cn/application-dev/quick-start/application-package-structure-fa.md +++ b/zh-cn/application-dev/quick-start/application-package-structure-fa.md @@ -11,7 +11,7 @@ FA模型与Stage模型不同之处在于HAP内部文件存放位置不同,FA - assets是HAP所有的资源文件、库文件和代码文件的集合,内部可以分为entry和js文件夹。entry文件夹中存放的是resources目录和resources.index文件。 -- resources目录用于存放应用的资源文件(字符串、图片等),便于开发者使用和维护,详见[资源文件的使用](../key-features/multi-device-app-dev/resource-usage.md)。 +- resources目录用于存放应用的资源文件(字符串、图片等),便于开发者使用和维护,详见[资源文件的使用](resource-categories-and-access.md)。 - resources.index是资源索引表,由IDE调用SDK工具生成。 diff --git a/zh-cn/application-dev/quick-start/application-package-structure-stage.md b/zh-cn/application-dev/quick-start/application-package-structure-stage.md index 41c5bc2431533a746a6367d2a90fa64809036ded..485f83c1a731e7b0697a1d2e1fe6358492eb2f02 100644 --- a/zh-cn/application-dev/quick-start/application-package-structure-stage.md +++ b/zh-cn/application-dev/quick-start/application-package-structure-stage.md @@ -21,7 +21,7 @@ - 打包后的HAP结构包括ets、libs、resources等文件夹和resources.index、module.json、pack.info等文件。 - ets目录用于存放应用代码编译后的字节码文件。 - libs目录用于存放库文件。库文件是OpenHarmony应用依赖的第三方代码(.so二进制文件)。 - - resources目录用于存放应用的资源文件(字符串、图片等),便于开发者使用和维护,详见[资源文件的使用](../key-features/multi-device-app-dev/resource-usage.md)。 + - resources目录用于存放应用的资源文件(字符串、图片等),便于开发者使用和维护,详见[资源文件的使用](resource-categories-and-access.md)。 - resources.index是资源索引表,由IDE编译工程时生成。 - module.json是HAP的配置文件,内容由工程配置中的module.json5和app.json5组成,该文件是HAP中必不可少的文件。IDE会自动生成一部分默认配置,开发者按需修改其中的配置。详细字段请参见[应用配置文件](application-configuration-file-overview-stage.md)。 - pack.info是Bundle中用于描述每个HAP属性的文件,例如app中的bundleName和versionCode信息、module中的name、type和abilities等信息,由IDE工具生成Bundle包时自动生成。 diff --git a/zh-cn/application-dev/quick-start/full-sdk-compile-guide.md b/zh-cn/application-dev/quick-start/full-sdk-compile-guide.md index 4d53d2d7be083d5d8d15cb7168de4f9bfdde242b..fde6de851ef350257cde9f26cdc12b0ca2b524a7 100644 --- a/zh-cn/application-dev/quick-start/full-sdk-compile-guide.md +++ b/zh-cn/application-dev/quick-start/full-sdk-compile-guide.md @@ -26,5 +26,5 @@ ## 替换SDK -full-SDK编译完成后需要在DevEcoStudio替换使用,具体请参考[full-SDK替换指南](../../application-dev/quick-start/full-sdk-switch-guide.md)。 +full-SDK编译完成后需要在DevEcoStudio替换使用,具体请参考[full-SDK替换指南](full-sdk-switch-guide.md)。 diff --git a/zh-cn/application-dev/reference/apis/commonEventManager-definitions.md b/zh-cn/application-dev/reference/apis/commonEventManager-definitions.md index d9f8a8082bf067155c478f5a2589607d85d3f0cf..0cdb577fbcb8129ea13191797dd2b394450bd093 100644 --- a/zh-cn/application-dev/reference/apis/commonEventManager-definitions.md +++ b/zh-cn/application-dev/reference/apis/commonEventManager-definitions.md @@ -793,6 +793,105 @@ Wi-Fi P2P群组信息已更改。 - 值:usual.event.HTTP_PROXY_CHANGE - 订阅者所需权限:无 +## COMMON_EVENT_SIM_STATE_CHANGED10+ +提示SIM卡状态更新。 +- 值:usual.event.SIM_STATE_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_SMS_RECEIVED_COMPLETED10+ +提示短信接收完成。 +- 值:usual.event.SMS_RECEIVED_COMPLETED +- 订阅者所需权限:ohos.permission.RECEIVE_SMS + +## COMMON_EVENT_SMS_EMERGENCY_CB_RECEIVE_COMPLETED10+ +提示紧急小区广播短信接收完成。 +- 值:usual.event.SMS_EMERGENCY_CB_RECEIVE_COMPLETED +- 订阅者所需权限:ohos.permission.RECEIVE_SMS + +## COMMON_EVENT_SMS_CB_RECEIVE_COMPLETED10+ +提示小区广播短信接收完成。 +- 值:usual.event.SMS_CB_RECEIVE_COMPLETED +- 订阅者所需权限:ohos.permission.RECEIVE_SMS + +## COMMON_EVENT_STK_COMMAND10+ +(预留事件,暂未支持)提示STK命令。 +- 值:usual.event.STK_COMMAND +- 订阅者所需权限:无 + +## COMMON_EVENT_STK_SESSION_END10+ +(预留事件,暂未支持)提示STK会话结束。 +- 值:usual.event.STK_SESSION_END +- 订阅者所需权限:无 + +## COMMON_EVENT_STK_CARD_STATE_CHANGED10+ +(预留事件,暂未支持)提示STK卡状态已更新。 +- 值:usual.event.STK_CARD_STATE_CHANGED +- 订阅者所需权限:ohos.permission. + +## COMMON_EVENT_STK_ALPHA_IDENTIFIER10+ +(预留事件,暂未支持)提示STK ALPHA标识符。 +- 值:usual.event.STK_ALPHA_IDENTIFIER +- 订阅者所需权限:无 + +## COMMON_EVENT_SMS_WAPPUSH_RECEIVE_COMPLETED10+ +提示服务信息短信接收完成。 +- 值:usual.event.SMS_WAPPUSH_RECEIVE_COMPLETED +- 订阅者所需权限:ohos.permission.RECEIVE_SMS + +## COMMON_EVENT_OPERATOR_CONFIG_CHANGED10+ +提示运营商配置已更新。 +- 值:usual.event.OPERATOR_CONFIG_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_SIM_CARD_DEFAULT_SMS_SUBSCRIPTION_CHANGED10+ +提示SIM卡默认短信主卡已更新。 +- 值:usual.event.DEFAULT_SMS_SUBSCRIPTION_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_SIM_CARD_DEFAULT_DATA_SUBSCRIPTION_CHANGED10+ +提示SIM卡默认数据主卡已更新。 +- 值:usual.event.DEFAULT_DATA_SUBSCRIPTION_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_SIM_CARD_DEFAULT_MAIN_SUBSCRIPTION_CHANGED10+ +提示SIM卡默认主卡已更新。 +- 值:usual.event.SIM.DEFAULT_MAIN_SUBSCRIPTION_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_SIM_CARD_DEFAULT_VOICE_SUBSCRIPTION_CHANGED10+ +提示SIM卡默认语音主卡已更新。 +- 值:usual.event.DEFAULT_VOICE_SUBSCRIPTION_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_CALL_STATE_CHANGED10+ +提示呼叫状态更新。 +- 值:usual.event.CALL_STATE_CHANGED +- 订阅者所需权限:ohos.permission.GET_TELEPHONY_STATE + +## COMMON_EVENT_CELLULAR_DATA_STATE_CHANGED10+ +提示蜂窝数据状态更新。 +- 值:usual.event.CELLULAR_DATA_STATE_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_NETWORK_STATE_CHANGED10+ +提示网络状态更新。 +- 值:usual.event.NETWORK_STATE_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_SIGNAL_INFO_CHANGED10+ +提示信号信息更新。 +- 值:usual.event.SIGNAL_INFO_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_INCOMING_CALL_MISSED10+ +提示未接来电。 +- 值:usual.event.INCOMING_CALL_MISSED +- 订阅者所需权限:ohos.permission.GET_TELEPHONY_STATE + +## COMMON_EVENT_RADIO_STATE_CHANGE10+ +提示设备modem上下电状态变化。 +- 值:usual.event.RADIO_STATE_CHANGE + ## COMMON_EVENT_SCREEN_LOCKED 10+ 表示屏幕锁定的公共事件。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle-BundleStatusCallback.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle-BundleStatusCallback.md index e67d24ae07803dcc71bfdf9b2ca9ded609919e5e..4150970237ce4ddf5ec4fc119513fb386d8ba26b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle-BundleStatusCallback.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle-BundleStatusCallback.md @@ -10,7 +10,7 @@ ## BundleStatusCallback(deprecated) > 从API version 9开始不再支持。建议使用[bundleMonitor](js-apis-bundleMonitor.md)替代。 -**系统API:** 此接口为系统接口,三方应用不支持调用。 +**系统API:** 此接口为系统接口。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md index fb7cd3047e666fe09808f55857eb8e857811d8b1..841a7c9b0b786740baccc129749972f9cee567bc 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md @@ -34,7 +34,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -62,7 +62,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -94,7 +94,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -121,7 +121,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -153,7 +153,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -179,7 +179,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -210,7 +210,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -236,7 +236,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -267,7 +267,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -293,7 +293,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md index 49db882be3b123b00dbb25f8a4ee70d406d10eac..76c621f40eeb31b7c60055e90e6035f59ce5292a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md @@ -42,7 +42,7 @@ SystemCapability.BundleManager.DistributedBundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -71,7 +71,7 @@ SystemCapability.BundleManager.DistributedBundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -103,7 +103,7 @@ SystemCapability.BundleManager.DistributedBundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -132,7 +132,7 @@ SystemCapability.BundleManager.DistributedBundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md index 997bf8437e729f08a341ec41029e61c0e06899d3..8d2a5e8afc6db4b729e64972cede9cb5862736c2 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md @@ -426,7 +426,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **返回值:** @@ -462,7 +462,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -499,7 +499,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -540,7 +540,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -584,7 +584,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -626,7 +626,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -671,7 +671,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -699,7 +699,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -754,7 +754,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -794,7 +794,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md index 8658417d06f5e70a9f87a3ae9555a6fa82a628fa..94ac177abec2771b0bda6c3f0413b97bea8f8ec8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md @@ -158,6 +158,12 @@ saveAppState(context?: UIAbilityContext): boolean; **系统能力**:SystemCapability.Ability.AbilityRuntime.Core +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| context | [UIAbilityContext](js-apis-inner-application-uiAbilityContext.md)| 否 | UIAbility上下文环境。 | + **返回值:** | 类型 | 说明 | @@ -182,6 +188,12 @@ setRestartWant(want: Want): void; **系统能力**:SystemCapability.Ability.AbilityRuntime.Core +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-want.md)| 是 | 通过设置Want中"bundleName"和"abilityName"字段来指定恢复重启的Ability。 | + **示例:** ```ts diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md index bc17ac5a0e514bfc1526eb5771399029faae9a24..8e521d379da256f91114d62f06a822f01903758c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md @@ -148,7 +148,7 @@ Extension生命周期回调,如果是connectAbility拉起的服务,会在onC ## ServiceExtensionAbility.onDisconnect -onDisconnect(want: Want): void | Promise; +onDisconnect(want: Want): void | Promise\; Extension的生命周期回调,客户端执行断开连接服务时回调。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md index 1c5085195ca7703e0e9cdd76bc30b8dbe47f4423..6b938dfa1c2dfa3ff782f61f09f1763280a3fc71 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md @@ -130,11 +130,11 @@ import Want from '@ohos.app.ability.Want'; ``` * 文件描述符(FD) ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; let fd; try { - fd = fileio.openSync('/data/storage/el2/base/haps/pic.png'); + fd = fs.openSync('/data/storage/el2/base/haps/pic.png').fd; } catch(e) { console.error('openSync fail: ${JSON.stringify(e)}'); } diff --git a/zh-cn/application-dev/reference/apis/js-apis-appControl.md b/zh-cn/application-dev/reference/apis/js-apis-appControl.md index b9747a0dc7acfb4eaab24f6bd575de660208f660..03286aaa8a0cabe11779d0755aefe5802dbf2eb3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-appControl.md +++ b/zh-cn/application-dev/reference/apis/js-apis-appControl.md @@ -24,7 +24,7 @@ setDisposedStatus(appId: string, disposedWant: Want): Promise\ **系统能力:** SystemCapability.BundleManager.BundleFramework.AppControl -**系统API:** 此接口为系统接口,三方应用不支持调用。 +**系统API:** 此接口为系统接口。。 **参数:** @@ -75,7 +75,7 @@ setDisposedStatus(appId: string, disposedWant: Want, callback: AsyncCallback\; **系统能力:** SystemCapability.BundleManager.BundleFramework.AppControl -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -171,7 +171,7 @@ getDisposedStatus(appId: string, callback: AsyncCallback\): void; **系统能力:** SystemCapability.BundleManager.BundleFramework.AppControl -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -216,7 +216,7 @@ deleteDisposedStatus(appId: string): Promise\ **系统能力:** SystemCapability.BundleManager.BundleFramework.AppControl -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -265,7 +265,7 @@ deleteDisposedStatus(appId: string, callback: AsyncCallback\) : void **系统能力:** SystemCapability.BundleManager.BundleFramework.AppControl -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-want.md b/zh-cn/application-dev/reference/apis/js-apis-application-want.md index f7d00402995f666cd8eb47062b2c61b789fdc285..f028724c676fb7437c902c9ef45a7a795525bde2 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 @@ -108,10 +108,10 @@ import Want from '@ohos.application.Want'; ``` * 文件描述符(FD) ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; let fd; try { - fd = fileio.openSync('/data/storage/el2/base/haps/pic.png'); + fd = fs.openSync('/data/storage/el2/base/haps/pic.png').fd; } catch(e) { console.error('openSync fail: ${JSON.stringify(e)}'); } diff --git a/zh-cn/application-dev/reference/apis/js-apis-audio.md b/zh-cn/application-dev/reference/apis/js-apis-audio.md index fb8bd192c4a74bdf591651bab3c977acc3ee7de7..bfc30141778b66e77e3fa527d418373c6246b960 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-audio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-audio.md @@ -689,21 +689,19 @@ async function createTonePlayerBefore(){ | forceType | [InterruptForceType](#interruptforcetype9) | 是 | 操作是由系统执行或是由应用程序执行。 | | hintType | [InterruptHint](#interrupthint) | 是 | 中断提示。 | -## VolumeEvent8+ +## VolumeEvent9+ 音量改变时,应用接收的事件。 -**系统接口:** 该接口为系统接口 - **系统能力:** SystemCapability.Multimedia.Audio.Volume | 名称 | 类型 | 必填 | 说明 | | ---------- | ----------------------------------- | ---- | -------------------------------------------------------- | -| volumeType | [AudioVolumeType](#audiovolumetype) | 是 | 音量流类型。 | -| volume | number | 是 | 音量等级,可设置范围通过getMinVolume和getMaxVolume获取。 | -| updateUi | boolean | 是 | 在UI中显示音量变化。 | -| volumeGroupId9+ | number | 是 | 音量组id。可用于getGroupManager入参 | -| networkId9+ | string | 是 | 网络id。 | +| volumeType | [AudioVolumeType](#audiovolumetype) | 是 | 音量流类型。 | +| volume | number | 是 | 音量等级,可设置范围通过getMinVolume和getMaxVolume获取。 | +| updateUi | boolean | 是 | 在UI中显示音量变化。 | +| volumeGroupId | number | 是 | 音量组id。可用于getGroupManager入参。
此接口为系统接口。 | +| networkId | string | 是 | 网络id。
此接口为系统接口。 | ## MicStateChangeEvent9+ @@ -1975,12 +1973,12 @@ audioManager.isMicrophoneMute().then((value) => { }); ``` -### on('volumeChange')(deprecated) +### on('volumeChange')9+ on(type: 'volumeChange', callback: Callback\): void > **说明:** -> 从 API version 8 开始支持,从 API version 9 开始废弃,建议使用AudioVolumeManager中的[on('volumeChange')](#onvolumechange9)替代。 +> 建议使用AudioVolumeManager中的[on('volumeChange')](#onvolumechange9)替代。 监听系统音量变化事件。 @@ -1995,7 +1993,7 @@ on(type: 'volumeChange', callback: Callback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | | type | string | 是 | 事件回调类型,支持的事件为:'volumeChange'(系统音量变化事件,检测到系统音量改变时,触发该事件)。 | -| callback | Callback<[VolumeEvent](#volumeevent8)> | 是 | 回调方法。 | +| callback | Callback<[VolumeEvent](#volumeevent9)> | 是 | 回调方法。 | **示例:** @@ -2304,7 +2302,7 @@ on(type: 'volumeChange', callback: Callback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | | type | string | 是 | 事件回调类型,支持的事件为:'volumeChange'。 | -| callback | Callback<[VolumeEvent](#volumeevent8)> | 是 | 回调方法。 | +| callback | Callback<[VolumeEvent](#volumeevent9)> | 是 | 回调方法。 | **错误码:** @@ -4037,6 +4035,7 @@ audioRoutingManager.off('preferOutputDeviceChangeForRendererInfo', () => { | clientUid | number | 是 | 否 | 音频渲染器客户端应用程序的Uid。
此接口为系统接口。 | | rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | 是 | 否 | 音频渲染器信息。 | | rendererState | [AudioState](#audiostate) | 是 | 否 | 音频状态。
此接口为系统接口。| +| deviceDescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | 是 | 否 | 音频设备描述。| **示例:** @@ -4095,6 +4094,7 @@ audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => | clientUid | number | 是 | 否 | 音频采集器客户端应用程序的Uid。
此接口为系统接口。 | | capturerInfo | [AudioCapturerInfo](#audiocapturerinfo8) | 是 | 否 | 音频采集器信息。 | | capturerState | [AudioState](#audiostate) | 是 | 否 | 音频状态。
此接口为系统接口。| +| deviceDescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | 是 | 否 | 音频设备描述。| **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md index a81e2dba60db16e30001d53b8124430df6f24beb..2e8a6df4f99515c552f3cd0ac6de5a5bd7f2a535 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md @@ -21,7 +21,7 @@ ohos.permission.INSTALL_BUNDLE SystemCapability.BundleManager.BundleFramework -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -71,7 +71,7 @@ ohos.permission.INSTALL_BUNDLE SystemCapability.BundleManager.BundleFramework -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -120,7 +120,7 @@ ohos.permission.INSTALL_BUNDLE SystemCapability.BundleManager.BundleFramework -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -161,7 +161,7 @@ bundle.getBundleInstaller().then(installer => { **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework - **系统API:** 此接口为系统接口,三方应用不支持调用 + **系统API:** 此接口为系统接口。 | 名称 | 类型 | 可读 | 可写 | 说明 | | ----------- | ------- | ---- | ---- | ------------------ | @@ -175,7 +175,7 @@ bundle.getBundleInstaller().then(installer => { **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework - **系统API:** 此接口为系统接口,三方应用不支持调用 + **系统API:** 此接口为系统接口。 | 名称 | 类型 | 可读 | 可写 | 说明 | | ------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------ | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md index c3be16604ba856d95ce87039cb2061e824937218..e0e5c8fb43aec4ef92d5bfcc11e74c08acbd1842 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md @@ -11,7 +11,7 @@ LauncherAbilityInfo信息,通过接口[innerBundleManager.getLauncherAbilityIn **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework。 - **系统API:** 此接口为系统接口,三方应用不支持调用。 + **系统API:** 此接口为系统接口。 | 名称 | 类型 | 可读 | 可写 | 说明 | | --------------- | ---------------------------------------------------- | ---- | ---- | -------------------------------------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-PermissionDef.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-PermissionDef.md index cea742c810f683eb9d204efc6ca7f5dc2cfc5220..da0d229c697483b4e7aa92e07f06dbe6f4766c97 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-PermissionDef.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-PermissionDef.md @@ -11,7 +11,7 @@ **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework - **系统API:** 此接口为系统接口,三方应用不支持调用 + **系统API:** 此接口为系统接口。 | 名称 | 类型 | 可读 | 可写 | 说明 | | -------------- | ------ | ---- | ---- | -------------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md index 62cf35767b4493b382c281b2c72989448bb8fa0d..5c64ff98ca497b2eb7fd4a5d4c031e1d49b09dff 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md @@ -14,7 +14,7 @@ remoteAbility信息。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.DistributedBundleFramework - **系统API:** 此接口为系统接口,三方应用不支持调用 + **系统API:** 此接口为系统接口。 | 名称 | 类型 | 可读 | 可写 | 说明 | | ----------- | -------------------------------------------- | ---- | ---- | ----------------------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md index ef3853d7c5c52ba7cf2f018cdae5482690ce6f8d..7de51a3267318e9b7d20dc45bb1b5e2f1150b30e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md @@ -1,5 +1,5 @@ # BundlePackInfo - +此接口为系统 > **说明:** > 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 @@ -122,7 +122,7 @@ ## ApiVersion -**系统接口:** 系统接口,三方应用不支持调用。 +**系统接口:** 此接口为系统接口。 **系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-businessAbilityInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-businessAbilityInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..deeea708b336bd3a01788a178a6353ff29bbeac8 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-businessAbilityInfo.md @@ -0,0 +1,21 @@ +# BusinessAbilityInfo + +> **说明:** +> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +包含基本业务路由信息。 + +## BusinessAbilityInfo + +**系统能力**: SystemCapability.BundleManager.BundleFramework.Core + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------------------------------- | ------------------------------------------------------------ | ---- | ---- | -------------------- | +| bundleName | string | 是 | 否 | 表示应用程序的bundleName。 | +| moduleName | string | 是 | 否 | 表示应用程序的moduleName。 | +| name | string | 是 | 否 | 业务路由ability名。 | +| labelId | number | 是 | 否 | 模块标签的资源id。 | +| descriptionId | number | 是 | 否 | 描述信息的资源id。 | +| iconId | number | 是 | 否 | 描述ability信息的图标id。 | +| businessType | [businessAbilityRouter.BusinessType](js-apis-businessAbilityRouter.md#businesstype) | 是 | 否 | 标识枚举业务类型。 | +| applicationInfo | Array\<[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)> | 是 | 否 | 应用程序的信息。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-launcherAbilityInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-launcherAbilityInfo.md index c565e6555c96502f9bfa35e756c80d41127cb03c..6dfe1b84be68dcdda34f3eb03cf204f513faf9a3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-launcherAbilityInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-launcherAbilityInfo.md @@ -8,7 +8,7 @@ **系统能力:** SystemCapability.BundleManager.BundleFramework.Launcher。 - **系统:** 系统接口,三方应用不支持调用。 + **系统:** 此接口为系统接口。 | 名称 | 类型 | 可读 | 可写 | 说明 | | --------------- | ----------------------------------------------------------- | ---- | ---- | ------------------------------------ | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md index 81792364b3b24c0fe0dfe978025b425c4721cb89..02e5bdb3b7f7e261cb411f9dec3ad2a9c24e8226 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md @@ -48,7 +48,7 @@ import bundleManager from '@ohos.bundle.bundleManager'; **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 - **系统接口:** 系统接口,不支持三方应用调用。 + **系统接口:** 此接口为系统接口。 | 名称 | 值 | 说明 | | ------------------------------------ | ---------- | ------------------------------------------------------------ | @@ -63,7 +63,7 @@ Ability组件信息标志,指示需要获取的Ability组件信息的内容。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 - **系统接口:** 系统接口,不支持三方应用调用。 + **系统接口:** 此接口为系统接口。 | 名称 | 值 | 说明 | | --------------------------------- | ---------- | ------------------------------------------------------------ | @@ -80,7 +80,7 @@ Ability组件信息标志,指示需要获取的Ability组件信息的内容。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 - **系统接口:** 系统接口,不支持三方应用调用。 + **系统接口:** 此接口为系统接口。 | 名称 | 值 | 说明 | | ------------------------------------------- | ---------- | ------------------------------------------------------------ | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md b/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md index 8b00ad32d9ad9f50939f3898ab8805876e8b4819..639b134facaa224ce680fdecf78220e2add53a34 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md @@ -24,7 +24,7 @@ import bundleMonitor from '@ohos.bundle.bundleMonitor'; **系统能力:** SystemCapability.BundleManager.BundleFramework.Core -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 | 名称 | 类型 | 可读 | 可写 | 说明 | | ---------- | ------ | ---- | ---- | -------------------------- | @@ -39,7 +39,7 @@ on(type: BundleChangedEvent, callback: Callback\): void; **需要权限:** ohos.permission.LISTEN_BUNDLE_CHANGE -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **系统能力:** SystemCapability.BundleManager.BundleFramework.Core @@ -72,7 +72,7 @@ off(type: BundleChangedEvent, callback?: Callback\): void; **需要权限:** ohos.permission.LISTEN_BUNDLE_CHANGE -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **系统能力:** SystemCapability.BundleManager.BundleFramework.Core diff --git a/zh-cn/application-dev/reference/apis/js-apis-businessAbilityRouter.md b/zh-cn/application-dev/reference/apis/js-apis-businessAbilityRouter.md new file mode 100644 index 0000000000000000000000000000000000000000..39213c877d58f8a243a1fd29dd8399f1a82da5ec --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-businessAbilityRouter.md @@ -0,0 +1,130 @@ +# @ohos.app.businessAbilityRouter (业务路由模块) + +本模块用于查询当前设备上安装的各种应用程序的路由ability信息。通过业务路由提供标准的业务模板和业务管理能力,开发者可以按照指定的业务类别注册标准业务,丰富的业务形成一个庞大的超市。系统应用或者三方应用可以从业务路由中获取所需业务,并选择合适的业务使用。同时业务路由提供统一的跳转管控规则,控制应用与业务之间的合理跳转,杜绝前后台任意的跳转行为,避免三方应用通过跳转变相分发,解决安全弱、体验差的问题。 + +> **说明:** +> +> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +本模块接口为系统接口。 + +## 导入模块 + +``` ts +import businessAbilityRouter from '@ohos.app.businessAbilityRouter'; +``` + +## 权限列表 + +| 权限 | 权限等级 | 描述 | +| ------------------------------------------ | ------------ | -------------------- | +| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | 可查询所有应用信息。 | + +权限等级参考[权限等级说明](../../security/accesstoken-overview.md#权限等级说明)。 + +## BusinessType + +此枚举值用于标识过滤条件类型。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 + +**系统接口:** 此接口为系统接口。 + +| 名称 | 值 | 说明 | +| ----------- | ---- | ------------------------------------ | +| SHARE | 0 | 标识具有共享类型的ability信息。 | +| UNSPECIFIED | 255 | 标识未指定类型的ability信息。 | + +## BusinessAbilityFilter + +此过滤值用于过滤查询的ability类型。 + +**系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall + +**系统接口:** 此接口为系统接口。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------ | ------------ | ---- | ---- | -------------------------------------- | +| businessType | BusinessType | 是 | 否 | 标识ability信息的类型。 | +| mimeType | string | 是 | 否 | 标识支持mime类型的ability信息。 | +| uri | string | 是 | 否 | 标识ability信息支持的uri。 | + +## businessAbilityRouter.queryBusinessAbilityInfo + +queryBusinessAbilityInfo(filter: BusinessAbilityFilter, callback: AsyncCallback\\>): void; + +以异步方法通过给定的过滤条件查询ability信息。使用callback异步回调。成功返回查询到的路由ability信息,失败返回对应错误信息。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**系统API:** 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------------------------- | +| filter | [BusinessAbilityFilter](#businessabilityfilter) | 是 | 支持按业务类型过滤的对象。 | +| callback | AsyncCallback\\> | 是 | 回调函数。返回查询到的ability信息,否则为错误对象。 | + +**示例:** + +```ts +import businessAbilityRouter from '@ohos.app.businessAbilityRouter'; +let filter = {businessType: businessAbilityRouter.BusinessType.SHARE}; + +try { + businessAbilityRouter.queryBusinessAbilityInfo(filter) + .then(() => { + console.info('queryBusinessAbilityInfo success'); + }).catch((error) => { + console.error('queryBusinessAbilityInfo failed ' + error.message); + }); +} catch (error) { + console.error('queryBusinessAbilityInfo failed ' + error.message); +} +``` + +## businessAbilityRouter.queryBusinessAbilityInfo + +queryBusinessAbilityInfo(filter: BusinessAbilityFilter): Promise\\>; + +以异步方法通过给定的过滤条件查询ability信息。使用Promise异步回调,成功返回查询到的路由ability信息,失败返回对应错误信息。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**系统API:** 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------------------------------- | ---- | --------------------------------------- | +| filter | [BusinessAbilityFilter](#businessabilityfilter) | 是 | 包含要查询的ability信息的筛选类型。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | ------------------------------------------- | +| Promise\\> | Promise对象,返回符合过滤条件的ability信息。 | + +**示例:** + +```ts +import businessAbilityRouter from '@ohos.app.businessAbilityRouter'; +let filter = {businessType: businessAbilityRouter.BusinessType.SHARE}; + +try { + businessAbilityRouter.queryBusinessAbilityInfo(filter, (error, data) => { + if (error) { + console.error('queryBusinessAbilityInfo failed ' + error.message); + return; + } + console.info('queryBusinessAbilityInfo success'); + }); +} catch (error) { + console.error('queryBusinessAbilityInfo failed ' + error.message); +} +``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md b/zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md index 71a3d4ec9aae0e71dc30a4ef9c7eb7f8912a0784..cd91357cd4a3e4840d40d9eaed33e91726b54400 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md @@ -109,7 +109,7 @@ getDefaultApplication(type: string, userId?: number): Promise\ **系统能力:** SystemCapability.BundleManager.BundleFramework.DefaultApp -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -165,7 +165,7 @@ getDefaultApplication(type: string, userId: number, callback: AsyncCallback\) : void **系统能力:** SystemCapability.BundleManager.BundleFramework.DefaultApp -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -266,7 +266,7 @@ setDefaultApplication(type: string, elementName: ElementName, userId?: number): **系统能力:** SystemCapability.BundleManager.BundleFramework.DefaultApp -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -338,7 +338,7 @@ setDefaultApplication(type: string, elementName: ElementName, userId: number, ca **系统能力:** SystemCapability.BundleManager.BundleFramework.DefaultApp -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -399,7 +399,7 @@ setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCal **系统能力:** SystemCapability.BundleManager.BundleFramework.DefaultApp -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -458,7 +458,7 @@ resetDefaultApplication(type: string, userId?: number): Promise\ **系统能力:** SystemCapability.BundleManager.BundleFramework.DefaultApp -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -508,7 +508,7 @@ resetDefaultApplication(type: string, userId: number, callback: AsyncCallback\) : void; **系统能力:** SystemCapability.BundleManager.BundleFramework.DefaultApp -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-display.md b/zh-cn/application-dev/reference/apis/js-apis-display.md index 8b73f026dcdc1864fcde3cc02707a890f3c39a9e..db7ab01ce6978bf0a8d49cf115a07ac5f4cd2f39 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-display.md +++ b/zh-cn/application-dev/reference/apis/js-apis-display.md @@ -291,6 +291,63 @@ try { } ``` +## display.on('privateModeChange')10+ + +on(type: 'privateModeChange', callback: Callback<boolean>): void + +开启屏幕隐私模式变化的监听。当屏幕前台有隐私窗口,则屏幕处于隐私模式,屏幕中的隐私窗口内容无法被截屏或录屏。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- |------------------------------------------| ---- | ------------------------------------------------------- | +| type | string | 是 | 监听事件,固定为'privateModeChange',表示屏幕隐私模式状态发生变化。 | +| callback | Callback<boolean> | 是 | 回调函数。表示屏幕隐私模式是否改变。true表示屏幕由非隐私窗口模式变为隐私模式,false表示屏幕由隐私模式变为非隐私模式。 | + +**示例:** + +```js +let callback = (data) => { + console.info('Listening enabled. Data: ' + JSON.stringify(data)); +}; +try { + display.on("privateModeChange", callback); +} catch (exception) { + console.error('Failed to register callback. Code: ' + JSON.stringify(exception)); +} +``` + +## display.off('privateModeChange')10+ + +off(type: 'privateModeChange', callback?: Callback<boolean>): void + +关闭屏幕隐私模式变化的监听。当屏幕前台有隐私窗口,则屏幕处于隐私模式,屏幕中的隐私窗口内容无法被截屏或录屏。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- |------------------------------------------| ---- | ------------------------------------------------------- | +| type | string | 是 | 监听事件,固定为'privateModeChange',表示屏幕隐私模式状态发生变化。 | +| callback | Callback<boolean> | 否 | 回调函数。表示屏幕隐私模式是否改变。true表示屏幕由非隐私模式变为隐私模式,false表示屏幕由隐私模式变为非隐私模式。 | + +**示例:** + +```js +try { + display.off("privateModeChange"); +} catch (exception) { + console.error('Failed to unregister callback. Code: ' + JSON.stringify(exception)); +} +``` + ## display.getDefaultDisplay(deprecated) getDefaultDisplay(callback: AsyncCallback<Display>): void diff --git a/zh-cn/application-dev/reference/apis/js-apis-image.md b/zh-cn/application-dev/reference/apis/js-apis-image.md index 8c0eb7fb0049de9da17c35d9c82f0e66e6483fb1..87fac2670885d45b4bdb29a743e0633f429a04c4 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-image.md +++ b/zh-cn/application-dev/reference/apis/js-apis-image.md @@ -79,7 +79,7 @@ image.createPixelMap(color, opts, (error, pixelmap) => { ## PixelMap7+ -图像像素类,用于读取或写入图像数据以及获取图像信息。在调用PixelMap的方法前,需要先通过createPixelMap创建一个PixelMap实例。 +图像像素类,用于读取或写入图像数据以及获取图像信息。在调用PixelMap的方法前,需要先通过createPixelMap创建一个PixelMap实例。目前pixelmap序列化大小最大128MB,超过会送显失败。大小计算方式为(宽\*高\*每像素占用字节数)。 ### 属性 diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md index e37ad10f026c01739eb8f354723a3f917ded9326..195a244212a7519294558ab9c7ab1821ec9e81c5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md @@ -41,12 +41,12 @@ Want是对象间信息传递的载体, 可以用于应用组件间的信息传 - 传递FD(文件描述符)数据(在UIAbility对象中调用,其中示例中的context为UIAbility的上下文对象) ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; // ... let fd; try { - fd = fileio.openSync('/data/storage/el2/base/haps/pic.png'); + fd = fs.openSync('/data/storage/el2/base/haps/pic.png').fd; } catch(e) { console.error('openSync fail: ${JSON.stringify(e)}'); } diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md index 54740765f23e2b2e45f45af87ddc781604604b6b..064e036e1a0e3a95440c202d04e1d5c98797d329 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md @@ -88,7 +88,7 @@ export default class EntryAbility extends UIAbility { } ``` -## ApplicationContext.off(type: 'abilityLifecycle', callbackId: number, callback: AsyncCallback) +## ApplicationContext.off(type: 'abilityLifecycle', callbackId: number, callback: AsyncCallback\) off(type: 'abilityLifecycle', callbackId: **number**, callback: AsyncCallback<**void**>): **void**; @@ -206,7 +206,7 @@ export default class EntryAbility extends UIAbility { } ``` -## ApplicationContext.off(type: 'environment', callbackId: number, callback: AsyncCallback) +## ApplicationContext.off(type: 'environment', callbackId: number, callback: AsyncCallback\) off(type: 'environment', callbackId: **number**, callback: AsyncCallback<**void**>): **void**; diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md index 85b44d8120beb7dbb836ed74b9d3c45dc8fdeac8..9b835fee85ba01b9ccfd41b2bc65ccca524763f1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md @@ -56,7 +56,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000051 | Network error. The network is abnormal. | | 16000052 | Free install not support. The application does not support freeinstall | | 16000053 | Not top ability. The application is not top ability. | @@ -128,7 +128,7 @@ startAbility(want: Want, options?: StartOptions): Promise\; | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000051 | Network error. The network is abnormal. | | 16000052 | Free install not support. The application does not support freeinstall | | 16000053 | Not top ability. The application is not top ability. | @@ -198,7 +198,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000051 | Network error. The network is abnormal. | | 16000052 | Free install not support. The application does not support freeinstall | | 16000053 | Not top ability. The application is not top ability. | @@ -275,7 +275,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000051 | Network error. The network is abnormal. | | 16000052 | Free install not support. The application does not support freeinstall | | 16000053 | Not top ability. The application is not top ability. | @@ -351,7 +351,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000051 | Network error. The network is abnormal. | | 16000052 | Free install not support. The application does not support freeinstall | | 16000053 | Not top ability. The application is not top ability. | @@ -436,7 +436,7 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): | 16000009 | Can not start ability in wukong mode. | | 16000010 | Can not operation with continue flag. | | 16000011 | Context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000051 | Network error. The network is abnormal. | | 16000052 | Free install not support. The application does not support freeinstall | | 16000053 | Not top ability. The application is not top ability. | @@ -1330,7 +1330,7 @@ startAbilityByCall(want: Want): Promise<Caller>; | 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | | 16000008 | Crowdtest App Expiration. | | 16000009 | Can not start ability in wukong mode. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal Error. | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md index 1cf39b1e8171f8c419208e4b904bb18be6a17f18..7d2b3c2fd04e462648c22379121bb81726d246a9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md @@ -54,7 +54,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -118,7 +118,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -191,7 +191,7 @@ startAbility(want: Want, options?: StartOptions): Promise<void>; | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -260,7 +260,7 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -328,7 +328,7 @@ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -406,7 +406,7 @@ startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityRes | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -477,7 +477,7 @@ startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncC | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -549,7 +549,7 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOp | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -629,7 +629,7 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartO | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -1584,7 +1584,7 @@ startAbilityByCall(want: Want): Promise<Caller>; | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -1691,7 +1691,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -1763,7 +1763,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | @@ -1837,7 +1837,7 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): | 16000009 | An ability cannot be started or stopped in Wukong mode. | | 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | -| 16000012 | The previous ability is starting, wait start later. | +| 16000017 | The previous ability is starting, wait start later. | | 16000050 | Internal error. | | 16000053 | The ability is not on the top of the UI. | | 16000055 | Installation-free timed out. | diff --git a/zh-cn/application-dev/reference/apis/js-apis-installer.md b/zh-cn/application-dev/reference/apis/js-apis-installer.md index d00cf928cd584ae05e54c97ddb31486b3ef95e95..fa3899aefcdbbc4c796e7da227412702ef9b2d31 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-installer.md +++ b/zh-cn/application-dev/reference/apis/js-apis-installer.md @@ -25,7 +25,7 @@ getBundleInstaller(callback: AsyncCallback\): void; 获取BundleInstaller对象,使用callback形式返回结果。 -**系统接口:** 此接口为系统接口,三方应用不支持调用 +**系统接口:** 此接口为系统接口。 **系统能力:** SystemCapability.BundleManager.BundleFramework.Core @@ -59,7 +59,7 @@ getBundleInstaller(): Promise\; 获取BundleInstaller对象,使用callback形式返回结果。 -**系统接口:** 此接口为系统接口,三方应用不支持调用 +**系统接口:** 此接口为系统接口。 **系统能力:** SystemCapability.BundleManager.BundleFramework.Core @@ -89,7 +89,7 @@ install(hapFilePaths: Array<string>, installParam: InstallParam, callback: 以异步方法安装应用,使用callback形式返回结果。 -**系统接口:** 此接口为系统接口,三方应用不支持调用 +**系统接口:** 此接口为系统接口。 **需要权限:** ohos.permission.INSTALL_BUNDLE @@ -120,6 +120,7 @@ install(hapFilePaths: Array<string>, installParam: InstallParam, callback: | 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. | | 17700036 | Failed to install the HSP because lacks appropriate permissions. | | 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. | +| 17700041 | Failed to install because enterprise device management disallow install. | **示例:** @@ -149,13 +150,84 @@ try { } ``` +## BundleInstaller.install + +install(hapFilePaths: Array\, installParam?: InstallParam) : Promise\; + +以异步方法安装应用,使用Promise形式返回结果。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.INSTALL_BUNDLE + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | +| hapFilePaths | Array\ | 是 | 存储应用程序包的路径。路径应该是当前应用程序中存放HAP的数据目录。当传入的路径是一个目录时, 该目录下只能放同一个应用的HAP,且这些HAP的签名需要保持一致。 | +| installParam | [InstallParam](#installparam) | 否 | 指定安装所需的其他参数。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | -------------------------------------- | +| Promise\ | Promise对象。无返回结果的Promise对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------------------ | +| 17700004 | The specified user ID is not found. | +| 17700010 | Failed to install the HAP because the HAP fails to be parsed. | +| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. | +| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. | +| 17700015 | Failed to install the HAPs because they have different configuration information. | +| 17700016 | Failed to install the HAP because of insufficient system disk space. | +| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. | +| 17700018 | Failed to install because the dependent module does not exist. | +| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. | +| 17700036 | Failed to install the HSP because lacks appropriate permissions. | +| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. | +| 17700041 | Failed to install because enterprise device management disallow install. | + +**示例:** + +```ts +import installer from '@ohos.bundle.installer'; +let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/']; +let installParam = { + userId: 100, + isKeepData: false, + installFlag: 1, +}; + +try { + installer.getBundleInstaller().then(data => { + data.install(hapFilePaths, installParam) + .then((data) => { + console.info('install success: ' + JSON.stringify(data)); + }).catch((error) => { + console.error('install failed:' + err.message); + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` + ## BundleInstaller.uninstall uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallback<void>): void; 以异步方法卸载应用,使用callback形式返回结果。 -**系统接口:** 此接口为系统接口,三方应用不支持调用 +**系统接口:** 此接口为系统接口。 **需要权限:** ohos.permission.INSTALL_BUNDLE @@ -213,7 +285,7 @@ uninstall(uninstallParam: UninstallParam, callback : AsyncCallback\) : voi 以异步方法卸载一个共享包,使用callback形式返回结果。 -**系统接口:** 此接口为系统接口,三方应用不支持调用 +**系统接口:** 此接口为系统接口。 **需要权限:** ohos.permission.INSTALL_BUNDLE @@ -267,7 +339,7 @@ uninstall(uninstallParam: UninstallParam) : Promise\; 以异步方法卸载一个共享包,使用Promise形式返回结果。 -**系统接口:** 此接口为系统接口,三方应用不支持调用 +**系统接口:** 此接口为系统接口。 **需要权限:** ohos.permission.INSTALL_BUNDLE @@ -326,7 +398,7 @@ recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback& 以异步方法回滚应用,使用callback形式返回结果。 -**系统接口:** 此接口为系统接口,三方应用不支持调用 +**系统接口:** 此接口为系统接口。 **需要权限:** ohos.permission.INSTALL_BUNDLE @@ -382,7 +454,7 @@ try { **系统能力:** SystemCapability.BundleManager.BundleFramework.Core - **系统接口:** 此接口为系统接口,三方应用不支持调用 + **系统接口:** 此接口为系统接口。 | 名称 | 类型 | 必填 | 说明 | | ---------- | ------ | ---------------- | ---------------- | @@ -395,7 +467,7 @@ try { **系统能力:** SystemCapability.BundleManager.BundleFramework.Core - **系统接口:** 此接口为系统接口,三方应用不支持调用 + **系统接口:** 此接口为系统接口。 | 名称 | 类型 | 必填 | 说明 | | ------------------------------ | ------------------------------ | ------------------ | ------------------ | @@ -412,7 +484,7 @@ try { **系统能力:** SystemCapability.BundleManager.BundleFramework.Core - **系统接口:** 此接口为系统接口,三方应用不支持调用 + **系统接口:** 此接口为系统接口。 | 名称 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ------------------------------------------------------------ | diff --git a/zh-cn/application-dev/reference/apis/js-apis-nfcController.md b/zh-cn/application-dev/reference/apis/js-apis-nfcController.md index b46c3e52c46c256fad4ca33851398ed62e7aad52..6721457686b722d50b67c43a0612213b0afc90f0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-nfcController.md +++ b/zh-cn/application-dev/reference/apis/js-apis-nfcController.md @@ -64,7 +64,7 @@ openNfc(): boolean ## controller.enableNfc9+ -enableNfc(): boolean +enableNfc(): void 打开NFC开关。 @@ -101,7 +101,7 @@ closeNfc(): boolean ## controller.disableNfc9+ -disableNfc(): boolean +disableNfc(): void 关闭NFC开关。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-overlay.md b/zh-cn/application-dev/reference/apis/js-apis-overlay.md index 3faa6159a50e121b6b2c99e548cfd0afa3cb8506..731ff7e80b7cf164f07ed15f642cb58bf48ba67f 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-overlay.md +++ b/zh-cn/application-dev/reference/apis/js-apis-overlay.md @@ -114,7 +114,7 @@ setOverlayEnabledByBundleName(bundleName:string, moduleName:string, isEnabled: b **系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -170,7 +170,7 @@ setOverlayEnabledByBundleName(bundleName:string, moduleName:string, isEnabled: b **系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -394,7 +394,7 @@ getOverlayModuleInfoByBundleName(bundleName: string, moduleName?: string): Promi **系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -446,7 +446,7 @@ getOverlayModuleInfoByBundleName(bundleName: string, moduleName: string, callbac **系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -496,7 +496,7 @@ getOverlayModuleInfoByBundleName(bundleName: string, callback: AsyncCallback\7+
| {[key:string]:object} | 是 | 是 | 设置的其他附加属性数据。 | +| additions7+ | {[key:string]:object} | 是 | 是 | 设置的其他附加属性数据, 暂不支持。 | | mimeTypes7+ | Array<string> | 是 | 否 | 剪贴板内容条目的数据类型,非重复的类型列表。 | -| tag7+ | string | 是 | 是 | 用户自定义标签。 | +| tag7+ | string | 是 | 是 | 用户自定义标签, 暂不支持。 | | timestamp7+ | number | 是 | 否 | 剪贴板数据的写入时间戳(单位:ms)。 | -| localOnly7+ | boolean | 是 | 是 | 配置剪贴板内容是否为“仅在本地”。默认值为true。
- 配置为true时,表示内容仅在本地,不会在设备之间传递。
- 配置为false时,表示内容将在设备间传递。 | +| localOnly7+ | boolean | 是 | 是 | 配置剪贴板内容是否为“仅在本地”, 默认值为true。暂不支持, 推荐使用shareOption属性。
- 配置为true时,表示内容仅在本地,不会在设备之间传递。
- 配置为false时,表示内容将在设备间传递。 | | shareOption9+ | [ShareOption](#shareoption9) | 是 | 是 | 指示剪贴板数据可以粘贴到的范围,如果未设置或设置不正确,则默认值为CROSSDEVICE。 | ## PasteDataRecord7+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-tagSession.md b/zh-cn/application-dev/reference/apis/js-apis-tagSession.md index 32b66bd40eecb8b10ef4313dbd7325c80cf8162e..fda6cf598264cd5e2cbb6972ee0f24329dc51446 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-tagSession.md +++ b/zh-cn/application-dev/reference/apis/js-apis-tagSession.md @@ -183,8 +183,6 @@ isTagConnected(): boolean > **说明:** > 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tagSession.isConnected](#tagsessionisconnected9)替代。 -**需要权限:** ohos.permission.NFC_TAG - **系统能力:** SystemCapability.Communication.NFC.Tag **返回值:** @@ -211,8 +209,6 @@ isConnected(): boolean 检查是否已与标签建立连接。 -**需要权限:** ohos.permission.NFC_TAG - **系统能力:** SystemCapability.Communication.NFC.Tag **返回值:** diff --git a/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md b/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md index 536201bfe0805ff55544d1c84de0fe137e7fcff7..81aa95dac6af8492a5c2a0e6375b2beb384873e1 100644 --- a/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md +++ b/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md @@ -42,6 +42,9 @@ - [背景模糊设置](ts-universal-attributes-backgroundBlurStyle.md) - [分布式迁移标识](ts-universal-attributes-restoreId.md) - [前景色设置](ts-universal-attributes-foreground-color.md) + - [图像球面效果设置](ts-universal-attributes-sphericalEffect.md) + - [图像渐亮效果设置](ts-universal-attributes-lightUpEffect.md) + - [图像像素扩展效果设置](ts-universal-attributes-pixelStretchEffect.md) - [文本通用属性](ts-universal-attributes-text-style.md) - 手势处理 - [绑定手势方法](ts-gesture-settings.md) diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/datePickerLightUp1.png b/zh-cn/application-dev/reference/arkui-ts/figures/datePickerLightUp1.png new file mode 100644 index 0000000000000000000000000000000000000000..120c59b0dcd102d538973fa3c62784d99e93cc17 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/datePickerLightUp1.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/datePickerLightUp2.png b/zh-cn/application-dev/reference/arkui-ts/figures/datePickerLightUp2.png new file mode 100644 index 0000000000000000000000000000000000000000..a2172a8da22332f1ccec1714112e4a229ca36f53 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/datePickerLightUp2.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textInputSpherical1.png b/zh-cn/application-dev/reference/arkui-ts/figures/textInputSpherical1.png new file mode 100644 index 0000000000000000000000000000000000000000..f74c71cb969043be9633db7a9992c68b1be6d184 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textInputSpherical1.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textInputSpherical2.png b/zh-cn/application-dev/reference/arkui-ts/figures/textInputSpherical2.png new file mode 100644 index 0000000000000000000000000000000000000000..b4c67f4f18c92adc7a7f9e78d3935ba2c60da40a Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textInputSpherical2.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp1.png b/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp1.png new file mode 100644 index 0000000000000000000000000000000000000000..d696e61fa669c6592e260e3ad0f3206e2cf45074 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp1.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp2.png b/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp2.png new file mode 100644 index 0000000000000000000000000000000000000000..8674b8af58468eec28e065311b610c290265d882 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp2.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp3.png b/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp3.png new file mode 100644 index 0000000000000000000000000000000000000000..d22967a38886f445e189451aae173edb2455c478 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp3.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch1.png b/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch1.png new file mode 100644 index 0000000000000000000000000000000000000000..bcf4db606d9e10ef6c418474bbaedae96c232436 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch1.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch2.png b/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch2.png new file mode 100644 index 0000000000000000000000000000000000000000..aca08823440ca1fb14ca9a681c625ed4e392154f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch2.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch3.png b/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch3.png new file mode 100644 index 0000000000000000000000000000000000000000..418870d8dce2b5a7c492bdc26193894a57b9b66d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch3.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-richtext.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-richtext.md index 77185a29a95553779eb45351b086d1944d53e95f..504e2cde4f47a553f302dd77f54155121b2cefd1 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-richtext.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-richtext.md @@ -5,7 +5,7 @@ > **说明:** > > 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 - +> 使用该组件时请设置高度值。 ## 子组件 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md index 0389e734d011200154e3832fdd90af7ce62f9d1e..422eba6537a786177e7c3dc612c5f2158db4d9fc 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md @@ -20,8 +20,8 @@ TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Tex | 参数名 | 参数类型 | 必填 | 参数描述 | | ----------------------- | ---------------------------------------- | ---- | -------------- | -| placeholder | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置无输入时的提示文本,输入内容后,提示文本不显示。 | -| text | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置输入框当前的文本内容。 | +| placeholder | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置无输入时的提示文本。输入内容后,提示文本不显示。 | +| text | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置输入框当前的文本内容。
当组件设置[stateStyles](ts-universal-attributes-polymorphic-style.md)等刷新属性时,建议通过onChange事件将状态变量与文本实时绑定,
避免组件刷新时TextArea中的文本内容异常。 | | controller8+ | [TextAreaController](#textareacontroller8) | 否 | 设置TextArea控制器。 | @@ -102,6 +102,7 @@ struct TextAreaExample { build() { Column() { TextArea({ + text: this.text, placeholder: 'The text area can hold an unlimited amount of text. input your word...', controller: this.controller }) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md index c266cfa7660e6994745d7c3ef977aa7eadf7571c..ffa80febf3417ef27c798b4e7d73c3b747e7d9a7 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md @@ -21,7 +21,7 @@ TextInput(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Te | 参数名 | 参数类型 | 必填 | 参数描述 | | ----------------------- | ---------------------------------------- | ---- | --------------- | | placeholder | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置无输入时的提示文本。 | -| text | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置输入框当前的文本内容。 | +| text | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置输入框当前的文本内容。
当组件设置[stateStyles](ts-universal-attributes-polymorphic-style.md)等刷新属性时,建议通过onChange事件将状态变量与文本实时绑定,
避免组件刷新时TextInput中的文本内容异常。 | | controller8+ | [TextInputController](#textinputcontroller8) | 否 | 设置TextInput控制器。 | @@ -135,7 +135,7 @@ struct TextInputExample { build() { Column() { - TextInput({ placeholder: 'input your word...', controller: this.controller }) + TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) .placeholderColor(Color.Grey) .placeholderFont({ size: 14, weight: 400 }) .caretColor(Color.Blue) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md index afb97ce43429073227f53a53f7d7982eb069776a..a3781242346241c0874800558095b6c205a0a0c2 100755 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-web.md @@ -1232,7 +1232,7 @@ struct WebComponent { } ``` -### allowWindowOpenMethod9+ +### allowWindowOpenMethod10+ allowWindowOpenMethod(flag: boolean) @@ -2080,11 +2080,12 @@ onScaleChange(callback: (event: {oldScale: number, newScale: number}) => void) } ``` -### onUrlLoadIntercept +### onUrlLoadIntercept(deprecated) onUrlLoadIntercept(callback: (event?: { data:string | WebResourceRequest }) => boolean) 当Web组件加载url之前触发该回调,用于判断是否阻止此次访问。默认允许加载。 +从API version 10开始不在维护,建议使用[onLoadIntercept10+](#onloadintercept10)代替。 **参数:** @@ -3100,7 +3101,7 @@ onAudioStateChanged(callback: (event: { playing: boolean }) => void) ### onLoadIntercept10+ -onLoadIntercept(callback: (event?: { request: WebResourceRequest }) => boolean) +onLoadIntercept(callback: (event?: { data: WebResourceRequest }) => boolean) 当Web组件加载url之前触发该回调,用于判断是否阻止此次访问。默认允许加载。 @@ -3130,11 +3131,11 @@ onLoadIntercept(callback: (event?: { request: WebResourceRequest }) => boolean) build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) - .onUrlLoadIntercept((event) => { - console.log('url:' + event.request.getRequestUrl()) - console.log('isMainFrame:' + event.request.isMainFrame()) - console.log('isRedirect:' + event.request.isRedirect()) - console.log('isRequestGesture:' + event.request.isRequestGesture()) + .onLoadIntercept((event) => { + console.log('url:' + event.data.getRequestUrl()) + console.log('isMainFrame:' + event.data.isMainFrame()) + console.log('isRedirect:' + event.data.isRedirect()) + console.log('isRequestGesture:' + event.data.isRequestGesture()) return true }) } @@ -3340,6 +3341,18 @@ isRequestGesture(): boolean | ------- | -------------------- | | boolean | 返回资源请求是否与手势(如点击)相关联。 | +### getRequestMethod9+ + +getRequestMethod(): string + +获取请求方法。 + +**返回值:** + +| 类型 | 说明 | +| ------- | -------------------- | +| string | 返回请求方法。 | + ## Header Web组件返回的请求/响应头对象。 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-columnsplit.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-columnsplit.md index 0d20a6caeaf865b9d0b217a1aa418980ff340479..72b91171c695749c6adc5588e21c68b7beadbec5 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-columnsplit.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-columnsplit.md @@ -29,6 +29,8 @@ ColumnSplit() > 与RowSplit相同,ColumnSplit的分割线最小能拖动到刚好包含子组件。 > > 在真机中查看拖动效果,预览器中不支持拖动。 +> +> 不支持clip、margin通用属性。 ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-grid.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-grid.md index 837e139eda12d17eef6a47e15de921e125484179..25c8005fdeea7e965621140a00e2ae8f53e96b07 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-grid.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-grid.md @@ -24,6 +24,8 @@ > if/else/ForEach/LazyForEach发生变化以后,会更新子节点索引值。 > > Grid子组件的visibility属性设置为Hidden或None时依然会计算索引值。 +> +> Grid子组件的visibility属性设置为None时不显示,但依然会占用子组件对应的网格。 ## 接口 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-list.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-list.md index 4a6ba919efbb06c8b77c66add018249b35ae3ef8..d90477e50c0166840c2d6cd575c4dc32768b7f5a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-list.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-list.md @@ -27,6 +27,8 @@ > ListItemGroup作为一个整体计算一个索引值,ListItemGroup内部的ListItem不计算索引值。 > > List子组件visibility属性设置为Hidden或None依然会计算索引值。 +> +> List子组件的visibility属性设置为None时不显示,但该子组件上下的space还会生效。 ## 接口 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md index 6563873c5d243b86b9f8fab1a64279037eaa6ef6..7d8671137f9b2af63d2440dd6c9fac951d5fa123 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md @@ -26,7 +26,7 @@ ListItem(value?: string) | -------- | -------- | -------- | | sticky(deprecated) | [Sticky](#stickydeprecated枚举说明) | 设置ListItem吸顶效果。
默认值:Sticky.None
从API version9开始废弃,推荐使用[List组件sticky属性](ts-container-list.md#属性)。 | | editable(deprecated) | boolean \| [EditMode](#editmodedeprecated枚举说明) | 当前ListItem元素是否可编辑,进入编辑模式后可删除或移动列表项。
从API version9开始废弃。
默认值:false | -| selectable8+ | boolean | 当前ListItem元素是否可以被鼠标框选。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
外层List容器的鼠标框选开启时,ListItem的框选才生效。
默认值:true | +| selectable8+ | boolean | 当前ListItem元素是否可以被鼠标框选。
**说明:**
外层List容器的鼠标框选开启时,ListItem的框选才生效。
默认值:true | | swipeAction9+ | {
start?: CustomBuilder,
end?:CustomBuilder,
edgeEffect?: [SwipeEdgeEffect](#swipeedgeeffect9枚举说明),
} | 用于设置ListItem的划出组件。
- start: ListItem向右划动时item左边的组件(List垂直布局时)或ListItem向下划动时item上方的组件(List水平布局时)。
- end: ListItem向左划动时item右边的组件(List垂直布局时)或ListItem向上划动时item下方的组件(List水平布局时)。
- edgeEffect: 滑动效果。
**说明:**
start和end对应的@builder函数中顶层必须是单个组件,不能是if/else、ForEach、LazyForEach语句。 | ## Sticky(deprecated)枚举说明 @@ -55,7 +55,7 @@ ListItem(value?: string) | 名称 | 功能描述 | | -------- | -------- | -| onSelect(event: (isSelected: boolean) => void)8+ | ListItem元素被鼠标框选的状态改变时触发回调。
isSelected:进入鼠标框选范围即被选中返回true, 移出鼠标框选范围即未被选中返回false。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onSelect(event: (isSelected: boolean) => void)8+ | ListItem元素被鼠标框选的状态改变时触发回调。
isSelected:进入鼠标框选范围即被选中返回true, 移出鼠标框选范围即未被选中返回false。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-rowsplit.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-rowsplit.md index da4043d3bf0612b044344ba91e947b2d52cb80f6..35e7c2907c15ecee2803b71db4e8976e8135bcb6 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-rowsplit.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-rowsplit.md @@ -26,6 +26,8 @@ RowSplit() > RowSplit的分割线最小能拖动到刚好包含子组件。 > > 在真机中查看拖动效果,预览器中不支持拖动。 +> +> 不支持clip、margin通用属性。 ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-waterflow.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-waterflow.md index cba3fda2ef1385d851b80935f6b4406aba972f04..8be87f8269e96ba280ae5a236231e7b8bd1b1a27 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-waterflow.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-waterflow.md @@ -14,6 +14,9 @@ 包含[FlowItem](ts-container-flowitem.md)子组件。 +> **说明:** +> +> WaterFlow子组件的visibility属性设置为None时不显示,但依然会占用子组件对应的网格。 ## 接口 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-component.md b/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-component.md index 8d2253624748281833834205d7620d6d25cc6cb4..27e49abebea9cec1e379b5ff2168fb034e819dff 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-component.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-component.md @@ -12,17 +12,17 @@ | 名称 | 参数类型 | 参数描述 | | -------- | -------- | -------- | -| transition | TransitionOptions | 设置组件插入显示和删除隐藏的过渡效果。
默认值:不设置任何过渡效果时,默认有透明度从0到1的过渡效果。若设置了其他过渡效果,以设置的过渡效果为准。
**说明:**
所有参数均为可选参数,详细描述见TransitionOptions参数说明。 | +| transition | TransitionOptions | 设置组件插入显示和删除隐藏的过渡效果。
默认值:不设置任何过渡效果时,默认有透明度从0到1的过渡效果。若设置了其他过渡效果,以设置的过渡效果为准。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
所有参数均为可选参数,详细描述见TransitionOptions参数说明。 | ## TransitionOptions参数说明 | 参数名称 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| type | [TransitionType](ts-appendix-enums.md#transitiontype) | 否 | 默认包括组件新增和删除。
默认值:TransitionType.All
**说明:**
不指定Type时说明插入删除使用同一种效果。 | -| opacity | number | 否 | 设置组件转场时的透明度效果,为插入时起点和删除时终点的值。
默认值:1
取值范围: [0, 1]
**说明:**
设置小于0的值时,按值为0处理;设置大于1的值时,按值为1处理。 | -| translate | {
x? : number \| string,
y? : number \| string,
z? : number \| string
} | 否 | 设置组件转场时的平移效果,为插入时起点和删除时终点的值。
-x:横向的平移距离。
-y:纵向的平移距离。
-z:竖向的平移距离。 | -| scale | {
x? : number,
y? : number,
z? : number,
centerX? : number \| string,
centerY? : number \| string
} | 否 | 设置组件转场时的缩放效果,为插入时起点和删除时终点的值。
-x:横向放大倍数(或缩小比例)。
-y:纵向放大倍数(或缩小比例)。
-z:竖向放大倍数(或缩小比例)。
- centerX、centerY指缩放中心点,centerX和centerY默认值是"50%"。
- 中心点为0时,默认的是组件的左上角。
| -| rotate | {
x?: number,
y?: number,
z?: number,
angle?: number \| string,
centerX?: number \| string,
centerY?: number \| string
} | 否 | 设置组件转场时的旋转效果,为插入时起点和删除时终点的值。
-x:横向的旋转向量。
-y:纵向的旋转向量。
-z:竖向的旋转向量。
- centerX,centerY指旋转中心点,centerX和centerY默认值是"50%"。
- 中心点为(0,0)时,默认的是组件的左上角。 | +| type | [TransitionType](ts-appendix-enums.md#transitiontype) | 否 | 默认包括组件新增和删除。
默认值:TransitionType.All
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
不指定Type时说明插入删除使用同一种效果。 | +| opacity | number | 否 | 设置组件转场时的透明度效果,为插入时起点和删除时终点的值。
默认值:1
取值范围: [0, 1]
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
设置小于0的值时,按值为0处理;设置大于1的值时,按值为1处理。 | +| translate | {
x? : number \| string,
y? : number \| string,
z? : number \| string
} | 否 | 设置组件转场时的平移效果,为插入时起点和删除时终点的值。
-x:横向的平移距离。
-y:纵向的平移距离。
-z:竖向的平移距离。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| scale | {
x? : number,
y? : number,
z? : number,
centerX? : number \| string,
centerY? : number \| string
} | 否 | 设置组件转场时的缩放效果,为插入时起点和删除时终点的值。
-x:横向放大倍数(或缩小比例)。
-y:纵向放大倍数(或缩小比例)。
-z:竖向放大倍数(或缩小比例)。
- centerX、centerY指缩放中心点,centerX和centerY默认值是"50%"。
- 中心点为0时,默认的是组件的左上角。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| rotate | {
x?: number,
y?: number,
z?: number,
angle?: number \| string,
centerX?: number \| string,
centerY?: number \| string
} | 否 | 设置组件转场时的旋转效果,为插入时起点和删除时终点的值。
-x:横向的旋转向量。
-y:纵向的旋转向量。
-z:竖向的旋转向量。
- centerX,centerY指旋转中心点,centerX和centerY默认值是"50%"。
- 中心点为(0,0)时,默认的是组件的左上角。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-types.md b/zh-cn/application-dev/reference/arkui-ts/ts-types.md index 6dea36b625b7a3d267bf8f9066b6d244e298f1f7..114b23b9ee5b7ce4da2b93c96cd1da0fce0fee32 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-types.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-types.md @@ -224,3 +224,13 @@ | ------------- | ---------------------- | ---------------------------------------- | | CustomBuilder | () => any | 该方法类型必须使用@Builder装饰器修饰。具体用法见[@Builder](../../quick-start/arkts-dynamic-ui-elememt-building.md#builder)。 | +## PixelStretchEffectOptions10+ + +像素扩展属性集合,用于描述像素扩展的信息。 + +| 名称 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | ---------- | +| left | [Length](#length) | 否 | 组件图像左边沿扩展距离。 | +| right | [Length](#length) | 否 | 组件图像右边沿像素扩展距离。 | +| top | [Length](#length) | 否 | 组件图像上边沿像素扩展距离。 | +| bottom | [Length](#length) | 否 | 组件图像下边沿像素扩展距离。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-lightUpEffect.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-lightUpEffect.md new file mode 100644 index 0000000000000000000000000000000000000000..a9bb7528afe070280842971a5984ad069b6e6fa5 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-lightUpEffect.md @@ -0,0 +1,80 @@ +# 图像渐亮效果 + +设置组件的图像渐亮效果。 + +> **说明:** +> +> 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。此接口为系统接口。 + +## 属性 + +| 名称 | 参数类型 | 描述 | +| -------- | -------- | -------- | +| lightUpEffect | [number] | 设置组件图像亮起程度。
取值范围:[0,1]。
如果value等于0则图像为全黑,如果value等于1则图像为全亮效果。0到1之间数值越大,表示图像亮度越高。`value < 0` 或者 `value > 1`为异常情况,`value < 0`按0处理,`value > 1`按1处理。 | + +## 示例 + +### 示例1 +```ts +// xxx.ets +@Entry +@Component +struct LightUpExample { + build() { + Stack() { + Text('This is the text content with letterSpacing 0.') + .letterSpacing(0) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('50%') + .lightUpEffect(0.6) + }.alignContent(Alignment.Center).width("100%").height("100%") + } +} + +``` +效果图如下: + +![textLightUp3](figures/textLightUp3.png) + +修改lightUpEffect参数值为0.2: + +![textLightUp2](figures/textLightUp2.png) + +去掉lightUpEffect的设置,效果如下: + +![textLightUp1](figures/textLightUp1.png) +### 示例2 + +```ts +// xxx.ets +@Entry +@Component +struct LightUpExample { + @State isLunar: boolean = false + private selectedDate: Date = new Date('2028-08-08') + build() { + Stack() { + DatePicker({ + start: new Date('1970-1-1'), + end: new Date('2100-1-1'), + selected: this.selectedDate + }) + .lunar(this.isLunar) + .onChange((value: DatePickerResult) => { + this.selectedDate.setFullYear(value.year, value.month, value.day) + console.info('select current date is: ' + JSON.stringify(value)) + }) + .lightUpEffect(0.6) + + }.alignContent(Alignment.Center).width("100%").height("100%") + } +} +``` + +![datePickerLightUp2](figures/datePickerLightUp2.png) + +去掉lightUpEffect的设置,效果如下: + +![datePickerLightUp1](figures/datePickerLightUp1.png) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-pixelStretchEffect.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-pixelStretchEffect.md new file mode 100644 index 0000000000000000000000000000000000000000..d99b8e9f43e3f86d4831f4341bf72680d14f683b --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-pixelStretchEffect.md @@ -0,0 +1,76 @@ +# 图像边缘像素扩展效果 + +设置组件的图像边缘像素扩展效果。 + +> **说明:** +> +> 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。此接口为系统接口。 + +## 属性 + +| 名称 | 参数类型 | 描述 | +| -------- | -------- | -------- | +| pixelStretchEffect | [PixelStretchEffectOptions](ts-types.md#PixelStretchEffectOptions) | 设置组件的图像边缘像素扩展距离。
参数`options`包括上下左右四个方向的边缘像素扩展距离。
**说明:**
1、如果距离为正值,表示向外扩展,放大原来图像大小。上下左右四个方向分别用边缘像素填充,填充的距离即为设置的边缘扩展的距离。
2、如果距离为负值,表示内缩,但是最终图像大小不变。内缩方式:1、图像根据`options`的设置缩小,缩小大小为四个方向边缘扩展距离的绝对值。2、图像用边缘像素扩展到原来大小。
3、对`options`的输入约束:1、上下左右四个方向的扩展统一为非正值或者非负值。即四个边同时向外扩或者内缩,方向一致。2、所有方向的输入均为百分比或者具体值,不支持百分比和具体值混用。3、所有异常情况下,显示为{0,0,0,0}效果,即跟原图保持一致。| + +## 示例 + +### 示例1 + +```ts +// xxx.ets +@Entry +@Component +struct PixelStretchExample { + build() { + Stack() { + Text('This is the text content with letterSpacing 0.') + .letterSpacing(0) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('50%') + .pixelStretchEffect({top:10,left:10,right:10,bottom:10 }) + }.alignContent(Alignment.Center).width("100%").height("100%") + } +} + +``` +效果图如下: + +![textPixelStretch1](figures/textPixelStretch1.png) + +去掉pixelStretchEffect的设置,原图效果如下: + +![textPixelStretch2](figures/textPixelStretch2.png) + +对比发现,如果边缘扩展距离设置为正值,图像向外扩展了边缘距离。 + +### 示例2 + +基于示例1,现在把边缘扩展距离改为非正值。 + +```ts +// xxx.ets +@Entry +@Component +struct PixelStretchExample { + build() { + Stack() { + Text('This is the text content with letterSpacing 0.') + .letterSpacing(0) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('50%') + .pixelStretchEffect({top:-10,left:-10,right:-10,bottom:-10 }) + }.alignContent(Alignment.Center).width("100%").height("100%") + } +} +``` +效果图如下: + +![textPixelStretch3](figures/textPixelStretch3.png) + +跟原图对比发现,效果图分两步实现:
1、原图大小缩小,缩小后的大小为原图大小减去像素 +收缩的距离。例如,原图大小为`100*100`,设置了`pixelStretchEffect({top:-10,left:-10, +right:-10,bottom:-10 })`,则缩小后的大小为`(100-10-10)*(100-10-10)`,即`80*80`。
2、使用边缘像素扩展,将图像扩展为原图大小。 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sphericalEffect.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sphericalEffect.md new file mode 100644 index 0000000000000000000000000000000000000000..921a8085250cae49106d0c3c15ff148c747f8045 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sphericalEffect.md @@ -0,0 +1,49 @@ +# 图像球面效果 + +设置组件的图像球面效果。 + +> **说明:** +> +> 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。此接口为系统接口。 + +## 属性 + +| 名称 | 参数类型 | 描述 | +| -------- | -------- | -------- | +| sphericalEffect | [number] | 设置组件的图像球面化程度。
取值范围:[0,1]。
**说明:**
1、如果value等于0则图像保持原样,如果value等于1则图像为完全球面化效果。在0和1之间,数值越大,则球面化程度越高。
`value < 0 `或者` value > 1`为异常情况,`value < 0`按0处理,`value > 1`按1处理。
2、如果组件的图像使用异步加载,则不支持球面效果。例如Image组件默认使用异步加载,如果要使用球面效果,就要设置`syncLoad`为`true`,但是这种做法不推荐。`backgroundImage`也是使用异步加载,所以如果设置了`backgroundImage`,不支持球面效果。
3、如果组件设置了阴影,不支持球面效果。| + +## 示例 + +### 示例1 +```ts +// xxx.ets +@Entry +@Component +struct SphericalEffectExample { + build() { + Stack() { + TextInput({ placeholder: "请输入变化范围百分比([0%,100%])"}) + .width('50%') + .height(35) + .type(InputType.Number) + .enterKeyType(EnterKeyType.Done) + .caretColor(Color.Red) + .placeholderColor(Color.Blue) + .placeholderFont({ + size: 20, + style: FontStyle.Italic, + weight: FontWeight.Bold + }) + .sphericalEffect(0.5) + }.alignContent(Alignment.Center).width("100%").height("100%") + } +} + +``` +效果图如下: + +![textInputSpherical1](figures/textInputSpherical1.png) + +去掉sphericalEffect的设置,效果如下: + +![textInputSpherical2](figures/textInputSpherical2.png) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-ability.md b/zh-cn/application-dev/reference/errorcodes/errorcode-ability.md index 202bd9d425c7f583b5db8c075e6b3df57fc196f0..1ef393a59db3a5110c1510b8c4683812917fc0fa 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-ability.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-ability.md @@ -186,7 +186,7 @@ The context does not exist. 请检查上下文对象是否可用。 -## 16000012 上一个Ability未启动完成,先缓存在队列中等待后续启动。 +## 16000017 上一个Ability未启动完成,先缓存在队列中等待后续启动。 **错误信息** diff --git a/zh-cn/application-dev/reference/native-lib/Readme-CN.md b/zh-cn/application-dev/reference/native-lib/Readme-CN.md index 6ab376d22cdee59e3d8c3ba5b1c1a702012b1b92..f57483012a11397f554c2a01aad7c0872241faec 100644 --- a/zh-cn/application-dev/reference/native-lib/Readme-CN.md +++ b/zh-cn/application-dev/reference/native-lib/Readme-CN.md @@ -5,4 +5,5 @@ - 附录 - [Native api中没有导出的符号列表](third_party_libc/musl-peculiar-symbol.md) - [Native api中导出的EGL符号列表](third_party_opengl/egl-symbol.md) - - [Native api中导出的OpenGL ES 3.0符号列表](third_party_opengl/openglesv3-symbol.md) \ No newline at end of file + - [Native api中导出的OpenGL ES 3.0符号列表](third_party_opengl/openglesv3-symbol.md) + - [Native api中支持的OpenSL ES接口列表](third_party_opensles/opensles.md) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/native-lib/third_party_libc/musl.md b/zh-cn/application-dev/reference/native-lib/third_party_libc/musl.md index 3fc992e9a9b9a6c2096eec828766d270f4fb829c..611b370f28a5a3251c516bae6eff9aac450a1119 100644 --- a/zh-cn/application-dev/reference/native-lib/third_party_libc/musl.md +++ b/zh-cn/application-dev/reference/native-lib/third_party_libc/musl.md @@ -31,7 +31,7 @@ libdl:dlopen等动态链接器接口。 C标准函数库是在C语言程序设计中,所有符合标准的头文件的集合,以及常用的函数库实现程序(如I/O输入输出和字符串控制)。 -**musl** +**musl** [native api中没有导出的符号列表](musl-peculiar-symbol.md) @@ -53,6 +53,10 @@ C++11、C++14标准已完全支持,C++17和C++20标准正在完善。 [OpenSL ES](https://www.khronos.org/registry/OpenSL-ES/)是一个嵌入式跨平台的音频处理库。 +**支持的能力** + +[Native api中支持的OpenSL ES接口列表](../third_party_opensles/opensles.md) + ## zlib [Zlib](https://zlib.net/)是基于C/C++语言实现的一个通用的数据压缩库。 @@ -75,4 +79,6 @@ OpenGL ES 3.0 **标准库中导出的符号列表** -[native api中导出的OpenGL ES 3.0符号列表](../third_party_opengl/openglesv3-symbol.md) \ No newline at end of file +[native api中导出的OpenGL ES 3.0符号列表](../third_party_opengl/openglesv3-symbol.md) + + \ No newline at end of file diff --git a/zh-cn/application-dev/reference/native-lib/third_party_opensles/opensles.md b/zh-cn/application-dev/reference/native-lib/third_party_opensles/opensles.md new file mode 100644 index 0000000000000000000000000000000000000000..68ee1a999ca8455196707a29e6185af05b3f9cfb --- /dev/null +++ b/zh-cn/application-dev/reference/native-lib/third_party_opensles/opensles.md @@ -0,0 +1,29 @@ +# Native api中支持的OpenSL ES接口列表 + +## 简介 + +OpenSL ES(Open Sound Library for Embedded System)即嵌入式音频加速标准。为开发者提供了标准化、高性能以及低响应时间的音频功能开发的对象和接口。相对于开源免费的OpenSL ES,OpenHarmony基于[OpenSL ES](https://www.khronos.org/opensles/) 1.0.1 API规范实现了部分Native API,相关接口开放情况介绍如下: + +## 支持的API + +|对象 |对外接口 |接口调用详情 |是否支持 |说明 | +| ------------------ | -------------------- | -------------------------------------------------------------------------------------|----------| -------------------- | +|SLEngineItf |CreateAudioPlayer |CreateAudioPlayer(SLEngineItf self, SLObjectItf *pPlayer, SLDataSource *pAudioSrc, SLDataSink *pAudioSnk, SLuint32 numInterfaces, const SLInterfaceID *pInterfaceIds, const SLboolean *pInterfaceRequired) |是 |创建音频播放机。 | +|SLEngineItf |CreateAudioRecorder |reateAudioRecorder(SLEngineItf self, SLObjectItf *pRecorder, SLDataSource *pAudioSrc, SLDataSink *pAudioSnk, SLuint32 numInterfaces, const SLInterfaceID *pInterfaceIds, const SLboolean *pInterfaceRequired)|是 |创建音频录制器。 | +|SLEngineItf |CreateAudioOutputMix |CreateOutputMix(SLEngineItf self, SLObjectItf *pMix, SLuint32 numInterfaces, const SLInterfaceID *pInterfaceIds, const SLboolean *pInterfaceRequired)|是 |创建混音器。 | +|SLObjectItf |Realize |Realize(SLObjectItf self, SLboolean async) |是 |创建音频播放机。 | +|SLObjectItf |getState |GetState(SLObjectItf self, SLuint32 *state) |是 |获取状态。 | +|SLObjectItf |getInterface |GetInterface(SLObjectItf self, const SLInterfaceID iid, void *interface) |是 |获取接口。 | +|SLObjectItf |Destroy |Destroy(SLObjectItf self) |是 |销毁对象。 | +|SLOHBufferQueueItf |Enqueue |Enqueue(SLOHBufferQueueItf self, const void *buffer, SLuint32 size) |是 |将buffer加入实际队列中。| +|SLOHBufferQueueItf |clear |Clear(SLOHBufferQueueItf self) |是 |释放buffer队列 | +|SLOHBufferQueueItf |getState |GetState(SLOHBufferQueueItf self, SLOHBufferQueueState *state) |是 |获取BufferQueue状态。 | +|SLOHBufferQueueItf |getBuffer |GetBuffer(SLOHBufferQueueItf self, SLuint8 **buffer, SLuint32 *size) |是 |获取buffer。 | +|SLOHBufferQueueItf |RegisterCallback |RegisterCallback(SLOHBufferQueueItf self, SlOHBufferQueueCallback callback, void *pContext) |是 |注册回调函数。 | +|SLPlayItf |SetPlayState |SetPlayState(SLPlayItf self, SLuint32 state) |是 |设置播放状态。 | +|SLPlayItf |GetPlayState |GetPlayState(SLPlayItf self, SLuint32 *state) |是 |获取播放状态。 | +|SLRecordItf |SetRecordState |SetRecordState(SLRecordItf self, SLuint32 state) |是 |设置录制状态。 | +|SLRecordItf |GetRecordState |GetRecordState(SLRecordItf self, SLuint32 *pState) |是 |获取录制状态。 | +|SLVolumeItf |SetVolumeLevel |SetVolumeLevel(SLVolumeItf self, SLmillibel *level) |是 |设置音量。 | +|SLVolumeItf |GetVolumeLevel |GetVolumeLevel(SLVolumeItf self, SLmillibel level) |是 |获取音量。 | +|SLVolumeItf |GetMaxVolumeLevel |GetMaxVolumeLevel(SLVolumeItf self, SLmillibel *maxLevel) |是 |获取最大音量。 | \ No newline at end of file diff --git a/zh-cn/device-dev/subsystems/Readme-CN.md b/zh-cn/device-dev/subsystems/Readme-CN.md index ada771ceab4cca745ffee93a9455450bb83d278b..b39c84c5716a3521e6514f15dc638c9cc94ad221 100644 --- a/zh-cn/device-dev/subsystems/Readme-CN.md +++ b/zh-cn/device-dev/subsystems/Readme-CN.md @@ -38,7 +38,9 @@ - [音视频播放开发指导](subsys-multimedia-video-play-guide.md) - [音视频录制开发指导](subsys-multimedia-video-record-guide.md) - [公共基础库开发指导](subsys-utils-guide.md) -- [AI框架开发指导](subsys-ai-aiframework-devguide.md) +- AI服务 + - [AI框架开发指导](subsys-ai-aiframework-devguide.md) + - [NNRt开发指导](subsys-ai-nnrt-guide.md) - Sensor服务 - [Sensor服务概述](subsys-sensor-overview.md) - [Sensor服务使用指导](subsys-sensor-guide.md) diff --git a/zh-cn/device-dev/subsystems/figures/nnrt_arch_diagram.png b/zh-cn/device-dev/subsystems/figures/nnrt_arch_diagram.png new file mode 100644 index 0000000000000000000000000000000000000000..d0a721c2156ddb3c0df79feec763a8dfe6680c5d Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/nnrt_arch_diagram.png differ diff --git a/zh-cn/device-dev/subsystems/figures/nnrt_dev_flow.png b/zh-cn/device-dev/subsystems/figures/nnrt_dev_flow.png new file mode 100644 index 0000000000000000000000000000000000000000..ab008db12eaae364195d7097b02af5a6f624c325 Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/nnrt_dev_flow.png differ diff --git a/zh-cn/device-dev/subsystems/subsys-ai-nnrt-guide.md b/zh-cn/device-dev/subsystems/subsys-ai-nnrt-guide.md new file mode 100644 index 0000000000000000000000000000000000000000..d36d0755a47b526ff2210491de23201678b4c75c --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-ai-nnrt-guide.md @@ -0,0 +1,386 @@ +# NNRt设备开发指导 + +## 概述 + +### 功能简介 + +NNRt(Neural Network Runtime,神经网络运行时)是面向AI领域的跨芯片推理计算运行时,作为中间桥梁连通上层AI推理框架和底层加速芯片,实现AI模型的跨芯片推理计算。 + +NNRt开放了设备接口,芯片厂商通过设备接口将专有加速芯片接入NNRt,实现接入OpenHarmony的社区生态,以下将介绍芯片如何接入NNRt。 + +### 基本概念 +在开发前,开发者需要先了解以下概念,以便更好地理解全文内容: + +- HDI(Hardware Device Interface):OpenHarmony硬件设备接口,定义系统中跨进程通信的接口,实现服务间的跨进程通信。 +- IDL(Interface Description Language):接口描述语言,是HDI接口的语言格式。 + +### 约束与限制 +- 系统版本:OpenHarmony主干版本。 +- 开发环境:Ubuntu 18.04及以上。 +- 接入设备:具备AI计算能力的芯片。 + +### 运作机制 +NNRt通过HDI接口实现与设备芯片的对接,由HDI接口实现跨进程通信。 + +**图1** NNRt架构图 + +![架构图](./figures/nnrt_arch_diagram.png) + +整个架构主要分为三层,AI应用在应用层,AI推理框架和NNRt在系统层,设备服务在芯片层。AI应用如要使用专用加速芯片模型推理,需要经过AI推理框架和NNRt才能调用到底层专用加速芯片,而NNRt就是负责适配底层各种专用加速芯片,它开放了标准统一的设备接口,众多的第三方芯片设备都可以通过HDI接口接入OHOS。 + +程序运行时,AI应用、AI推理框架、NNRt都在用户进程中,底层设备服务在服务进程中,NNRt根据HDI接口实现了HDI Client,服务端也需要根据HDI接口实现HDI Service,使得两个进程间能够跨进程通信。 + +## NNRt开发指导 + +### 场景介绍 +当需要将一款AI加速芯片接入NNRt的时候,可以参考下文,下文以rk3568芯片为例,展示rk3568 CPU如何通过HDI接口接入NNRt,并完成AI模型推理。 +> 依赖说明:该教程展示的rk3568 CPU接入NNRt并没有实际去写CPU的驱动,而是借用了Mindspore-Lite的CPU算子,故会依赖MindSpore-Lite的动态库以及头文件,实际开发时并不需要依赖MindSpore-Lite的任何库或者头文件。 + +### 开发流程 +专用加速芯片接入NNRt的整体流程如下: + +**图2** 专用加速芯片接入NNRt流程 + +![开发流程](./figures/nnrt_dev_flow.png) + +### 开发步骤 +开发者具体可通过以下步骤实现芯片对接NNRt: +1. 开源社区下载OpenHarmony的代码,编译drivers_interface部件,生成HDI接口的头文件。 + + 1. [下载源码](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)。 + + 2. 编译接口IDL文件。 + ```shell + ./build.sh --product-name productname –ccache --build-target drivers_interface_nnrt + ``` + > productname为产品名称,此处为rk3568. + + 编译完成后,在```out/rk3568/gen/drivers/interface/nnrt```目录下生成HDI头文件,默认语言类型为C++;若需要生成C类型的头文件,请在编译之前使用如下命令对```drivers/interface/nnrt/v1_0/BUILD.gn```文件中的```language```配置项进行设置。 + + ```shell + language = "c" + ``` + + 生成头文件目录如下所示: + ```text + out/rk3568/gen/drivers/interface/nnrt + └── v1_0 + ├── drivers_interface_nnrt__libnnrt_proxy_1.0_external_deps_temp.json + ├── drivers_interface_nnrt__libnnrt_stub_1.0_external_deps_temp.json + ├── innrt_device.h # 设备接口头文件 + ├── iprepared_model.h # 编译AI模型对象头文件 + ├── libnnrt_proxy_1.0__notice.d + ├── libnnrt_stub_1.0__notice.d + ├── model_types.cpp # AI模型结构定义实现文件 + ├── model_types.h # AI模型结构定义头文件 + ├── nnrt_device_driver.cpp # 设备驱动实现参考样例 + ├── nnrt_device_proxy.cpp + ├── nnrt_device_proxy.h + ├── nnrt_device_service.cpp # 设备服务端实现参考样例 + ├── nnrt_device_service.h # 设备服务端头文件 + ├── nnrt_device_stub.cpp + ├── nnrt_device_stub.h + ├── nnrt_types.cpp # 数据类型定义实现文件 + ├── nnrt_types.h # 数据类型定义头文件 + ├── node_attr_types.cpp # AI模型算子属性定义实现文件 + ├── node_attr_types.h # AI模型算子属性定义 + ├── prepared_model_proxy.cpp + ├── prepared_model_proxy.h + ├── prepared_model_service.cpp # 编译AI模型对象服务端实现参考样例 + ├── prepared_model_service.h # 编译AI模型对象服务端头文件 + ├── prepared_model_stub.cpp + └── prepared_model_stub.h + ``` + +2. 实现HDI服务。 + + 1. 在drivers/peripheral目录下新建开发目录,用于HDI服务开发,开发目录结构如下所示。 + ```text + drivers/peripheral/nnrt + ├── BUILD.gn # 代码编译脚本文件 + ├── bundle.json + └── hdi_cpu_service # 自定义目录 + ├── BUILD.gn # 代码编译脚本文件 + ├── include + │   ├── nnrt_device_service.h # 设备服务端头文件 + │   ├── node_functions.h # 非必须,由具体实现决定 + │   ├── node_registry.h # 非必须,由具体实现决定 + │   └── prepared_model_service.h # 编译AI模型对象服务端头文件 + └── src + ├── nnrt_device_driver.cpp # 设备驱动实现文件 + ├── nnrt_device_service.cpp # 设备服务端实现文件 + ├── nnrt_device_stub.cpp # 非必须,由具体实现决定 + ├── node_attr_types.cpp # 非必须,由具体实现决定 + ├── node_functions.cpp # 非必须,由具体实现决定 + ├── node_registry.cpp # 非必须,由具体实现决定 + └── prepared_model_service.cpp # 编译AI模型对象服务端实现文件 + ``` + + 2. 实现设备驱动,无特殊需求可直接使用步骤1中生成的nnrt_device_driver.cpp文件,否则根据具体驱动开发。 + 3. 实现服务接口,可参考nnrt_device_service.cpp和prepared_model_service.cpp实现文件,接口定义可以参考[NNRt的HDI接口定义](https://gitee.com/openharmony/drivers_interface/tree/master/nnrt)。 + + 4. 编译驱动和服务的实现文件为共享库。 + + 在```drivers/peripheral/nnrt/hdi_cpu_service/```下新建```BUILD.gn```文件,文件内容如下所示,相关参数配置内容可参考[Build教程](https://gitee.com/openharmony/build). + + ```shell + import("//build/ohos.gni") + import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") + + ohos_shared_library("libnnrt_service_1.0") { + include_dirs = [] + sources = [ + "src/nnrt_device_service.cpp", + "src/prepared_model_service.cpp", + "src/node_registry.cpp", + "src/node_functions.cpp", + "src/node_attr_types.cpp" + ] + public_deps = [ "//drivers/interface/nnrt/v1_0:nnrt_idl_headers" ] + external_deps = [ + "hdf_core:libhdf_utils", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", + "c_utils:utils", + ] + + install_images = [ chipset_base_dir ] + subsystem_name = "hdf" + part_name = "drivers_peripheral_nnrt" + } + + ohos_shared_library("libnnrt_driver") { + include_dirs = [] + sources = [ "src/nnr_device_driver.cpp" ] + deps = [ "//drivers/peripheral/nnrt/hdi_cpu_service:libnnrt_service_1.0" ] + + external_deps = [ + "hdf_core:libhdf_host", + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", + "c_utils:utils", + ] + + install_images = [ chipset_base_dir ] + subsystem_name = "hdf" + part_name = "drivers_peripheral_nnrt" + } + + group("hdf_nnrt_service") { + deps = [ + ":libnnrt_driver", + ":libnnrt_service_1.0", + ] + } + ``` + + 将```group("hdf_nnrt_service")```添加到```drivers/peripheral/nnrt/BUILD.gn```文件中,以便在更上目录层级就能引用。 + ```shell + if (defined(ohos_lite)) { + group("nnrt_entry") { + deps = [ ] + } + } else { + group("nnrt_entry") { + deps = [ + "./hdi_cpu_service:hdf_nnrt_service", + ] + } + } + ``` + + 新建```drivers/peripheral/nnrt/bundle.json```用于定义新增的```drivers_peripheral_nnrt```部件。 + ```json + { + "name": "drivers_peripheral_nnrt", + "description": "Neural network runtime device driver", + "version": "3.2", + "license": "Apache License 2.0", + "component": { + "name": "drivers_peripheral_nnrt", + "subsystem": "hdf", + "syscap": [""], + "adapter_system_type": ["standard"], + "rom": "1024KB", + "ram": "2048KB", + "deps": { + "components": [ + "ipc", + "hdf_core", + "hiviewdfx_hilog_native", + "c_utils" + ], + "third_part": [ + "bounds_checking_function" + ] + }, + "build": { + "sub_component": [ + "//drivers/peripheral/nnrt:nnrt_entry" + ], + "test": [ + ], + "inner_kits": [ + ] + } + } + } + ``` + +3. 声明HDI服务。 + + 在对应产品的uhdf hcs配置文件中声明用户态驱动与服务,例如,针对rk3568服务需要在```vendor/hihope/rk3568/hdf_config/uhdf/device_info.hcs```文件中新增如下配置: + ```text + nnrt :: host { + hostName = "nnrt_host"; + priority = 50; + uid = ""; + gid = ""; + caps = ["DAC_OVERRIDE", "DAC_READ_SEARCH"]; + nnrt_device :: device { + device0 :: deviceNode { + policy = 2; + priority = 100; + moduleName = "libnnrt_driver.z.so"; + serviceName = "nnrt_device_service"; + } + } + } + ``` + > 注意:修改hcs文件需要删除out目录重新编译,才能生效。 + +4. 配置host进程用户和组。 + + 对于新增的nnrt_host进程的场景,需要配置对应进程的用户ID和组ID。 进程的用户ID在文件```base/startup/init/services/etc/passwd```中配置,进程的组ID在文件```base/startup/init/services/etc/group```中配置。 + ```text + # 在base/startup/init/services/etc/passwd新增 + nnrt_host:x:3311:3311:::/bin/false + + # 在base/startup/init/services/etc/group新增 + nnrt_host:x:3311: + ``` + +5. SeLinux配置。 + + OHOS已经开启SELinux特性,需要对新增的进程和服务配置相应的SELinux规则,用于运行host进程启动访问某些资源、发布HDI服务。 + + 1. 在```base/security/selinux/sepolicy/ohos_policy/drivers/adapter/vendor/type.te```文件中配置nnrt_host进程安全上下文,新增配置如下: + ```text + # 新增配置 + type nnrt_host, hdfdomain, domain; + ``` + > nnrt_host为上文配置的进程名称。 + + 2. 由于SeLinux是白名单访问的权限机制,需要根据实际权限需求配置,将服务启动起来之后,通过以下dmesg命令可能查看avc告警, + avc告警会给出缺少的权限,SeLinux的配置也可以参考[OpenHarmony SeLinux子系统的说明](https://gitee.com/openharmony/security_selinux/blob/master/README.md)。 + ```shell + hdc_std shell + dmesg | grep nnrt + ``` + + 3. 新建nnrt_host.te配置文件,将权限配置到nnrt_host.te文件中。 + ```shell + # 创建nnrt文件夹 + mkdir base/security/selinux/sepolicy/ohos_policy/drivers/peripheral/nnrt + + # 创建vendor文件夹 + mkdir base/security/selinux/sepolicy/ohos_policy/drivers/peripheral/nnrt/vendor + + # 创建nnrt_host.te文件 + touch base/security/selinux/sepolicy/ohos_policy/drivers/peripheral/nnrt/vendor/nnrt_host.te + ``` + + 4. 将所需的权限写入nnrt_host.te文件中,比如: + ```text + allow nnrt_host dev_hdf_kevent:chr_file { ioctl }; + allow nnrt_host hilog_param:file { read }; + allow nnrt_host sh:binder { transfer }; + allow nnrt_host dev_ashmem_file:chr_file { open }; + allow sh nnrt_host:fd { use }; + ``` + +6. 删除out目录编译整个系统。 + ```shell + # 删除out目录 + rm -rf ./out + + # 编译 + ./build.sh --product-name rk3568 –ccache --jobs=4 + ``` + + +### 调测验证 +服务开发完成后,可以使用XTS用例验证基本功能和兼容性,开发者可通过以下步骤进行验证: +1. 编译NNRt的hats用例,用例在```test/xts/hats/hdf/nnrt```目录下。 + ```shell + # 进入hats目录 + cd test/xts/hats + + # 编译hats测试用例 + ./build.sh suite=hats system_size=standard --product-name rk3568 + + # 回到代码根目录 + cd - + ``` + 编译好的测试用例会输出到相对代码根目录的```out/rk3568/suites/hats/testcases/HatsHdfNnrtFunctionTest```路径下。 + +2. 将测试用例push到设备上。 + ```shell + # 将测试用例可执行文件推送到设备上,HatsHdfNnrtFunctionTest是测试用例可执行文件。 + hdc_std file send out/rk3568/suites/hats/testcases/HartsHdfNnrtFunctionTest /data/local/tmp/ + + # 给测试用例可执行文件加上权限。 + hdc_std shell "chmod +x /data/local/tmp/HatsHdfNnrtFunctionTest" + ``` + +3. 执行用例并查看结果。 + ```shell + # 执行测试用例 + hdc_std shell "/data/local/tmp/HatsHdfNnrtFunctionTest" + ``` + + 所有hats用例执行成功,可以看到测试报告通过47个用例,说明服务通过了兼容性测试。 + ```text + ... + [----------] Global test environment tear-down + Gtest xml output finished + [==========] 47 tests from 3 test suites ran. (515 ms total) + [ PASSED ] 47 tests. + ``` + +### 开发实例 +完整Demo代码可以参考[社区实现](https://gitee.com/openharmony/ai_neural_network_runtime/tree/master/example/drivers)。 +1. 拷贝```example/driver/nnrt```目录到```drivers/peripheral```路径下。 + ```shell + cp -r example/driver/nnrt drivers/peripheral + ``` +2. 补充bundle.json文件到```drivers/peripheral/nnrt```,bundle.json参考本教程上面的[开发步骤](#开发步骤)章节。 +3. 由于Demo依赖MindSpore-Lite CPU算子,故需要添加MindSpore-Lite依赖文件。 + - 下载MindSpore-Lite的头文件,[mindspore 1.5.0](https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.5.0/MindSpore/lite/release/linux/mindspore-lite-1.5.0-linux-x64.tar.gz)。 + - 在```drivers/peripheral/nnrt```目录下新建mindspore目录,用于存放mindspore依赖库和头文件。 + ```shell + mkdir drivers/peripheral/nnrt/mindspore + ``` + - 解压mindspore-lite-1.5.0-linux-x64.tar.gz文件,将```runtime/include```目录拷贝到```drivers/peripheral/nnrt/mindspore```目录下。 + - Demo还依赖mindspore的schema文件。 + ```shell + # 创建mindspore_schema目录 + mkdir drivers/peripheral/nnrt/hdi_cpu_service/include/mindspore_schema + + # 拷贝mindspore schema文件 + cp third_party/mindspore/mindspore/lite/schema/* drivers/peripheral/nnrt/hdi_cpu_service/include/mindspore_schema/ + ``` + - 编译MindSpore-Lite的动态库,并将动态库放到mindspore目录下。 + ```shell + # 编译mindspore动态库 + ./build.sh --product-name rk3568 -ccaache --jobs 4 --build-target mindspore_lib + + # 将mindspore动态库 + mkdir drivers/peripheral/nnrt/mindspore/mindspore + + # 将mindspore动态拷贝到drivers/peripheral/nnrt/mindspore/mindspore。 + cp out/rk3568/package/phone/system/lib/libmindspore-lite.huawei.so drivers/peripheral/nnrt/mindspore/mindspore/ + ``` + 4. 其他配置请参考本教程上面的[开发步骤](#开发步骤)章节。 \ No newline at end of file diff --git a/zh-cn/device-dev/subsystems/subsys-build-component-building-rules.md b/zh-cn/device-dev/subsystems/subsys-build-component-building-rules.md index 7b4c0ea74e43d12e29c0eefe31bd87274e6ac047..e7333059216749fcd6cac36e31d4e7e3da3b8448 100644 --- a/zh-cn/device-dev/subsystems/subsys-build-component-building-rules.md +++ b/zh-cn/device-dev/subsystems/subsys-build-component-building-rules.md @@ -105,7 +105,7 @@ bundle.json是定义部件的描述文件,包含了部件的根目录、名称 | 字段 | 类型 | 看护手段 | |---|---|---| -|name|string。部件的HPM(鸿蒙包管理器)包名称,必填。命名规则:@{organization}/{component_name}。"component_name"为部件的名称,须满足规则1.1。|静态检查| +|name|string。部件的HPM(OpenHarmony包管理器)包名称,必填。命名规则:@{organization}/{component_name}。"component_name"为部件的名称,须满足规则1.1。|静态检查| |version|string。部件版本号,必填,命名和升级跟随OpenHarmony版本号。|静态检查| |destPath|string。部件源码的根目录,必填。部件的根目录须独立唯一,不允许存在多个根目录。|静态检查| |component:name|string。部件名,必填。须满足规则1.1。|静态检查| diff --git a/zh-cn/device-dev/subsystems/subsys-security-huks-guide.md b/zh-cn/device-dev/subsystems/subsys-security-huks-guide.md index e019d626238f9516e78fc512228e79b7facdd9ff..606c7df8fa0bcce378ca4e234d4df3b622f7e665 100644 --- a/zh-cn/device-dev/subsystems/subsys-security-huks-guide.md +++ b/zh-cn/device-dev/subsystems/subsys-security-huks-guide.md @@ -84,6 +84,7 @@ HUKS Core作为向应用提供密钥库能力的基础,包括密钥管理及 | [HuksHdiGetKeyProperties()](#hukshdigetkeyproperties) | 获取密钥属性。 |无 | getKeyProperties(keyAlias: string, options: HuksOptions)| | [HuksHdiAttestKey()](#hukshdiattestkey) | 获取密钥证书。 |出参要遵循certChain格式 | attestKey(keyAlias: string, options: HuksOptions)| | [HuksHdiExportChipsetPlatformPublicKey()](#hukshdiexportchipsetplatformpublickey) | 导出芯片平台级密钥对的公钥。 | 出参为ECC P256的x y轴值裸数据,各32字节 | 无 | +| [HuksHdiUpgradeKey()](#hukshdiupgradekey) | 升级密钥文件。 | 无 | 无 | - - - @@ -602,6 +603,40 @@ HUKS Core的初始化,包括锁,加密算法库,authtoken key和根密钥 - - - +#### HuksHdiUpgradeKey + +**接口描述** + +升级密钥文件。当密钥文件版本号小于最新版本号时,触发该升级能力。 + +**接口原型** +
int32_t (*HuksHdiUpgradeKey)(const struct HksBlob *oldKey, const struct HksParamSet *paramSet, struct HksBlob *newKey);
+ +
+ 参数说明 +
+  const struct HksBlob *oldKey
+  待升级的密钥文件数据
+  

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

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

+ +
+ 返回值 + + - HKS_SUCCESS:成功 + + - 其他:失败 +
+ +- - - + ### 开发步骤 HDI接口到HUKS Core的适配在以下目录中: diff --git a/zh-cn/device-dev/website.md b/zh-cn/device-dev/website.md index 8585b5294294a8c3a86b0fc73f69997332486bd2..acf6bc882e0f63f45e16b7ecf0c2499d9cf0ca18 100644 --- a/zh-cn/device-dev/website.md +++ b/zh-cn/device-dev/website.md @@ -417,7 +417,9 @@ - [音视频播放开发指导](subsystems/subsys-multimedia-video-play-guide.md) - [音视频录制开发指导](subsystems/subsys-multimedia-video-record-guide.md) - [公共基础库开发指导](subsystems/subsys-utils-guide.md) - - [AI框架开发指导](subsystems/subsys-ai-aiframework-devguide.md) + - AI服务 + - [AI框架开发指导](subsystems/subsys-ai-aiframework-devguide.md) + - [NNRt开发指导](subsystems/subsys-ai-nnrt-guide.md) - Sensor服务 - [Sensor服务概述](subsystems/subsys-sensor-overview.md) - [Sensor服务使用指导](subsystems/subsys-sensor-guide.md) diff --git a/zh-cn/readme/ARK-Runtime-Subsystem-zh.md b/zh-cn/readme/ARK-Runtime-Subsystem-zh.md index 514bbb14842b9aa7846e18e4aa209d2b699f86bd..109c85f387afb3bf745110d453911ed7e8442452 100644 --- a/zh-cn/readme/ARK-Runtime-Subsystem-zh.md +++ b/zh-cn/readme/ARK-Runtime-Subsystem-zh.md @@ -8,7 +8,7 @@ ## 简介 -方舟编译器\(ArkCompiler\)是为支持多种编程语言、多种芯片平台的联合编译、运行而设计的统一编译运行时平台。它支持包括动态类型和静态类型语言在内的多种编程语言,如JS、TS、ArkTS;它是支撑鸿蒙系统成为打通手机、PC、平板、电视、车机和智能穿戴等多种设备的操作系统的编译运行时底座。 +方舟编译器\(ArkCompiler\)是为支持多种编程语言、多种芯片平台的联合编译、运行而设计的统一编译运行时平台。它支持包括动态类型和静态类型语言在内的多种编程语言,如JS、TS、ArkTS;它是支撑OpenHarmony系统成为打通手机、PC、平板、电视、车机和智能穿戴等多种设备的操作系统的编译运行时底座。 ArkCompiler主要分成两个部分:编译工具链与运行时. @@ -57,7 +57,7 @@ ArkCompiler运行时直接运行字节码文件,实现对应语言规范的语 - 原生支持TypeScript: ECMAScript规范没有提供并发语义表述;业界引擎,如浏览器或者Node.js,通常会提供基于Actor并发模型的Worker API来支持多线程开发。Actor模型下执行体之间不共享任何数据对象,通过消息机制进行通信。因此Web引擎或者Node.js引擎的Worker都有启动速度慢、内存占用高这些缺陷。 针对这些缺陷,ArkCompiler的运行时已经实现了Actor实例中的不可变或者不易变的对象(方法和字节码)的共享,较大程度地优化了Actor的启动性能和启动内存。 - 方舟编译运行时不只提供了业界通用的Worker API,还提供了TaskPool作为并发API的增强。TaskPool是一个支持优先级调度、工作线程自动扩缩容的任务池功能库。开发者无需关心并发实例的生命周期,也无需关心任务负载变化时需要创建或者销毁并发实例,极大地简化了高性能多线程鸿蒙应用的开发。 + 方舟编译运行时不只提供了业界通用的Worker API,还提供了TaskPool作为并发API的增强。TaskPool是一个支持优先级调度、工作线程自动扩缩容的任务池功能库。开发者无需关心并发实例的生命周期,也无需关心任务负载变化时需要创建或者销毁并发实例,极大地简化了高性能多线程OpenHarmony应用的开发。 - 安全 @@ -75,7 +75,7 @@ ArkCompiler运行时直接运行字节码文件,实现对应语言规范的语 ## 使用指南 -[方舟运行时使用指南](https://gitee.com/openharmony/arkcompiler_ets_runtime/blob/master/docs/ARK-Runtime-Usage-Guide-zh.md) +[方舟运行时使用指南](https://gitee.com/openharmony/arkcompiler_ets_runtime/blob/master/docs/README_zh.md) ## 相关仓 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 22be4e935cf4b4388efdb3f4c443ff4ca7ad7c29..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,7 +1,7 @@ # OpenHarmony JS和TS三方组件使用指导 ## OpenHarmony JS和TS三方组件介绍 -OpenHarmony JS和TS三方组件使用的是OpenHarmony静态共享包,即HAR(Harmony Archive),可以包含js/ts代码、c++库、资源和配置文件。通过HAR,可以实现多个模块或者多个工程共享ArkUI组件、资源等相关代码。HAR不同于HAP,不能独立安装运行在设备上,只能作为应用模块的依赖项被引用。 +OpenHarmony JS和TS三方组件是以OpenHarmony npm包的形式,在传统的npm三方组件的基础上,定义了OpenHarmony npm共享包特定的工程结构和配置文件,支持OpenHarmony页面组件相关API、资源的调用。通过OpenHarmony npm包,可以实现多个模块或者多个工程共享OpenHarmony页面、资源等相关代码。前往[npm官方文档](https://docs.npmjs.com/about-npm),可以了解和掌握npm的基础功能和机制。 @@ -11,164 +11,41 @@ OpenHarmony JS和TS三方组件使用的是OpenHarmony静态共享包,即HAR(H -2. 访问[OpenHarmony官网](https://growing.openharmony.cn/mainPlay/tpc),通过类型,分类,以及关键字搜索需要的三方组件。 +2. 访问[OpenHarmony官网](https://www.openharmony.cn/mainPlay/tpc),通过类型,分类,以及关键字搜索需要的三方组件。 ![official-website.png](official-website.png) ## 安装并使用OpenHarmony JS和TS语言的三方组件 -引用三方HAR,包括从仓库进行安装和从本地库模块中进行安装两种方式。 - -**引用仓库安装的HAR** - -引用ohpm仓中的HAR,首先需要设置三方HAR的仓库信息,DevEco Studio默认仓库地址是"https://repo.harmonyos.com/ohpm/",如果您想设置自定义仓库,请在DevEco Studio的Terminal窗口执行如下命令进行设置(执行命令前,请确保将DevEco Studio中ohpm安装地址配置在“环境变量-系统变量-PATH”中): -``` -ohpm config set registry=your_registry1,your_registry2 -``` -说明:ohpm支持多个仓库地址,采用英文逗号分隔。 -然后通过如下两种方式设置三方包依赖信息: - - 方式一:在Terminal窗口中,执行如下命令安装三方包,DevEco Studio会自动在工程的oh-package.json5中自动添加三方包依赖。 -``` -ohpm install @ohos/lottie --save -``` - - 方式二:在工程的oh-package.json5中设置三方包依赖,配置示例如下: -``` -"dependencies": { "@ohos/lottie": "^2.0.0"} -``` -依赖设置完成后,需要执行ohpm install命令安装依赖包,依赖包会存储在工程的oh_modules目录下。 -``` -ohpm install -``` - -**引用本地库模块的文件和资源** - -- 方式一:在Terminal窗口中,执行如下命令进行安装,并会在oh-package5.json中自动添加依赖。 -``` -ohpm install ../library --save -``` -- 方式二:在工程的oh-package.json5中设置三方包依赖,配置示例如下: -``` -"dependencies": { - "@ohos/library": "file:../library" -} -``` -依赖设置完成后,需要执行ohpm install命令安装依赖包,依赖包会存储在工程的oh_modules目录下。 -``` -ohpm install -``` - -> **说明:** -> -> 在引用OpenHarmony HAR时,请注意以下事项 ->- 当前只支持在模块和工程下的oh-package.json5文件中声明dependencies依赖,才会被当做OpenHarmony依赖使用,并在编译构建过程中进行相应的处理。 ->- 引用的模块的compileSdkVersion不能低于其依赖的OpenHarmony ohpm三方包(可在oh_modules目录下,找到引用的ohpm包的src > main > module.json5 中查看)。 - - - -### 引用OpenHarmony HAR hml页面 -在JS工程范式中,组件功能由hml承载,开发者可以在JS工程的hml页面通过标签来引入OpenHarmony HAR中的共享hml页面,示例如下: -``` - -``` -其中,@ohos/library为OpenHarmony HAR的包名,hml页面的路径为OpenHarmony HAR中的相对路径。 -随后便可以通过设置的name来使用该element元素,以引用OpenHarmony HAR中的hml页面,示例如下: -```typescript - - -
- - - {{ $t('strings.hello') }} {{ title }} - -
-``` -### 引用OpenHarmony HAR ArkTS页面 -ArkTS是TypeScript的扩展,因此导出和引入的语法与TypeScript一致。在OpenHarmony ohpm模块中,可以通过export导出ArkTS页面,示例如下: -```typescript -// library/src/main/ets/components/MainPage/MainPage.ets -@Entry -@Component -export struct MainPage { - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } .height('100%') - } -} -``` -然后在其它模块中通过import引入导出的ArkTS页面,示例如下所示: -```typescript -// entry/MainAbility/pages/index.ets - -import { MainPage } from "@ohos/library" -@Entry -@Component -struct Index { - @State message: string = 'Hello World' - build() { - Column() { - MainPage() - Row() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('10%') - } -} -``` -引用OpenHarmony HAR内ts/js方法ts/js方法的导出和引用,与ArkTS页面的引用相同,即在OpenHarmony ohpm模块中,可以通过export导出ts/js方法,示例如下所示: -```typescript -// library/index.js -export function func() { - return "[ohpm] func1"; -} -``` -然后在其它的ts/js页面中,通过import引入导出的ts/js方法,示例如下所示: -```typescript -// entry/src/main/js/MainAbility/pages/index/index.js -import {func} from "@ohos/library" -export default { - data: { - title: "" - }, - onInit() { - this.title = func(); - } -} -``` -引用OpenHarmony HAR内资源支持在OpenHarmony ohpm模块和依赖OpenHarmony ohpm的模块中引用OpenHarmony ohpm模块内的资源。例如在OpenHarmony ohpm模块的scr/main/resources里添加字符串资源(在string.json中定义,name:hello_ohpm)和图片资源(icon_ohpm.png)。然后在Entry模块中引用该字符串资源和图片资源的示例如下: -当前暂不支持类Web范式引用i18n文件中的国际化资源。 -```typescript -// entry/src/main/ets/MainAbility/pages/index.ets -@Entry -@Component -struct Index { - @State message: string = 'Hello World' - build() { - Column() { - Row() { - Text($r("app.string.hello_ohpm")) // 字符串资源 - .fontSize(40) - .fontWeight(FontWeight.Bold) - } - .width('50%') - Image($r("app.media.icon_ohpm")) // 图片资源 - } - .height('100%') +在应用开发的过程中,JS和TS语言的三方组件,通常以源码或OpenHarmony npm包的方式被引入使用。按照以下步骤即可将OpenHarmony npm包引入应用并使用,源码的具体引入及使用请参考各三方组件README.md指导介绍。 + +1. 配置OpenHarmony npm环境,详情请参考安装教程 [如何安装OpenHarmony npm包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_npm_usage.md)。 + +2. 在Terminal项目终端中,进入entry目录,并执行目标组件命令进行安装。具体的下载命令详见OpenHarmony官网该三方组件的“下载安装“模块。 + + 以安装[vcard三方组件](https://growing.openharmony.cn/mainPlay/libraryMaps/vcard_595)为例,找到“下载安装”模块获取其安装命令,并执行该命令安装: + + ![npm-usage1.png](npm-usage1.png) + + ![npm-usage2.png](npm-usage2.png) + +3. 下载完成后在项目文件下自动生成node_modules文件,下载的三方库即node_modules目录下的@ohos\VCard。 + + ![npm-usage3.png](npm-usage3.png) + +4. 在package.json中会自动添加如下依赖: + + ``` + "dependencies": { + "@ohos/vcard": "^2.0.5" } -} -``` -在编译构建HAP中,DevEco Studio会从HAP模块及依赖的模块中收集资源文件,如果不同模块的相同限定词目录下的资源文件出现重名冲突时,DevEco Studio会按照以下优先级进行覆盖(优先级由高到低): -- AppScope(仅API 9的Stage模型支持) -- HAP包自身模块 -- 依赖的OpenHarmonyHarmony ohpm模块 \ No newline at end of file + ``` + +5. 在需要使用该组件的文件中导入组件。 + + ![npm-usage4.png](npm-usage4.png) + +6. 导入组件后直接使用方法即可。 + + ![npm-usage5.png](npm-usage5.png) \ No newline at end of file diff --git a/zh-cn/third-party-components/npm-usage1.png b/zh-cn/third-party-components/npm-usage1.png new file mode 100644 index 0000000000000000000000000000000000000000..9dc9a72717182136e77d620c90e45669c4059043 Binary files /dev/null and b/zh-cn/third-party-components/npm-usage1.png differ diff --git a/zh-cn/third-party-components/npm-usage2.png b/zh-cn/third-party-components/npm-usage2.png new file mode 100644 index 0000000000000000000000000000000000000000..ce9e34ec18125ff473ad48667808081adc1a95d7 Binary files /dev/null and b/zh-cn/third-party-components/npm-usage2.png differ diff --git a/zh-cn/third-party-components/npm-usage3.png b/zh-cn/third-party-components/npm-usage3.png new file mode 100644 index 0000000000000000000000000000000000000000..66b6a14069cec3caaa42c0007f7b12ff09773f6f Binary files /dev/null and b/zh-cn/third-party-components/npm-usage3.png differ diff --git a/zh-cn/third-party-components/npm-usage4.png b/zh-cn/third-party-components/npm-usage4.png new file mode 100644 index 0000000000000000000000000000000000000000..8cd881a7ddf90aed5570411c943794829c2fa24d Binary files /dev/null and b/zh-cn/third-party-components/npm-usage4.png differ diff --git a/zh-cn/third-party-components/npm-usage5.png b/zh-cn/third-party-components/npm-usage5.png new file mode 100644 index 0000000000000000000000000000000000000000..ec7f772f86dad4deb5f061f6e7cf6ac41748a225 Binary files /dev/null and b/zh-cn/third-party-components/npm-usage5.png differ 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 aaa89c4fac1bb47e7689a963c46e8c62cc81e18a..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 HAR的方式引入,在应用开发中使用。另一种是C和C++语言的三方组件,通常以源码或OpenHarmony hpm包的方式引入,在应用开发中以NAPI的方式使用,或直接编译在OpenHarmony操作系统镜像中。 +OpenHarmony三方组件,是经过验证可在OpenHarmony系统上可重复使用的软件组件,可帮助开发者快速开发OpenHarmony系统或应用。根据其开发语言分为了2种,一种是使用JavaScript和TypeScript语言的三方组件,通常以源码或OpenHarmony npm包的方式引入,在应用开发中使用。另一种是C和C++语言的三方组件,通常以源码或OpenHarmony hpm包的方式引入,在应用开发中以NAPI的方式使用,或直接编译在OpenHarmony操作系统镜像中。