• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 * @file
18 * @kit BasicServicesKit
19 */
20
21/**
22 * @interface DeviceResponse
23 * @syscap SystemCapability.Startup.SystemInfo.Lite
24 * @since 3
25 * @deprecated since 6
26 */
27export interface DeviceResponse {
28  /**
29   * Brand.
30   *
31   * @type { string }
32   * @syscap SystemCapability.Startup.SystemInfo.Lite
33   * @since 3
34   * @deprecated since 6
35   */
36  brand: string;
37
38  /**
39   * Manufacturer.
40   *
41   * @type { string }
42   * @syscap SystemCapability.Startup.SystemInfo.Lite
43   * @since 3
44   * @deprecated since 6
45   */
46  manufacturer: string;
47
48  /**
49   * Model.
50   *
51   * @type { string }
52   * @syscap SystemCapability.Startup.SystemInfo.Lite
53   * @since 3
54   * @deprecated since 6
55   */
56  model: string;
57
58  /**
59   * Product number.
60   *
61   * @type { string }
62   * @syscap SystemCapability.Startup.SystemInfo.Lite
63   * @since 3
64   * @deprecated since 6
65   */
66  product: string;
67
68  /**
69   * System language.
70   *
71   * @type { string }
72   * @syscap SystemCapability.Startup.SystemInfo.Lite
73   * @since 4
74   * @deprecated since 6
75   */
76  language: string;
77
78  /**
79   * System region.
80   *
81   * @type { string }
82   * @syscap SystemCapability.Startup.SystemInfo.Lite
83   * @since 4
84   * @deprecated since 6
85   */
86  region: string;
87
88  /**
89   * Window width.
90   *
91   * @type { number }
92   * @syscap SystemCapability.Startup.SystemInfo.Lite
93   * @since 3
94   * @deprecated since 6
95   */
96  windowWidth: number;
97
98  /**
99   * Window Height.
100   *
101   * @type { number }
102   * @syscap SystemCapability.Startup.SystemInfo.Lite
103   * @since 3
104   * @deprecated since 6
105   */
106  windowHeight: number;
107
108  /**
109   * Screen density.
110   *
111   * @type { number }
112   * @syscap SystemCapability.Startup.SystemInfo.Lite
113   * @since 4
114   * @deprecated since 6
115   */
116  screenDensity: number;
117
118  /**
119   * Screen shape. The options are as follows:
120   * rect: Rectangle screen.
121   * circle: Circle screen.
122   *
123   * @type { 'rect' | 'circle' }
124   * @syscap SystemCapability.Startup.SystemInfo.Lite
125   * @since 4
126   * @deprecated since 6
127   */
128  screenShape: 'rect' | 'circle';
129
130  /**
131   * API version.
132   *
133   * @type { number }
134   * @syscap SystemCapability.Startup.SystemInfo.Lite
135   * @since 4
136   * @deprecated since 6
137   */
138  apiVersion: number;
139
140  /**
141   * Device type. The options are as follows:
142   * phone: smartphone
143   * tablet: tablet
144   * tv: smart TV
145   * wearable: wearable
146   * liteWearable: lite wearable
147   * ar: AR
148   * vr: virtual reality
149   * earphones: headset
150   * pc: personal computer
151   * speaker: speaker
152   * smartVision: smart visual device
153   * linkIoT: connection module
154   *
155   * @type { string }
156   * @syscap SystemCapability.Startup.SystemInfo.Lite
157   * @since 4
158   * @deprecated since 6
159   */
160  deviceType: string;
161}
162
163/**
164 * @interface GetDeviceOptions
165 * @syscap SystemCapability.Startup.SystemInfo.Lite
166 * @since 3
167 * @deprecated since 6
168 */
169export interface GetDeviceOptions {
170  /**
171   * Called when the device information is obtained.
172   *
173   * @type  { ?function }
174   * @syscap SystemCapability.Startup.SystemInfo.Lite
175   * @since 3
176   * @deprecated since 6
177   */
178  success?: (data: DeviceResponse) => void;
179
180  /**
181   * Called when the device information fails to be obtained.
182   *
183   * @type { ?function }
184   * @syscap SystemCapability.Startup.SystemInfo.Lite
185   * @since 3
186   * @deprecated since 6
187   */
188  fail?: (data: any, code: number) => void;
189
190  /**
191   * Called when the execution is completed.
192   *
193   * @type { ?function }
194   * @syscap SystemCapability.Startup.SystemInfo.Lite
195   * @since 3
196   * @deprecated since 6
197   */
198  complete?: () => void;
199}
200
201/**
202 * getInfo interface
203 *
204 * @syscap SystemCapability.Startup.SystemInfo.Lite
205 * @since 3
206 * @deprecated since 6
207 */
208export default class Device {
209  /**
210   * Obtains the device information.
211   *
212   * @param { GetDeviceOptions } options - Options
213   * @syscap SystemCapability.Startup.SystemInfo.Lite
214   * @since 3
215   * @deprecated since 6
216   */
217  static getInfo(options?: GetDeviceOptions): void;
218}
219