1/* 2 * Copyright (c) 2020 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @interface DeviceResponse 18 * @syscap SystemCapability.Startup.SystemInfo.Lite 19 * @since 3 20 */ 21export interface DeviceResponse { 22 /** 23 * Brand. 24 * 25 * @type { string } 26 * @syscap SystemCapability.Startup.SystemInfo.Lite 27 * @since 3 28 */ 29 brand: string; 30 31 /** 32 * Manufacturer. 33 * 34 * @type { string } 35 * @syscap SystemCapability.Startup.SystemInfo.Lite 36 * @since 3 37 */ 38 manufacturer: string; 39 40 /** 41 * Model. 42 * 43 * @type { string } 44 * @syscap SystemCapability.Startup.SystemInfo.Lite 45 * @since 3 46 */ 47 model: string; 48 49 /** 50 * Product number. 51 * 52 * @type { string } 53 * @syscap SystemCapability.Startup.SystemInfo.Lite 54 * @since 3 55 */ 56 product: string; 57 58 /** 59 * System language. 60 * 61 * @type { string } 62 * @syscap SystemCapability.Startup.SystemInfo.Lite 63 * @since 4 64 */ 65 language: string; 66 67 /** 68 * System region. 69 * 70 * @type { string } 71 * @syscap SystemCapability.Startup.SystemInfo.Lite 72 * @since 4 73 */ 74 region: string; 75 76 /** 77 * Window width. 78 * 79 * @type { number } 80 * @syscap SystemCapability.Startup.SystemInfo.Lite 81 * @since 3 82 */ 83 windowWidth: number; 84 85 /** 86 * Window Height. 87 * 88 * @type { number } 89 * @syscap SystemCapability.Startup.SystemInfo.Lite 90 * @since 3 91 */ 92 windowHeight: number; 93 94 /** 95 * Screen density. 96 * 97 * @type { number } 98 * @syscap SystemCapability.Startup.SystemInfo.Lite 99 * @since 4 100 */ 101 screenDensity: number; 102 103 /** 104 * Screen shape. The options are as follows: 105 * rect: Rectangle screen. 106 * circle: Circle screen. 107 * 108 * @type { 'rect' | 'circle' } 109 * @syscap SystemCapability.Startup.SystemInfo.Lite 110 * @since 4 111 */ 112 screenShape: 'rect' | 'circle'; 113 114 /** 115 * API version. 116 * 117 * @type { number } 118 * @syscap SystemCapability.Startup.SystemInfo.Lite 119 * @since 4 120 */ 121 apiVersion: number; 122 123 /** 124 * Device type. The options are as follows: 125 * phone: smartphone 126 * tablet: tablet 127 * tv: smart TV 128 * wearable: wearable 129 * liteWearable: lite wearable 130 * ar: AR 131 * vr: virtual reality 132 * earphones: headset 133 * pc: personal computer 134 * speaker: speaker 135 * smartVision: smart visual device 136 * linkIoT: connection module 137 * 138 * @type { string } 139 * @syscap SystemCapability.Startup.SystemInfo.Lite 140 * @since 4 141 */ 142 deviceType: string; 143} 144 145export interface GetDeviceOptions { 146 /** 147 * Called when the device information is obtained. 148 * 149 * @syscap SystemCapability.Startup.SystemInfo.Lite 150 * @since 3 151 */ 152 success?: (data: DeviceResponse) => void; 153 154 /** 155 * Called when the device information fails to be obtained. 156 * 157 * @syscap SystemCapability.Startup.SystemInfo.Lite 158 * @since 3 159 */ 160 fail?: (data: any, code: number) => void; 161 162 /** 163 * Called when the execution is completed. 164 * 165 * @syscap SystemCapability.Startup.SystemInfo.Lite 166 * @since 3 167 */ 168 complete?: () => void; 169} 170 171/** 172 * getInfo interface 173 * 174 * @syscap SystemCapability.Startup.SystemInfo.Lite 175 * @since 3 176 */ 177export default class Device { 178 /** 179 * Obtains the device information. 180 * 181 * @param { GetDeviceOptions } options - Options 182 * @syscap SystemCapability.Startup.SystemInfo.Lite 183 * @since 3 184 * @deprecated since 6 185 */ 186 static getInfo(options?: GetDeviceOptions): void; 187} 188