This module provides the genuine product verification service for core components of a device, including the screen, battery, and motherboard.
Since: 26.0.0
import { BusinessError } from "@kit.BasicServicesKit";
import { deviceDetection } from "@kit.ServiceSupportKit"; getDeviceComponentVerificationDetails(): Promise<DeviceComponentVerificationResult>
Obtains the device hardware consistency verification result. This API uses a promise to return the result.
Model restriction: This API can be used only in the stage model.
Required permissions: ohos.permission.DETECT_DEVICE
System capability: SystemCapability.HiViewDFX.DeviceDetection
Since: 26.0.0
Returns
| Type | Description |
|---|---|
| Promise<DeviceComponentVerificationResult> | Promise used to return the hardware consistency verification result. |
Error codes:
For details about the error codes, please refer to Universal Error Codes and ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 201 | Permission verification failed. |
| 1029600001 | Insufficient memory. |
| 1029600101 | Service exception. |
| 1029600301 | Network error. |
| 1029600302 | Smart Diagnosis privacy statement not accepted. |
Example:
import { BusinessError } from "@kit.BasicServicesKit";
import { deviceDetection } from "@kit.ServiceSupportKit";
// Create and initialize a result object.
let result: deviceDetection.DeviceComponentVerificationResult = {
componentDetails: []
};
try {
// Receive the consistency verification result.
result = await deviceDetection.getDeviceComponentVerificationDetails();
} catch (error) {
// Capture exceptions.
const err: BusinessError = error as BusinessError;
console.error('enter into getDeviceComponentVerificationDetails catch, code is: ' + err.code + ' message is: ' + err.message);
} Defines the device hardware consistency verification result.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.HiViewDFX.DeviceDetection
Since: 26.0.0
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| componentDetails | ComponentVerificationDetail[] | No | No | Hardware verification details. |
Defines the hardware verification result details.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.HiViewDFX.DeviceDetection
Since: 26.0.0
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| componentType | ComponentType | No | No | Hardware type. |
| resultType | ResultType | No | No | Verification result. |
Enumerates the types of hardware for consistency verification.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.HiViewDFX.DeviceDetection
Since: 26.0.0
| Name | Value | Description |
|---|---|---|
| MOTHERBOARD | 'MOTHERBOARD' | Motherboard. |
| BATTERY | 'BATTERY' | Battery. |
| SCREEN | 'SCREEN' | Screen. |
Enumerates the consistency verification results.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.HiViewDFX.DeviceDetection
Since: 26.0.0
| Name | Value | Description |
|---|---|---|
| PASS | 0 | The hardware consistency verification is passed. |
| FAIL | 1 | The hardware consistency verification fails. |
| NO_DATA | 2 | No current hardware data is available in the verification system. |
| UNSURE | 3 | The verification result cannot be determined. |