未验证 提交 d790b78d 编写于 作者: O openharmony_ci 提交者: Gitee

!16344 翻译完成:16080+16151+16197+16202 4个API少量更新

Merge pull request !16344 from wusongqing/TR16080
...@@ -290,7 +290,7 @@ Obtains the information about a given mission. This API uses an asynchronous cal ...@@ -290,7 +290,7 @@ Obtains the information about a given mission. This API uses an asynchronous cal
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.| | deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| missionId | number | Yes| Mission ID.| | missionId | number | Yes| Mission ID.|
| callback | AsyncCallback<[MissionInfo](./js-apis-inner-application-missionInfo.md))> | Yes| Callback used to return the mission information obtained.| | callback | AsyncCallback<[MissionInfo](./js-apis-inner-application-missionInfo.md)> | Yes| Callback used to return the mission information obtained.|
**Example** **Example**
......
...@@ -3741,7 +3741,7 @@ Subscribes to playlist item changes. ...@@ -3741,7 +3741,7 @@ Subscribes to playlist item changes.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | ---------------------------------------------------------------------------- | | -------- | ----------------------------------------------------- | ---- | ---------------------------------------------------------------------------- |
| type | string | Yes | Event type. The event **'queueItemsChange'** is reported when one or more items in the playlist changes.| | type | string | Yes | Event type. The event **'queueItemsChange'** is reported when one or more items in the playlist changes.|
| callback | (items: Array<[AVQueueItem](#avqueueitem10)\>) => void | Yes | Callback used for subscription. **items** in the callback indicates the names of the items that change, and **args** indicates the parameters carried in the event. | | callback | (items: Array<[AVQueueItem](#avqueueitem10)\>) => void | Yes | Callback used for subscription. The **items** parameter in the callback indicates the changed items in the playlist. |
**Error codes** **Error codes**
...@@ -3775,7 +3775,7 @@ Subscribes to playlist name changes. ...@@ -3775,7 +3775,7 @@ Subscribes to playlist name changes.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | ------------------------------------------------------------------------------- | | -------- | ----------------------- | ---- | ------------------------------------------------------------------------------- |
| type | string | Yes | Event type. The event **'queueTitleChange'** is reported when the playlist name changes.| | type | string | Yes | Event type. The event **'queueTitleChange'** is reported when the playlist name changes.|
| callback | (title: string) => void | Yes | Callback used for subscription. **items** in the callback indicates the name of the playlist that changes, and **args** indicates the parameters carried in the event. | | callback | (title: string) => void | Yes | Callback used for subscription. The **title** parameter in the callback indicates the changed playlist name. |
**Error codes** **Error codes**
......
...@@ -96,7 +96,7 @@ Enumerates the device types. ...@@ -96,7 +96,7 @@ Enumerates the device types.
| CAR | 0x83 | Car. | | CAR | 0x83 | Car. |
| UNKNOWN_TYPE | 0 | Unknown device type.| | UNKNOWN_TYPE | 0 | Unknown device type.|
## AuthForm ## AuthForm<sup>10+</sup>
Enumerates the device authentication types. Enumerates the device authentication types.
...@@ -262,8 +262,6 @@ getTrustedDeviceListSync(): Array&lt;DeviceInfo&gt; ...@@ -262,8 +262,6 @@ getTrustedDeviceListSync(): Array&lt;DeviceInfo&gt;
Obtains all trusted devices synchronously. Obtains all trusted devices synchronously.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Return value** **Return value**
...@@ -296,8 +294,6 @@ getTrustedDeviceList(callback:AsyncCallback&lt;Array&lt;DeviceInfo&gt;&gt;): voi ...@@ -296,8 +294,6 @@ getTrustedDeviceList(callback:AsyncCallback&lt;Array&lt;DeviceInfo&gt;&gt;): voi
Obtains all trusted devices. This API uses an asynchronous callback to return the result. Obtains all trusted devices. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -336,8 +332,6 @@ getTrustedDeviceList(): Promise&lt;Array&lt;DeviceInfo&gt;&gt; ...@@ -336,8 +332,6 @@ getTrustedDeviceList(): Promise&lt;Array&lt;DeviceInfo&gt;&gt;
Obtains all trusted devices. This API uses a promise to return the result. Obtains all trusted devices. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Return value** **Return value**
...@@ -370,8 +364,6 @@ getLocalDeviceInfoSync(): [DeviceInfo](#deviceinfo) ...@@ -370,8 +364,6 @@ getLocalDeviceInfoSync(): [DeviceInfo](#deviceinfo)
Obtains local device information synchronously. Obtains local device information synchronously.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Return value** **Return value**
...@@ -404,8 +396,6 @@ getLocalDeviceInfo(callback:AsyncCallback&lt;DeviceInfo&gt;): void ...@@ -404,8 +396,6 @@ getLocalDeviceInfo(callback:AsyncCallback&lt;DeviceInfo&gt;): void
Obtains local device information. This API uses an asynchronous callback to return the result. Obtains local device information. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -444,8 +434,6 @@ getLocalDeviceInfo(): Promise&lt;DeviceInfo&gt; ...@@ -444,8 +434,6 @@ getLocalDeviceInfo(): Promise&lt;DeviceInfo&gt;
Obtains local device information. This API uses a promise to return the result. Obtains local device information. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Return value** **Return value**
...@@ -478,8 +466,6 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo): void ...@@ -478,8 +466,6 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo): void
Starts to discover peripheral devices. Starts to discover peripheral devices.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -524,8 +510,6 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void ...@@ -524,8 +510,6 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void
Starts to discover peripheral devices and filters discovered devices. Starts to discover peripheral devices and filters discovered devices.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -580,8 +564,6 @@ stopDeviceDiscovery(subscribeId: number): void ...@@ -580,8 +564,6 @@ stopDeviceDiscovery(subscribeId: number): void
Stops device discovery. Stops device discovery.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -616,8 +598,6 @@ publishDeviceDiscovery(publishInfo: PublishInfo): void ...@@ -616,8 +598,6 @@ publishDeviceDiscovery(publishInfo: PublishInfo): void
Publishes device information for discovery purposes. Publishes device information for discovery purposes.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -659,8 +639,6 @@ unPublishDeviceDiscovery(publishId: number): void ...@@ -659,8 +639,6 @@ unPublishDeviceDiscovery(publishId: number): void
Stops publishing device information. Stops publishing device information.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -695,8 +673,6 @@ authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: Async ...@@ -695,8 +673,6 @@ authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: Async
Authenticates a device. Authenticates a device.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -757,8 +733,6 @@ unAuthenticateDevice(deviceInfo: DeviceInfo): void ...@@ -757,8 +733,6 @@ unAuthenticateDevice(deviceInfo: DeviceInfo): void
Deauthenticates a device. Deauthenticates a device.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -798,8 +772,6 @@ verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback&lt;{deviceId: string, ...@@ -798,8 +772,6 @@ verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback&lt;{deviceId: string,
Verifies authentication information. Verifies authentication information.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -844,8 +816,6 @@ setUserOperation(operateAction: number, params: string): void; ...@@ -844,8 +816,6 @@ setUserOperation(operateAction: number, params: string): void;
Sets a user operation. Sets a user operation.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -880,8 +850,6 @@ requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback<{regi ...@@ -880,8 +850,6 @@ requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback<{regi
Obtains the registration information of the credential. Obtains the registration information of the credential.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -917,8 +885,6 @@ importCredential(credentialInfo: string, callback: AsyncCallback<{resultInfo: st ...@@ -917,8 +885,6 @@ importCredential(credentialInfo: string, callback: AsyncCallback<{resultInfo: st
Imports credential information. Imports credential information.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -970,8 +936,6 @@ deleteCredential(queryInfo: string, callback: AsyncCallback<{resultInfo: string} ...@@ -970,8 +936,6 @@ deleteCredential(queryInfo: string, callback: AsyncCallback<{resultInfo: string}
Deletes credential information. Deletes credential information.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1008,8 +972,6 @@ on(type: 'uiStateChange', callback: Callback&lt;{ param: string}&gt;): void; ...@@ -1008,8 +972,6 @@ on(type: 'uiStateChange', callback: Callback&lt;{ param: string}&gt;): void;
Subscribes to UI status changes. Subscribes to UI status changes.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1040,8 +1002,6 @@ off(type: 'uiStateChange', callback?: Callback&lt;{ param: string}&gt;): void; ...@@ -1040,8 +1002,6 @@ off(type: 'uiStateChange', callback?: Callback&lt;{ param: string}&gt;): void;
Unsubscribes from UI status changes. Unsubscribes from UI status changes.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1067,8 +1027,6 @@ on(type: 'deviceStateChange', callback: Callback&lt;{ action: DeviceStateChange ...@@ -1067,8 +1027,6 @@ on(type: 'deviceStateChange', callback: Callback&lt;{ action: DeviceStateChange
Subscribes to changes in the device state. Subscribes to changes in the device state.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1096,8 +1054,6 @@ off(type: 'deviceStateChange', callback?: Callback&lt;{ action: DeviceStateChang ...@@ -1096,8 +1054,6 @@ off(type: 'deviceStateChange', callback?: Callback&lt;{ action: DeviceStateChang
Unsubscribes from changes in the device state. Unsubscribes from changes in the device state.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1125,8 +1081,6 @@ on(type: 'deviceFound', callback: Callback&lt;{ subscribeId: number, device: Dev ...@@ -1125,8 +1081,6 @@ on(type: 'deviceFound', callback: Callback&lt;{ subscribeId: number, device: Dev
Subscribes to device discovery events. Subscribes to device discovery events.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1154,8 +1108,6 @@ off(type: 'deviceFound', callback?: Callback&lt;{ subscribeId: number, device: D ...@@ -1154,8 +1108,6 @@ off(type: 'deviceFound', callback?: Callback&lt;{ subscribeId: number, device: D
Unsubscribes from device discovery events. Unsubscribes from device discovery events.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1183,8 +1135,6 @@ on(type: 'discoverFail', callback: Callback&lt;{ subscribeId: number, reason: nu ...@@ -1183,8 +1135,6 @@ on(type: 'discoverFail', callback: Callback&lt;{ subscribeId: number, reason: nu
Subscribes to device discovery failures. Subscribes to device discovery failures.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1212,8 +1162,6 @@ off(type: 'discoverFail', callback?: Callback&lt;{ subscribeId: number, reason: ...@@ -1212,8 +1162,6 @@ off(type: 'discoverFail', callback?: Callback&lt;{ subscribeId: number, reason:
Unsubscribes from device discovery failures. Unsubscribes from device discovery failures.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1241,8 +1189,6 @@ on(type: 'publishSuccess', callback: Callback&lt;{ publishId: number }&gt;): voi ...@@ -1241,8 +1189,6 @@ on(type: 'publishSuccess', callback: Callback&lt;{ publishId: number }&gt;): voi
Subscribes to device information publication success events. Subscribes to device information publication success events.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1271,8 +1217,6 @@ off(type: 'publishSuccess', callback?: Callback&lt;{ publishId: number }&gt;): v ...@@ -1271,8 +1217,6 @@ off(type: 'publishSuccess', callback?: Callback&lt;{ publishId: number }&gt;): v
Unsubscribes from device information publication success events. Unsubscribes from device information publication success events.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1300,8 +1244,6 @@ on(type: 'publishFail', callback: Callback&lt;{ publishId: number, reason: numbe ...@@ -1300,8 +1244,6 @@ on(type: 'publishFail', callback: Callback&lt;{ publishId: number, reason: numbe
Subscribes to device information publication failures. Subscribes to device information publication failures.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1329,8 +1271,6 @@ off(type: 'publishFail', callback?: Callback&lt;{ publishId: number, reason: num ...@@ -1329,8 +1271,6 @@ off(type: 'publishFail', callback?: Callback&lt;{ publishId: number, reason: num
Unsubscribes from device information publication failures. Unsubscribes from device information publication failures.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1358,8 +1298,6 @@ on(type: 'serviceDie', callback: () =&gt; void): void ...@@ -1358,8 +1298,6 @@ on(type: 'serviceDie', callback: () =&gt; void): void
Subscribes to dead events of the **DeviceManager** service. Subscribes to dead events of the **DeviceManager** service.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
...@@ -1387,8 +1325,6 @@ off(type: 'serviceDie', callback?: () =&gt; void): void ...@@ -1387,8 +1325,6 @@ off(type: 'serviceDie', callback?: () =&gt; void): void
Unsubscribes from dead events of the **DeviceManager** service. Unsubscribes from dead events of the **DeviceManager** service.
**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
**System capability**: SystemCapability.DistributedHardware.DeviceManager **System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters** **Parameters**
......
...@@ -40,11 +40,9 @@ Defines the data structure of the fault log information. ...@@ -40,11 +40,9 @@ Defines the data structure of the fault log information.
| summary | string | Yes| Summary of the fault.| | summary | string | Yes| Summary of the fault.|
| fullLog | string | Yes| Full log text.| | fullLog | string | Yes| Full log text.|
## faultLogger.querySelfFaultLog<sup>(deprecated)</sup> ## faultLogger.query<sup>9+</sup>
querySelfFaultLog(faultType: FaultType, callback: AsyncCallback&lt;Array&lt;FaultLogInfo&gt;&gt;) : void
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [faultLogger.query](#faultloggerquery9) instead. query(faultType: FaultType, callback: AsyncCallback&lt;Array&lt;FaultLogInfo&gt;&gt;) : void
Obtains the fault information about the current process. This API uses an asynchronous callback to return the fault information array obtained, which contains a maximum of 10 pieces of fault information. Obtains the fault information about the current process. This API uses an asynchronous callback to return the fault information array obtained, which contains a maximum of 10 pieces of fault information.
...@@ -57,6 +55,14 @@ Obtains the fault information about the current process. This API uses an asynch ...@@ -57,6 +55,14 @@ Obtains the fault information about the current process. This API uses an asynch
| faultType | [FaultType](#faulttype) | Yes| Fault type.| | faultType | [FaultType](#faulttype) | Yes| Fault type.|
| callback | AsyncCallback&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Yes| Callback used to return the fault information array.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. In this case, an error string will be returned. | callback | AsyncCallback&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Yes| Callback used to return the fault information array.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. In this case, an error string will be returned.
**Error codes**
For details about the error codes, see [FaultLogger Error Codes](../errorcodes/errorcode-faultlogger.md).
| ID| Error Message|
| --- | --- |
| 10600001 | The service is not started or is faulty |
**Example** **Example**
```js ```js
...@@ -79,14 +85,16 @@ function queryFaultLogCallback(error, value) { ...@@ -79,14 +85,16 @@ function queryFaultLogCallback(error, value) {
} }
} }
} }
faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback); try {
faultLogger.query(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback);
} catch (err) {
console.error(`code: ${err.code}, message: ${err.message}`);
}
``` ```
## faultLogger.querySelfFaultLog<sup>(deprecated)</sup> ## faultLogger.query<sup>9+</sup>
querySelfFaultLog(faultType: FaultType) : Promise&lt;Array&lt;FaultLogInfo&gt;&gt;
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [faultLogger.query](#faultloggerquery9-1) instead. query(faultType: FaultType) : Promise&lt;Array&lt;FaultLogInfo&gt;&gt;
Obtains the fault information about the current process. This API uses a promise to return the fault information array obtained, which contains a maximum of 10 pieces of fault information. Obtains the fault information about the current process. This API uses a promise to return the fault information array obtained, which contains a maximum of 10 pieces of fault information.
...@@ -104,32 +112,48 @@ Obtains the fault information about the current process. This API uses a promise ...@@ -104,32 +112,48 @@ Obtains the fault information about the current process. This API uses a promise
| -------- | -------- | | -------- | -------- |
| Promise&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval.| | Promise&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval.|
**Error codes**
For details about the error codes, see [FaultLogger Error Codes](../errorcodes/errorcode-faultlogger.md).
| ID| Error Message|
| --- | --- |
| 10600001 | The service is not started or is faulty |
**Example** **Example**
```js ```js
async function getLog() { async function getLog() {
let value = await faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH); try {
if (value) { let value = await faultLogger.query(faultLogger.FaultType.JS_CRASH);
console.info("value length is " + value.length); if (value) {
let len = value.length; console.info("value length is " + value.length);
for (let i = 0; i < len; i++) { let len = value.length;
console.info("log: " + i); for (let i = 0; i < len; i++) {
console.info("Log pid: " + value[i].pid); console.info("log: " + i);
console.info("Log uid: " + value[i].uid); console.info("Log pid: " + value[i].pid);
console.info("Log type: " + value[i].type); console.info("Log uid: " + value[i].uid);
console.info("Log timestamp: " + value[i].timestamp); console.info("Log type: " + value[i].type);
console.info("Log reason: " + value[i].reason); console.info("Log timestamp: " + value[i].timestamp);
console.info("Log module: " + value[i].module); console.info("Log reason: " + value[i].reason);
console.info("Log summary: " + value[i].summary); console.info("Log module: " + value[i].module);
console.info("Log text: " + value[i].fullLog); console.info("Log summary: " + value[i].summary);
console.info("Log text: " + value[i].fullLog);
}
} }
} catch (err) {
console.error(`code: ${err.code}, message: ${err.message}`);
} }
} }
``` ```
## faultLogger.query<sup>9+</sup> ## faultLogger.querySelfFaultLog<sup>(deprecated)</sup>
query(faultType: FaultType, callback: AsyncCallback&lt;Array&lt;FaultLogInfo&gt;&gt;) : void querySelfFaultLog(faultType: FaultType, callback: AsyncCallback&lt;Array&lt;FaultLogInfo&gt;&gt;) : void
> **NOTE**
>
> This API is deprecated since API version 9. You are advised to use [faultLogger.query](#faultloggerquery9) instead.
Obtains the fault information about the current process. This API uses an asynchronous callback to return the fault information array obtained, which contains a maximum of 10 pieces of fault information. Obtains the fault information about the current process. This API uses an asynchronous callback to return the fault information array obtained, which contains a maximum of 10 pieces of fault information.
...@@ -142,14 +166,6 @@ Obtains the fault information about the current process. This API uses an asynch ...@@ -142,14 +166,6 @@ Obtains the fault information about the current process. This API uses an asynch
| faultType | [FaultType](#faulttype) | Yes| Fault type.| | faultType | [FaultType](#faulttype) | Yes| Fault type.|
| callback | AsyncCallback&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Yes| Callback used to return the fault information array.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. In this case, an error string will be returned. | callback | AsyncCallback&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Yes| Callback used to return the fault information array.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. In this case, an error string will be returned.
**Error codes**
For details about the error codes, see [FaultLogger Error Codes](../errorcodes/errorcode-faultlogger.md).
| ID| Error Message|
| --- | --- |
| 10600001 | The service is not started or is faulty |
**Example** **Example**
```js ```js
...@@ -172,16 +188,16 @@ function queryFaultLogCallback(error, value) { ...@@ -172,16 +188,16 @@ function queryFaultLogCallback(error, value) {
} }
} }
} }
try { faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback);
faultLogger.query(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback);
} catch (err) {
console.error(`code: ${err.code}, message: ${err.message}`);
}
``` ```
## faultLogger.query<sup>9+</sup> ## faultLogger.querySelfFaultLog<sup>(deprecated)</sup>
query(faultType: FaultType) : Promise&lt;Array&lt;FaultLogInfo&gt;&gt; querySelfFaultLog(faultType: FaultType) : Promise&lt;Array&lt;FaultLogInfo&gt;&gt;
> **NOTE**
>
> This API is deprecated since API version 9. You are advised to use [faultLogger.query](#faultloggerquery9-1) instead.
Obtains the fault information about the current process. This API uses a promise to return the fault information array obtained, which contains a maximum of 10 pieces of fault information. Obtains the fault information about the current process. This API uses a promise to return the fault information array obtained, which contains a maximum of 10 pieces of fault information.
...@@ -199,37 +215,25 @@ Obtains the fault information about the current process. This API uses a promise ...@@ -199,37 +215,25 @@ Obtains the fault information about the current process. This API uses a promise
| -------- | -------- | | -------- | -------- |
| Promise&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval.| | Promise&lt;Array&lt;[FaultLogInfo](#faultloginfo)&gt;&gt; | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**.<br>The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval.|
**Error codes**
For details about the error codes, see [FaultLogger Error Codes](../errorcodes/errorcode-faultlogger.md).
| ID| Error Message|
| --- | --- |
| 10600001 | The service is not started or is faulty |
**Example** **Example**
```js ```js
async function getLog() { async function getLog() {
try { let value = await faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH);
let value = await faultLogger.query(faultLogger.FaultType.JS_CRASH); if (value) {
if (value) { console.info("value length is " + value.length);
console.info("value length is " + value.length); let len = value.length;
let len = value.length; for (let i = 0; i < len; i++) {
for (let i = 0; i < len; i++) { console.info("log: " + i);
console.info("log: " + i); console.info("Log pid: " + value[i].pid);
console.info("Log pid: " + value[i].pid); console.info("Log uid: " + value[i].uid);
console.info("Log uid: " + value[i].uid); console.info("Log type: " + value[i].type);
console.info("Log type: " + value[i].type); console.info("Log timestamp: " + value[i].timestamp);
console.info("Log timestamp: " + value[i].timestamp); console.info("Log reason: " + value[i].reason);
console.info("Log reason: " + value[i].reason); console.info("Log module: " + value[i].module);
console.info("Log module: " + value[i].module); console.info("Log summary: " + value[i].summary);
console.info("Log summary: " + value[i].summary); console.info("Log text: " + value[i].fullLog);
console.info("Log text: " + value[i].fullLog);
}
} }
} catch (err) {
console.error(`code: ${err.code}, message: ${err.message}`);
} }
} }
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册