提交 88672c6e 编写于 作者: S shawn_he

update doc

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 77440b49
...@@ -39,6 +39,14 @@ Obtains an **OnlineUpdater** object. ...@@ -39,6 +39,14 @@ Obtains an **OnlineUpdater** object.
| ------------------- | ---- | | ------------------- | ---- |
| [Updater](#updater) | **OnlineUpdater** object.| | [Updater](#updater) | **OnlineUpdater** object.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -71,6 +79,14 @@ Obtains a **Restorer** object for restoring factory settings. ...@@ -71,6 +79,14 @@ Obtains a **Restorer** object for restoring factory settings.
| --------------------- | ------ | | --------------------- | ------ |
| [Restorer](#restorer) | **Restorer** object for restoring factory settings.| | [Restorer](#restorer) | **Restorer** object for restoring factory settings.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -95,6 +111,14 @@ Obtains a **LocalUpdater** object. ...@@ -95,6 +111,14 @@ Obtains a **LocalUpdater** object.
| ----------------------------- | ------ | | ----------------------------- | ------ |
| [LocalUpdater](#localupdater) | **LocalUpdater** object.| | [LocalUpdater](#localupdater) | **LocalUpdater** object.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -123,6 +147,14 @@ Checks whether a new version is available. This API uses an asynchronous callbac ...@@ -123,6 +147,14 @@ Checks whether a new version is available. This API uses an asynchronous callbac
| -------- | ---------------------------------------- | ---- | -------------- | | -------- | ---------------------------------------- | ---- | -------------- |
| callback | AsyncCallback\<[CheckResult](#checkresult)> | Yes | Callback used to return the result.| | callback | AsyncCallback\<[CheckResult](#checkresult)> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -147,6 +179,14 @@ Checks whether a new version is available. This API uses a promise to return the ...@@ -147,6 +179,14 @@ Checks whether a new version is available. This API uses a promise to return the
| ------------------------------------- | ------------------- | | ------------------------------------- | ------------------- |
| Promise\<[CheckResult](#checkresult)> | Promise used to return the result.| | Promise\<[CheckResult](#checkresult)> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -175,6 +215,14 @@ Obtains information about the new version. This API uses an asynchronous callbac ...@@ -175,6 +215,14 @@ Obtains information about the new version. This API uses an asynchronous callbac
| -------- | ---------------------------------------- | ---- | --------------- | | -------- | ---------------------------------------- | ---- | --------------- |
| callback | AsyncCallback\<[NewVersionInfo](#newversioninfo)> | Yes | Callback used to return the result.| | callback | AsyncCallback\<[NewVersionInfo](#newversioninfo)> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -200,6 +248,14 @@ Obtains information about the new version. This API uses a promise to return the ...@@ -200,6 +248,14 @@ Obtains information about the new version. This API uses a promise to return the
| ---------------------------------------- | -------------------- | | ---------------------------------------- | -------------------- |
| Promise\<[NewVersionInfo](#newversioninfo)> | Promise used to return the result.| | Promise\<[NewVersionInfo](#newversioninfo)> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -226,8 +282,16 @@ Obtains the description file of the new version. This API uses an asynchronous c ...@@ -226,8 +282,16 @@ Obtains the description file of the new version. This API uses an asynchronous c
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------------------ | ---------------------------------------- | ---- | -------------- | | ------------------ | ---------------------------------------- | ---- | -------------- |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. |
| descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes | Options of the description file. | | descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes | Options of the description file. |
| callback | AsyncCallback\<Array\<[ComponentDescription](#componentdescription)>>) | Yes | Callback used to return the result.| | callback | AsyncCallback\<Array\<[ComponentDescription](#componentdescription)>> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
...@@ -272,6 +336,14 @@ Obtains the description file of the new version. This API uses a promise to retu ...@@ -272,6 +336,14 @@ Obtains the description file of the new version. This API uses a promise to retu
| ---------------------------------------- | ------------------- | | ---------------------------------------- | ------------------- |
| Promise\<Array\<[ComponentDescription](#componentdescription)>> | Promise used to return the result.| | Promise\<Array\<[ComponentDescription](#componentdescription)>> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -309,6 +381,14 @@ Obtains information about the current version. This API uses an asynchronous cal ...@@ -309,6 +381,14 @@ Obtains information about the current version. This API uses an asynchronous cal
| -------- | ---------------------------------------- | ---- | ---------------- | | -------- | ---------------------------------------- | ---- | ---------------- |
| callback | AsyncCallback\<[CurrentVersionInfo](#currentversioninfo)> | Yes | Callback used to return the result.| | callback | AsyncCallback\<[CurrentVersionInfo](#currentversioninfo)> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -335,6 +415,14 @@ Obtains information about the current version. This API uses a promise to return ...@@ -335,6 +415,14 @@ Obtains information about the current version. This API uses a promise to return
| ---------------------------------------- | ------------------- | | ---------------------------------------- | ------------------- |
| Promise\<[CurrentVersionInfo](#currentversioninfo)> | Promise used to return the result.| | Promise\<[CurrentVersionInfo](#currentversioninfo)> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -362,7 +450,15 @@ Obtains the description file of the current version. This API uses an asynchrono ...@@ -362,7 +450,15 @@ Obtains the description file of the current version. This API uses an asynchrono
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------------------ | ---------------------------------------- | ---- | --------------- | | ------------------ | ---------------------------------------- | ---- | --------------- |
| descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes | Options of the description file. | | descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes | Options of the description file. |
| callback | AsyncCallback\<Array\<[ComponentDescription](#componentdescription)>>) | Yes | Callback used to return the result.| | callback | AsyncCallback\<Array\<[ComponentDescription](#componentdescription)>> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
...@@ -401,6 +497,14 @@ Obtains the description file of the current version. This API uses a promise to ...@@ -401,6 +497,14 @@ Obtains the description file of the current version. This API uses a promise to
| ---------------------------------------- | -------------------- | | ---------------------------------------- | -------------------- |
| Promise\<Array\<[ComponentDescription](#componentdescription)>> | Promise used to return the result.| | Promise\<Array\<[ComponentDescription](#componentdescription)>> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -433,6 +537,14 @@ Obtains information about the update task. This API uses an asynchronous callbac ...@@ -433,6 +537,14 @@ Obtains information about the update task. This API uses an asynchronous callbac
| -------- | ------------------------------------- | ---- | ---------------- | | -------- | ------------------------------------- | ---- | ---------------- |
| callback | AsyncCallback\<[TaskInfo](#taskinfo)> | Yes | Callback used to return the result.| | callback | AsyncCallback\<[TaskInfo](#taskinfo)> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -457,6 +569,14 @@ Obtains information about the update task. This API uses a promise to return the ...@@ -457,6 +569,14 @@ Obtains information about the update task. This API uses a promise to return the
| ------------------------------- | ------------------- | | ------------------------------- | ------------------- |
| Promise\<[TaskInfo](#taskinfo)> | Promise used to return the result.| | Promise\<[TaskInfo](#taskinfo)> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -483,7 +603,15 @@ Downloads the new version. This API uses an asynchronous callback to return the ...@@ -483,7 +603,15 @@ Downloads the new version. This API uses an asynchronous callback to return the
| ----------------- | --------------------------------------- | ---- | ---------------------------------- | | ----------------- | --------------------------------------- | ---- | ---------------------------------- |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. |
| downloadOptions | [DownloadOptions](#downloadoptions) | Yes | Download options. | | downloadOptions | [DownloadOptions](#downloadoptions) | Yes | Download options. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
...@@ -526,6 +654,14 @@ Downloads the new version. This API uses a promise to return the result. ...@@ -526,6 +654,14 @@ Downloads the new version. This API uses a promise to return the result.
| -------------- | -------------------------- | | -------------- | -------------------------- |
| Promise\<void> | Promise that returns no value.| | Promise\<void> | Promise that returns no value.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -562,7 +698,15 @@ Resumes download of the new version. This API uses an asynchronous callback to r ...@@ -562,7 +698,15 @@ Resumes download of the new version. This API uses an asynchronous callback to r
| --------------------- | ---------------------------------------- | ---- | ------------------------------------ | | --------------------- | ---------------------------------------- | ---- | ------------------------------------ |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. |
| resumeDownloadOptions | [ResumeDownloadOptions](#resumedownloadoptions) | Yes | Options for resuming download. | | resumeDownloadOptions | [ResumeDownloadOptions](#resumedownloadoptions) | Yes | Options for resuming download. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
...@@ -604,6 +748,14 @@ Resumes download of the new version. This API uses a promise to return the resul ...@@ -604,6 +748,14 @@ Resumes download of the new version. This API uses a promise to return the resul
| -------------- | -------------------------- | | -------------- | -------------------------- |
| Promise\<void> | Promise that returns no value.| | Promise\<void> | Promise that returns no value.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -639,7 +791,15 @@ Pauses download of the new version. This API uses an asynchronous callback to re ...@@ -639,7 +791,15 @@ Pauses download of the new version. This API uses an asynchronous callback to re
| -------------------- | ---------------------------------------- | ---- | ------------------------------------ | | -------------------- | ---------------------------------------- | ---- | ------------------------------------ |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. |
| pauseDownloadOptions | [PauseDownloadOptions](#pausedownloadoptions) | Yes | Options for pausing download. | | pauseDownloadOptions | [PauseDownloadOptions](#pausedownloadoptions) | Yes | Options for pausing download. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
...@@ -681,6 +841,14 @@ Resumes download of the new version. This API uses a promise to return the resul ...@@ -681,6 +841,14 @@ Resumes download of the new version. This API uses a promise to return the resul
| -------------- | -------------------------- | | -------------- | -------------------------- |
| Promise\<void> | Promise that returns no value.| | Promise\<void> | Promise that returns no value.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -716,7 +884,15 @@ Updates the version. This API uses an asynchronous callback to return the result ...@@ -716,7 +884,15 @@ Updates the version. This API uses an asynchronous callback to return the result
| ----------------- | --------------------------------------- | ---- | ------------------------------------ | | ----------------- | --------------------------------------- | ---- | ------------------------------------ |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. |
| upgradeOptions | [UpgradeOptions](#upgradeoptions) | Yes | Update options. | | upgradeOptions | [UpgradeOptions](#upgradeoptions) | Yes | Update options. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
...@@ -758,6 +934,14 @@ Updates the version. This API uses a promise to return the result. ...@@ -758,6 +934,14 @@ Updates the version. This API uses a promise to return the result.
| -------------- | -------------------------- | | -------------- | -------------------------- |
| Promise\<void> | Promise that returns no value.| | Promise\<void> | Promise that returns no value.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -793,7 +977,15 @@ Clears errors. This API uses an asynchronous callback to return the result. ...@@ -793,7 +977,15 @@ Clears errors. This API uses an asynchronous callback to return the result.
| ----------------- | --------------------------------------- | ---- | ------------------------------------ | | ----------------- | --------------------------------------- | ---- | ------------------------------------ |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. |
| clearOptions | [ClearOptions](#clearoptions) | Yes | Clear options. | | clearOptions | [ClearOptions](#clearoptions) | Yes | Clear options. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
...@@ -835,6 +1027,14 @@ Clears errors. This API uses a promise to return the result. ...@@ -835,6 +1027,14 @@ Clears errors. This API uses a promise to return the result.
| -------------- | -------------------------- | | -------------- | -------------------------- |
| Promise\<void> | Promise that returns no value.| | Promise\<void> | Promise that returns no value.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -870,6 +1070,14 @@ Obtains the update policy. This API uses an asynchronous callback to return the ...@@ -870,6 +1070,14 @@ Obtains the update policy. This API uses an asynchronous callback to return the
| -------- | ---------------------------------------- | ---- | --------------- | | -------- | ---------------------------------------- | ---- | --------------- |
| callback | AsyncCallback\<[UpgradePolicy](#upgradepolicy)> | Yes | Callback used to return the result.| | callback | AsyncCallback\<[UpgradePolicy](#upgradepolicy)> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -895,6 +1103,14 @@ Obtains the update policy. This API uses a promise to return the result. ...@@ -895,6 +1103,14 @@ Obtains the update policy. This API uses a promise to return the result.
| ---------------------------------------- | --------------------- | | ---------------------------------------- | --------------------- |
| Promise\<[UpgradePolicy](#upgradepolicy)> | Promise used to return the result.| | Promise\<[UpgradePolicy](#upgradepolicy)> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -923,6 +1139,14 @@ Sets the update policy. This API uses an asynchronous callback to return the res ...@@ -923,6 +1139,14 @@ Sets the update policy. This API uses an asynchronous callback to return the res
| policy | [UpgradePolicy](#upgradepolicy) | Yes | Update policy. | | policy | [UpgradePolicy](#upgradepolicy) | Yes | Update policy. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -930,7 +1154,7 @@ const policy = { ...@@ -930,7 +1154,7 @@ const policy = {
downloadStrategy: false, downloadStrategy: false,
autoUpgradeStrategy: false, autoUpgradeStrategy: false,
autoUpgradePeriods: [ { start: 120, end: 240 } ] // Automatic update period, in minutes autoUpgradePeriods: [ { start: 120, end: 240 } ] // Automatic update period, in minutes
} };
updater.setUpgradePolicy(policy, (err) => { updater.setUpgradePolicy(policy, (err) => {
console.log(`setUpgradePolicy result: ${err}`); console.log(`setUpgradePolicy result: ${err}`);
}); });
...@@ -958,6 +1182,14 @@ Sets the update policy. This API uses a promise to return the result. ...@@ -958,6 +1182,14 @@ Sets the update policy. This API uses a promise to return the result.
| -------------- | ------------------- | | -------------- | ------------------- |
| Promise\<void> | Promise used to return the result.| | Promise\<void> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -965,7 +1197,7 @@ const policy = { ...@@ -965,7 +1197,7 @@ const policy = {
downloadStrategy: false, downloadStrategy: false,
autoUpgradeStrategy: false, autoUpgradeStrategy: false,
autoUpgradePeriods: [ { start: 120, end: 240 } ] // Automatic update period, in minutes autoUpgradePeriods: [ { start: 120, end: 240 } ] // Automatic update period, in minutes
} };
updater.setUpgradePolicy(policy).then(() => { updater.setUpgradePolicy(policy).then(() => {
console.log(`setUpgradePolicy success`); console.log(`setUpgradePolicy success`);
}).catch(err => { }).catch(err => {
...@@ -987,7 +1219,15 @@ Terminates the update. This API uses an asynchronous callback to return the resu ...@@ -987,7 +1219,15 @@ Terminates the update. This API uses an asynchronous callback to return the resu
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------- | ---- | -------------------------------------- | | -------- | -------------------- | ---- | -------------------------------------- |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
...@@ -1013,6 +1253,14 @@ Terminates the update. This API uses a promise to return the result. ...@@ -1013,6 +1253,14 @@ Terminates the update. This API uses a promise to return the result.
| -------------- | -------------------------- | | -------------- | -------------------------- |
| Promise\<void> | Promise that returns no value.| | Promise\<void> | Promise that returns no value.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -1038,6 +1286,14 @@ Enables listening for update events. This API uses an asynchronous callback to r ...@@ -1038,6 +1286,14 @@ Enables listening for update events. This API uses an asynchronous callback to r
| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.| | eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.|
| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | Yes | Event callback.| | taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | Yes | Event callback.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -1065,6 +1321,14 @@ Disables listening for update events. This API uses an asynchronous callback to ...@@ -1065,6 +1321,14 @@ Disables listening for update events. This API uses an asynchronous callback to
| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.| | eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.|
| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | No | Event callback.| | taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | No | Event callback.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -1084,7 +1348,7 @@ updater.off(eventClassifyInfo, (eventInfo) => { ...@@ -1084,7 +1348,7 @@ updater.off(eventClassifyInfo, (eventInfo) => {
factoryReset(callback: AsyncCallback\<void>): void factoryReset(callback: AsyncCallback\<void>): void
Restore the device to its factory settings. This API uses an asynchronous callback to return the result. Restores the scale to its factory settings. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
...@@ -1094,7 +1358,15 @@ Restore the device to its factory settings. This API uses an asynchronous callba ...@@ -1094,7 +1358,15 @@ Restore the device to its factory settings. This API uses an asynchronous callba
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------- | ---- | -------------------------------------- | | -------- | -------------------- | ---- | -------------------------------------- |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
...@@ -1108,7 +1380,7 @@ restorer.factoryReset((err) => { ...@@ -1108,7 +1380,7 @@ restorer.factoryReset((err) => {
factoryReset(): Promise\<void> factoryReset(): Promise\<void>
Restore the device to its factory settings. This API uses a promise to return the result. Restores the scale to its factory settings. This API uses a promise to return the result.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
...@@ -1120,6 +1392,14 @@ Restore the device to its factory settings. This API uses a promise to return th ...@@ -1120,6 +1392,14 @@ Restore the device to its factory settings. This API uses a promise to return th
| -------------- | -------------------------- | | -------------- | -------------------------- |
| Promise\<void> | Promise that returns no value.| | Promise\<void> | Promise that returns no value.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -1150,6 +1430,14 @@ Verifies the update package. This API uses an asynchronous callback to return th ...@@ -1150,6 +1430,14 @@ Verifies the update package. This API uses an asynchronous callback to return th
| certsFile | string | Yes | Path of the certificate file. | | certsFile | string | Yes | Path of the certificate file. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -1186,6 +1474,14 @@ Verifies the update package. This API uses a promise to return the result. ...@@ -1186,6 +1474,14 @@ Verifies the update package. This API uses a promise to return the result.
| -------------- | ---------------------- | | -------------- | ---------------------- |
| Promise\<void> | Promise used to return the result.| | Promise\<void> | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -1214,7 +1510,15 @@ Installs the update package. This API uses an asynchronous callback to return th ...@@ -1214,7 +1510,15 @@ Installs the update package. This API uses an asynchronous callback to return th
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----------- | ---------------------------------- | ---- | --------------------------------------- | | ----------- | ---------------------------------- | ---- | --------------------------------------- |
| upgradeFile | Array<[UpgradeFile](#upgradefile)> | Yes | Update file. | | upgradeFile | Array<[UpgradeFile](#upgradefile)> | Yes | Update file. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
...@@ -1245,6 +1549,14 @@ Installs the update package. This API uses a promise to return the result. ...@@ -1245,6 +1549,14 @@ Installs the update package. This API uses a promise to return the result.
| -------------- | -------------------------- | | -------------- | -------------------------- |
| Promise\<void> | Promise that returns no value.| | Promise\<void> | Promise that returns no value.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -1273,6 +1585,14 @@ Enables listening for update events. This API uses an asynchronous callback to r ...@@ -1273,6 +1585,14 @@ Enables listening for update events. This API uses an asynchronous callback to r
| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.| | eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.|
| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | Yes | Event callback.| | taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | Yes | Event callback.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
```ts ```ts
...@@ -1300,7 +1620,15 @@ Disables listening for update events. This API uses an asynchronous callback to ...@@ -1300,7 +1620,15 @@ Disables listening for update events. This API uses an asynchronous callback to
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----------------- | ---------------------------------------- | ---- | ---- | | ----------------- | ---------------------------------------- | ---- | ---- |
| eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.| | eventClassifyInfo | [EventClassifyInfo](#eventclassifyinfo) | Yes | Event information.|
| taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | Yes | Event callback.| | taskCallback | [UpgradeTaskCallback](#upgradetaskcallback) | No | Event callback.|
**Error codes**
For details about the error codes, see [Update Error Codes](../errorcodes/errorcode-update.md).
| ID | Error Message |
| ------- | ---------------------------------------------------- |
| 11500104 | BusinessError 11500104: IPC error. |
**Example** **Example**
...@@ -1337,7 +1665,7 @@ Enumerates update service types. ...@@ -1337,7 +1665,7 @@ Enumerates update service types.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------- | ----------------------------------- | ---- | ---- | | ------- | ----------------------------------- | ---- | ---- |
| vendor | [BusinessVendor](#businessvendor) | Yes | Application vendor. | | vendor | [BusinessVendor](#businessvendor) | Yes | Application vendor. |
| subType | [BusinessSubType](#businesssubtype) | Yes | Type | | subType | [BusinessSubType](#businesssubtype) | Yes | Update service type. |
## CheckResult ## CheckResult
...@@ -1377,7 +1705,7 @@ Represents a version component. ...@@ -1377,7 +1705,7 @@ Represents a version component.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
| Parameter | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------------- | ----------------------------------- | ---- | -------- | | --------------- | ----------------------------------- | ---- | -------- |
| componentId | string | Yes | Component ID. | | componentId | string | Yes | Component ID. |
| componentType | [ComponentType](#componenttype) | Yes | Component type. | | componentType | [ComponentType](#componenttype) | Yes | Component type. |
...@@ -1498,7 +1826,7 @@ Represents an update policy. ...@@ -1498,7 +1826,7 @@ Represents an update policy.
## UpgradePeriod ## UpgradePeriod
Represents a period for automatic update. Represents an automatic update period.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
...@@ -1509,7 +1837,7 @@ Represents a period for automatic update. ...@@ -1509,7 +1837,7 @@ Represents a period for automatic update.
## TaskInfo ## TaskInfo
Represents task information. Task information.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
...@@ -1520,7 +1848,7 @@ Represents task information. ...@@ -1520,7 +1848,7 @@ Represents task information.
## EventInfo ## EventInfo
Represents event type information. Represents event information.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
...@@ -1554,7 +1882,7 @@ Represents an error message. ...@@ -1554,7 +1882,7 @@ Represents an error message.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------------ | ------ | ---- | ---- | | ------------ | ------ | ---- | ---- |
| errorCode | number | Yes | Error code. | | errorCode | number | Yes | Error code. |
| errorMessage | string | Yes | Error description.| | errorMessage | string | Yes | Error message.|
## EventClassifyInfo ## EventClassifyInfo
...@@ -1592,11 +1920,11 @@ Represents an event callback. ...@@ -1592,11 +1920,11 @@ Represents an event callback.
## BusinessVendor ## BusinessVendor
Device vendor. Represents a device vendor.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
| Name | Default Value | Description | | Name | Value | Description |
| ------ | -------- | ---- | | ------ | -------- | ---- |
| PUBLIC | "public" | Open source. | | PUBLIC | "public" | Open source. |
...@@ -1606,7 +1934,7 @@ Represents an update type. ...@@ -1606,7 +1934,7 @@ Represents an update type.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
| Name | Default Value | Description | | Name | Value | Description |
| -------- | ---- | ---- | | -------- | ---- | ---- |
| FIRMWARE | 1 | Firmware. | | FIRMWARE | 1 | Firmware. |
...@@ -1616,7 +1944,7 @@ Represents a component type. ...@@ -1616,7 +1944,7 @@ Represents a component type.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
| Name | Default Value | Description | | Name | Value | Description |
| ---- | ---- | ---- | | ---- | ---- | ---- |
| OTA | 1 | Firmware. | | OTA | 1 | Firmware. |
...@@ -1626,7 +1954,7 @@ Represents an update mode. ...@@ -1626,7 +1954,7 @@ Represents an update mode.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
| Name | Default Value | Description | | Name | Value | Description |
| -------- | ---------- | ---- | | -------- | ---------- | ---- |
| UPGRADE | "upgrade" | Differential package. | | UPGRADE | "upgrade" | Differential package. |
| RECOVERY | "recovery" | Recovery package. | | RECOVERY | "recovery" | Recovery package. |
...@@ -1637,7 +1965,7 @@ Represents an effective mode. ...@@ -1637,7 +1965,7 @@ Represents an effective mode.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
| Name | Default Value | Description | | Name | Value | Description |
| ------------- | ---- | ---- | | ------------- | ---- | ---- |
| COLD | 1 | Cold update. | | COLD | 1 | Cold update. |
| LIVE | 2 | Live update. | | LIVE | 2 | Live update. |
...@@ -1649,7 +1977,7 @@ Represents a description file type. ...@@ -1649,7 +1977,7 @@ Represents a description file type.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
| Name | Default Value | Description | | Name | Value | Description |
| ------- | ---- | ---- | | ------- | ---- | ---- |
| CONTENT | 0 | Content. | | CONTENT | 0 | Content. |
| URI | 1 | Link. | | URI | 1 | Link. |
...@@ -1660,18 +1988,18 @@ Represents a description file format. ...@@ -1660,18 +1988,18 @@ Represents a description file format.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
| Name | Default Value | Description | | Name | Value | Description |
| ---------- | ---- | ---- | | ---------- | ---- | ---- |
| STANDARD | 0 | Standard format.| | STANDARD | 0 | Standard format.|
| SIMPLIFIED | 1 | Simple format.| | SIMPLIFIED | 1 | Simple format.|
## NetType ## NetType
Enumerates network types. Represents a network type.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
| Name | Default Value | Description | | Name | Value | Description |
| ----------------- | ---- | --------- | | ----------------- | ---- | --------- |
| CELLULAR | 1 | Data network. | | CELLULAR | 1 | Data network. |
| METERED_WIFI | 2 | Wi-Fi hotspot. | | METERED_WIFI | 2 | Wi-Fi hotspot. |
...@@ -1685,7 +2013,7 @@ Represents an update command. ...@@ -1685,7 +2013,7 @@ Represents an update command.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
| Name | Default Value | Description | | Name | Value | Description |
| -------------------- | ---- | ----- | | -------------------- | ---- | ----- |
| DOWNLOAD | 1 | Download. | | DOWNLOAD | 1 | Download. |
| INSTALL | 2 | Install. | | INSTALL | 2 | Install. |
...@@ -1699,7 +2027,7 @@ Enumerates update states. ...@@ -1699,7 +2027,7 @@ Enumerates update states.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
| Name | Default Value | Description | | Name | Value | Description |
| ---------------- | ---- | ---- | | ---------------- | ---- | ---- |
| WAITING_DOWNLOAD | 20 | Waiting for download. | | WAITING_DOWNLOAD | 20 | Waiting for download. |
| DOWNLOADING | 21 | Downloading. | | DOWNLOADING | 21 | Downloading. |
...@@ -1718,7 +2046,7 @@ Represents an event type. ...@@ -1718,7 +2046,7 @@ Represents an event type.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
| Name | Default Value | Description | | Name | Value | Description |
| ---- | ---------- | ---- | | ---- | ---------- | ---- |
| TASK | 0x01000000 | Task event.| | TASK | 0x01000000 | Task event.|
...@@ -1728,22 +2056,22 @@ Enumerates event IDs. ...@@ -1728,22 +2056,22 @@ Enumerates event IDs.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
| Name | Default Value | Description | | Name | Value | Description |
| ---------------------- | ---------- | ------ | | ---------------------- | ---------- | ------ |
| EVENT_TASK_BASE | 0x01000000 | Indicates a task event. | | EVENT_TASK_BASE | 0x01000000 | Task event. |
| EVENT_TASK_RECEIVE | 0x01000001 | Indicates that a task is received. | | EVENT_TASK_RECEIVE | 0x01000001 | Task received. |
| EVENT_TASK_CANCEL | 0x01000010 | Indicates that a task is cancelled. | | EVENT_TASK_CANCEL | 0x01000010 | Task cancelled. |
| EVENT_DOWNLOAD_WAIT | 0x01000011 | Indicates the state of waiting for the download. | | EVENT_DOWNLOAD_WAIT | 0x01000011 | Waiting for download. |
| EVENT_DOWNLOAD_START | 0x01000100 | Indicates that the download starts. | | EVENT_DOWNLOAD_START | 0x01000100 | Download started. |
| EVENT_DOWNLOAD_UPDATE | 0x01000101 | Indicates the download progress update.| | EVENT_DOWNLOAD_UPDATE | 0x01000101 | Download progress update.|
| EVENT_DOWNLOAD_PAUSE | 0x01000110 | Indicates that the download is paused. | | EVENT_DOWNLOAD_PAUSE | 0x01000110 | Download paused. |
| EVENT_DOWNLOAD_RESUME | 0x01000111 | Indicates that the download is resumed. | | EVENT_DOWNLOAD_RESUME | 0x01000111 | Download resumed. |
| EVENT_DOWNLOAD_SUCCESS | 0x01001000 | Indicates that the download succeeded. | | EVENT_DOWNLOAD_SUCCESS | 0x01001000 | Download succeeded. |
| EVENT_DOWNLOAD_FAIL | 0x01001001 | Indicates that the download failed. | | EVENT_DOWNLOAD_FAIL | 0x01001001 | Download failed. |
| EVENT_UPGRADE_WAIT | 0x01001010 | Indicates the state of waiting for the update. | | EVENT_UPGRADE_WAIT | 0x01001010 | Waiting for update. |
| EVENT_UPGRADE_START | 0x01001011 | Indicates that the update starts. | | EVENT_UPGRADE_START | 0x01001011 | Update started. |
| EVENT_UPGRADE_UPDATE | 0x01001100 | Indicates that the update is in progress. | | EVENT_UPGRADE_UPDATE | 0x01001100 | Update in progress. |
| EVENT_APPLY_WAIT | 0x01001101 | Indicates the state of waiting for applying the update. | | EVENT_APPLY_WAIT | 0x01001101 | Waiting for applying the update. |
| EVENT_APPLY_START | 0x01001110 | Indicates the state of applying the update. | | EVENT_APPLY_START | 0x01001110 | Applying the update. |
| EVENT_UPGRADE_SUCCESS | 0x01001111 | Indicates that the update succeeded. | | EVENT_UPGRADE_SUCCESS | 0x01001111 | Update succeeded. |
| EVENT_UPGRADE_FAIL | 0x01010000 | Indicates that the update failed. | | EVENT_UPGRADE_FAIL | 0x01010000 | Update failed. |
# Update Error Codes
## 11500104 IPC Error
**Error Message**
BusinessError 11500104: IPC error.
**Description**
This error code is reported if an exception is thrown during an IPC call.
**Possible Causes**
An IPC API call failed.
**Solution**
1. Check whether the update system ability has started. If not, start it.
2. Check whether IPC data conversion is normal. If not, check the conversion process.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册