“9dc64edfd9fb97c22f4a5e997b4e3abcaec4b2e1”上不存在“tools/git@gitcode.net:s920243400/PaddleDetection.git”
未验证 提交 7a2b8514 编写于 作者: O openharmony_ci 提交者: Gitee

!9688 翻译完成 8394/8376/9475/9397

Merge pull request !9688 from ester.zhou/C1-0919
...@@ -528,7 +528,7 @@ Obtains all notification slots. This API uses an asynchronous callback to return ...@@ -528,7 +528,7 @@ Obtains all notification slots. This API uses an asynchronous callback to return
| Name | Readable| Writable| Type | Mandatory| Description | | Name | Readable| Writable| Type | Mandatory| Description |
| -------- | ---- | --- | --------------------------------- | ---- | -------------------- | | -------- | ---- | --- | --------------------------------- | ---- | -------------------- |
| callback | Yes | No | AsyncCallback\<[NotificationSlot](#notificationslot)\> | Yes | Callback used to return the result.| | callback | Yes | No | AsyncCallback\<Array\<[NotificationSlot](#notificationslot)\>\> | Yes | Callback used to return the result.|
**Example** **Example**
......
# Work Scheduler # Work Scheduler
> **NOTE**<br/> The **workScheduler** module provides the APIs for registering, canceling, and querying Work Scheduler tasks, which do not have real-time constraints.
> The initial APIs of this module are supported since API version 9. API version 9 is a canary version for trial use. The APIs of this version may be unstable.
The system executes Work Scheduler tasks at an appropriate time, subject to the storage space, power consumption, temperature, and more.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -100,7 +105,7 @@ Obtains the latest task status. This API uses an asynchronous callback to return ...@@ -100,7 +105,7 @@ Obtains the latest task status. This API uses an asynchronous callback to return
``` ```
workScheduler.getWorkStatus(50, (err, res) => { workScheduler.getWorkStatus(50, (err, res) => {
if (err) { if (err) {
console.info('workschedulerLog getWorkStatus failed, because:' + err.code); console.info('workschedulerLog getWorkStatus failed, because:' + err.data);
} else { } else {
for (let item in res) { for (let item in res) {
console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]); console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]);
...@@ -136,7 +141,7 @@ Obtains the latest task status. This API uses a promise to return the result. ...@@ -136,7 +141,7 @@ Obtains the latest task status. This API uses a promise to return the result.
console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]); console.info('workschedulerLog getWorkStatus success,' + item + ' is:' + res[item]);
} }
}).catch((err) => { }).catch((err) => {
console.info('workschedulerLog getWorkStatus failed, because:' + err.code); console.info('workschedulerLog getWorkStatus failed, because:' + err.data);
}) })
``` ```
...@@ -164,7 +169,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou ...@@ -164,7 +169,7 @@ Obtains all tasks associated with this application. This API uses an asynchronou
``` ```
workScheduler.obtainAllWorks((err, res) =>{ workScheduler.obtainAllWorks((err, res) =>{
if (err) { if (err) {
console.info('workschedulerLog obtainAllWorks failed, because:' + err.code); console.info('workschedulerLog obtainAllWorks failed, because:' + err.data);
} else { } else {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res)); console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
} }
...@@ -190,7 +195,7 @@ Obtains all tasks associated with this application. This API uses a promise to r ...@@ -190,7 +195,7 @@ Obtains all tasks associated with this application. This API uses a promise to r
workScheduler.obtainAllWorks().then((res) => { workScheduler.obtainAllWorks().then((res) => {
console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res)); console.info('workschedulerLog obtainAllWorks success, data is:' + JSON.stringify(res));
}).catch((err) => { }).catch((err) => {
console.info('workschedulerLog obtainAllWorks failed, because:' + err.code); console.info('workschedulerLog obtainAllWorks failed, because:' + err.data);
}) })
``` ```
...@@ -233,7 +238,7 @@ Checks whether the last execution of the specified task timed out. This API uses ...@@ -233,7 +238,7 @@ Checks whether the last execution of the specified task timed out. This API uses
``` ```
workScheduler.isLastWorkTimeOut(500, (err, res) =>{ workScheduler.isLastWorkTimeOut(500, (err, res) =>{
if (err) { if (err) {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code); console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.data);
} else { } else {
console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res); console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res);
} }
...@@ -267,17 +272,17 @@ Checks whether the last execution of the specified task timed out. This API uses ...@@ -267,17 +272,17 @@ Checks whether the last execution of the specified task timed out. This API uses
console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res); console.info('workschedulerLog isLastWorkTimeOut success, data is:' + res);
}) })
.catch(err => { .catch(err => {
console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.code); console.info('workschedulerLog isLastWorkTimeOut failed, because:' + err.data);
}); });
``` ```
## WorkInfo ## WorkInfo
Provides detailed information about the task. Provides detailed information about the task. For details about the constraints on configuring **WorkInfo**, see [Work Scheduler Overview](../../task-management/work-scheduler-overview.md).
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler **System capability**: SystemCapability.ResourceSchedule.WorkScheduler
| Name | Type | Mandatory| Description | | Name | Type | Mandatory | Description |
| --------------- | --------------------------------- | ---- | -------------------------------- | | --------------- | --------------------------------- | ---- | ---------------- |
| workId | number | Yes | Task ID. | | workId | number | Yes | Task ID. |
| bundleName | string | Yes | Name of the Work Scheduler task bundle. | | bundleName | string | Yes | Name of the Work Scheduler task bundle. |
| abilityName | string | Yes | Name of the component to be notified by a Work Scheduler callback.| | abilityName | string | Yes | Name of the component to be notified by a Work Scheduler callback.|
...@@ -291,8 +296,6 @@ Provides detailed information about the task. ...@@ -291,8 +296,6 @@ Provides detailed information about the task.
| repeatCycleTime | number | No | Repeat interval. | | repeatCycleTime | number | No | Repeat interval. |
| repeatCount | number | No | Number of repeat times. | | repeatCount | number | No | Number of repeat times. |
| isPersisted | boolean | No | Whether to enable persistent storage for the task. | | isPersisted | boolean | No | Whether to enable persistent storage for the task. |
| isDeepIdle | boolean | No | Whether the device needs to enter the idle state. |
| idleWaitTime | number | No | Time to wait in the idle state. |
## NetworkType ## NetworkType
Enumerates the network types that can trigger the task. Enumerates the network types that can trigger the task.
...@@ -336,8 +339,8 @@ Enumerates the storage states that can trigger the task. ...@@ -336,8 +339,8 @@ Enumerates the storage states that can trigger the task.
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler **System capability**: SystemCapability.ResourceSchedule.WorkScheduler
|Name |Default Value |Description| | Name | Default Value | Description |
| -------- | -------- | -------- | | ------------------------- | ---- | ------------------------------ |
|STORAGE_LEVEL_LOW |0 |The storage space is insufficient. | STORAGE_LEVEL_LOW | 0 | The storage space is insufficient. |
|STORAGE_LEVEL_OKAY |1 |The storage space is restored from insufficient to normal. | STORAGE_LEVEL_OKAY | 1 | The storage space is restored from insufficient to normal. |
|STORAGE_LEVEL_LOW_OR_OKAY |2 |The storage space is restored from insufficient to normal, or the storage space is insufficient. | STORAGE_LEVEL_LOW_OR_OKAY | 2 | The storage space is restored from insufficient to normal, or the storage space is insufficient.|
...@@ -20,32 +20,32 @@ Search(options?: { value?: string; placeholder?: string; icon?: string; controll ...@@ -20,32 +20,32 @@ Search(options?: { value?: string; placeholder?: string; icon?: string; controll
**Parameters** **Parameters**
| Name | Type | Mandatory | Default Value | Description | | Name | Type | Mandatory | Description |
| ----------- | ---------------- | ---- | ---- | ---------------------------------------- | | ----------- | ---------------- | ---- | ---------------------------------------- |
| value | string | No | - | Text input in the search text box. | | value | string | No | Text input in the search text box. |
| placeholder | string | No | - | Text displayed when there is no input. | | placeholder | string | 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.| | 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. | | controller | SearchController | No | Controller. |
## Attributes ## Attributes
| Name | Type | Default Value | Description | | Name | Type | Description |
| ----------------------- | ---------------------------------------- | ---- | --------------------- | | ----------------------- | ---------------------------------------- | --------------------- |
| searchButton | string | – | Text on the search button located next to the search text box. By default, there is no search button.| | searchButton | string | Text on the search button located next to the search text box. By default, there is no search button.|
| placeholderColor | [ResourceColor](ts-types.md#resourcecolor8) | - | Placeholder text color. | | placeholderColor | [ResourceColor](ts-types.md#resourcecolor8) | Placeholder text color. |
| placeholderFont | [Font](ts-types.md#font) | - | Placeholder text style. | | placeholderFont | [Font](ts-types.md#font) | Placeholder text style. |
| textFont | [Font](ts-types.md#font) | - | Text font for the search text box. | | textFont | [Font](ts-types.md#font) | Text font for the search text box. |
## Events ## Events
| Name | Description | | Name | Description |
| ---------------------------------------- | ---------------------------------------- | | ------------------------------------------- | ------------------------------------------------------------ |
| onSubmit(callback: (value: string) => void) | Triggered when users click the search icon or the search button, or touch the search button on a soft keyboard.<br> -**value**: current text input.| | onSubmit(callback: (value: string) => void) | Triggered when users click the search icon or the search button, or touch the search button on a soft keyboard.<br>- **value**: current text input. |
| onChange(callback: (value: string) => void) | Triggered when the input in the text box changes.<br> -**value**: current text input. | | onChange(callback: (value: string) => void) | Triggered when the input in the text box changes.<br>- **value**: current text input. |
| onCopy(callback: (value: string) => void) | Triggered when data is copied to the pasteboard.<br> -**value**: text copied. | | onCopy(callback: (value: string) => void) | Triggered when data is copied to the pasteboard.<br>- **value**: text copied. |
| onCut(callback: (value: string) => void) | Triggered when data is cut from the pasteboard.<br> -**value**: text cut. | | onCut(callback: (value: string) => void) | Triggered when data is cut from the pasteboard.<br>- **value**: text cut. |
| onPaste(callback: (value: string) => void) | Triggered when data is pasted from the pasteboard.<br> -**value**: text pasted. | | onPaste(callback: (value: string) => void) | Triggered when data is pasted from the pasteboard.<br>- **value**: text pasted. |
## SearchController ## SearchController
...@@ -63,9 +63,9 @@ Sets the position of the caret. ...@@ -63,9 +63,9 @@ Sets the position of the caret.
**Parameters** **Parameters**
| Name | Type | Mandatory | Default Value | Description | | Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ---- | ----------------- | | ----- | ------ | ---- | ----------------- |
| value | number | Yes | - | Length from the start of the character string to the position where the caret is located.| | value | number | Yes | Length from the start of the character string to the position where the caret is located.|
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
## When to Use ## When to Use
If your application needs to execute a non-real-time task, for example, data learning, you can harness the Work Scheduler mechanism, which will schedule the task based on the storage space, power consumption, temperature, and more when the preset conditions are met. If your application needs to execute a non-real-time task, for example, data learning, you can harness the Work Scheduler mechanism, which will schedule the task based on the storage space, power consumption, temperature, and more when the preset conditions are met. For details about the constraints on the Work Scheduler usage, see [Work Scheduler Overview](./work-scheduler-overview.md).
## Available APIs ## Available APIs
...@@ -20,38 +20,42 @@ import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility'; ...@@ -20,38 +20,42 @@ import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility';
**Table 1** Major workScheduler APIs **Table 1** Major workScheduler APIs
API | Description API | Description
---------------------------------------------------------|----------------------------------------- ------------------------------------------------------------ | ------------------------------------------------------------
startWork(work: WorkInfo): boolean | Starts a Work Scheduler task. startWork(work: WorkInfo): boolean | Starts a Work Scheduler task.
stopWork(work: WorkInfo, needCancel?: boolean): boolean | Stops a Work Scheduler task. stopWork(work: WorkInfo, needCancel?: boolean): boolean | Stops a Work Scheduler task.
getWorkStatus(workId: number, callback: AsyncCallback\<WorkInfo>): void| Obtains the status of a Work Scheduler task. This method uses an asynchronous callback to return the result. getWorkStatus(workId: number, callback: AsyncCallback\<WorkInfo>): void | Obtains the status of a Work Scheduler task. This API uses an asynchronous callback to return the result.
getWorkStatus(workId: number): Promise\<WorkInfo> | Obtains the status of a Work Scheduler task. This method uses a promise to return the result. getWorkStatus(workId: number): Promise\<WorkInfo> | Obtains the status of a Work Scheduler task. This API uses a promise to return the result.
obtainAllWorks(callback: AsyncCallback\<void>): Array\<WorkInfo>| Obtains Work Scheduler tasks. This method uses an asynchronous callback to return the result. obtainAllWorks(callback: AsyncCallback\<void>): Array\<WorkInfo> | Obtains Work Scheduler tasks. This API uses an asynchronous callback to return the result.
obtainAllWorks(): Promise<Array\<WorkInfo>>| Obtains Work Scheduler tasks. This method uses a promise to return the result. obtainAllWorks(): Promise<Array\<WorkInfo>> | Obtains Work Scheduler tasks. This API uses a promise to return the result.
stopAndClearWorks(): boolean| Stops and clears Work Scheduler tasks. stopAndClearWorks(): boolean | Stops and clears Work Scheduler tasks.
isLastWorkTimeOut(workId: number, callback: AsyncCallback\<void>): boolean| Checks whether the last execution of the specified task has timed out. This method uses an asynchronous callback to return the result. It is applicable to repeated tasks. isLastWorkTimeOut(workId: number, callback: AsyncCallback\<void>): boolean | Checks whether the last execution of the specified task has timed out. This API uses an asynchronous callback to return the result. It is applicable to repeated tasks.
isLastWorkTimeOut(workId: number): Promise\<boolean>| Checks whether the last execution of the specified task has timed out. This method uses a promise to return the result. It is applicable to repeated tasks. isLastWorkTimeOut(workId: number): Promise\<boolean> | Checks whether the last execution of the specified task has timed out. This API uses a promise to return the result. It is applicable to repeated tasks.
**Table 2** WorkInfo parameters **Table 2** WorkInfo parameters
API|Description|Type > **NOTE**
>
> For details about the constraints on configuring **WorkInfo**, see [Work Scheduler Overview](./work-scheduler-overview.md).
Name| Type|Description
---------------------------------------------------------|-----------------------------------------|--------------------------------------------------------- ---------------------------------------------------------|-----------------------------------------|---------------------------------------------------------
workId | Work ID. Mandatory.|number workId| number | Work ID. Mandatory.
bundleName | Name of the Work Scheduler task bundle. Mandatory.|string bundleName| string | Name of the Work Scheduler task bundle. Mandatory.
abilityName | Name of the component to be notified by a Work Scheduler callback.|string abilityName| string | Name of the component to be notified by a Work Scheduler callback. Mandatory.
networkType | Network type.| NetworkType networkType | [NetworkType](../reference/apis/js-apis-workScheduler.md#networktype) | Network type.
isCharging | Whether the device is charging.| boolean isCharging| boolean | Whether the device is charging.
chargerType | Charging type.| ChargingType chargerType| [ChargingType](../reference/apis/js-apis-workScheduler.md#chargingtype) | Charging type.
batteryLevel | Battery level.| number batteryLevel| number | Battery level.
batteryStatus| Battery status.| BatteryStatus batteryStatus| [BatteryStatus](../reference/apis/js-apis-workScheduler.md#batterystatus) | Battery status.
storageRequest|Storage status.| StorageRequest storageRequest| [StorageRequest](../reference/apis/js-apis-workScheduler.md#storagerequest) |Storage status.
isRepeat|Whether the task is repeated.| boolean isRepeat| boolean |Whether the task is repeated.
repeatCycleTime |Repeat interval.| number repeatCycleTime| number |Repeat interval.
repeatCount |Number of repeat times.| number repeatCount | number|Number of repeat times.
**Table 3** Work Scheduler callbacks **Table 3** Work Scheduler callbacks
API | Description Name | Description
---------------------------------------------------------|----------------------------------------- ---------------------------------------------------------|-----------------------------------------
onWorkStart(work: WorkInfo): void | Triggered when the Work Scheduler task starts. onWorkStart(work: WorkInfo): void | Triggered when the Work Scheduler task starts.
onWorkStop(work: WorkInfo): void | Triggered when the Work Scheduler task stops. onWorkStop(work: WorkInfo): void | Triggered when the Work Scheduler task stops.
......
# Misc Services<a name="EN-US_TOPIC_0000001162033853"></a> # Misc Services
## Introduction<a name="section11660541593"></a> ## Introduction
The Misc services subsystem provides APIs for setting the system time. The Misc services subsystem provides APIs for setting the system time.
**Figure 1** Subsystem architecture<a name="fig664210516252"></a> **Figure 1** Subsystem architecture
![](figures/subsystem-architecture.png "subsystem-architecture") ![](figures/subsystem-architecture.png "subsystem-architecture")
## Directory Structure<a name="section161941989596"></a> ## Directory Structure
``` ```
/base/miscservices /base/miscservices
└── time # Time service module └── time # Time service module
``` ```
## Repositories Involved<a name="section1371113476307"></a> ## Repositories Involved
**Misc services subsystem** **Misc services subsystem**
miscservices\_time [time_time_service](https://gitee.com/openharmony/time_time_service)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册