From c89ccfa03d9810cbdb5050b6989429e8ac14fd9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E7=A3=8A?= Date: Tue, 22 Mar 2022 04:07:10 +0000 Subject: [PATCH] add api/@system.device.d.ts. --- api/@system.device.d.ts | 152 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 api/@system.device.d.ts diff --git a/api/@system.device.d.ts b/api/@system.device.d.ts new file mode 100644 index 0000000000..6c74197027 --- /dev/null +++ b/api/@system.device.d.ts @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @syscap SystemCapability.Startup.SystemInfo + */ +export interface DeviceResponse { + /** + * Brand. + * @syscap SystemCapability.Startup.SystemInfo + * @since 3 + */ + brand: string; + + /** + * Manufacturer. + * @syscap SystemCapability.Startup.SystemInfo + * @since 3 + */ + manufacturer: string; + + /** + * Model. + * @syscap SystemCapability.Startup.SystemInfo + * @since 3 + */ + model: string; + + /** + * Product number. + * @syscap SystemCapability.Startup.SystemInfo + * @since 3 + */ + product: string; + + /** + * System language. + * @syscap SystemCapability.Startup.SystemInfo + * @since 4 + */ + language: string; + + /** + * System region. + * @syscap SystemCapability.Startup.SystemInfo + * @since 4 + */ + region: string; + + /** + * Window width. + * @syscap SystemCapability.Startup.SystemInfo + * @since 3 + */ + windowWidth: number; + + /** + * Window Height. + * @syscap SystemCapability.Startup.SystemInfo + * @since 3 + */ + windowHeight: number; + + /** + * Screen density. + * @syscap SystemCapability.Startup.SystemInfo + * @since 4 + */ + screenDensity: number; + + /** + * Screen shape. The options are as follows: + * rect: Rectangle screen. + * circle: Circle screen. + * @syscap SystemCapability.Startup.SystemInfo + * @since 4 + */ + screenShape: "rect" | "circle"; + + /** + * API version. + * @syscap SystemCapability.Startup.SystemInfo + * @since 4 + */ + apiVersion: number; + + /** + * Device type. The options are as follows: + * phone: smartphone + * tablet: tablet + * tv: smart TV + * wearable: wearable + * liteWearable: lite wearable + * ar: AR + * vr: virtual reality + * earphones: headset + * pc: personal computer + * speaker: speaker + * smartVision: smart visual device + * linkIoT: connection module + * @syscap SystemCapability.Startup.SystemInfo + * @since 4 + */ + deviceType: string; +} + +export interface GetDeviceOptions { + /** + * Called when the device information is obtained. + * @syscap SystemCapability.Startup.SystemInfo + * @since 3 + */ + success?: (data: DeviceResponse) => void; + + /** + * Called when the device information fails to be obtained. + * @syscap SystemCapability.Startup.SystemInfo + * @since 3 + */ + fail?: (data: any, code: number) => void; + + /** + * Called when the execution is completed. + * @syscap SystemCapability.Startup.SystemInfo + * @since 3 + */ + complete?: () => void; +} + +/** + * getInfo interface + */ +export default class Device { + /** + * Obtains the device information. + * @syscap SystemCapability.Startup.SystemInfo + * @param options Options. + */ + static getInfo(options?: GetDeviceOptions): void; +} -- Gitee