• 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 * @devices tv, phone, tablet, wearable, liteWearable, smartVision
18 */
19export interface DeviceResponse {
20  /**
21   * Brand.
22   * @devices tv, phone, tablet, wearable, liteWearable, smartVision
23   * @since 3
24   */
25  brand: string;
26
27  /**
28   * Manufacturer.
29   * @devices tv, phone, tablet, wearable, liteWearable, smartVision
30   * @since 3
31   */
32  manufacturer: string;
33
34  /**
35   * Model.
36   * @devices tv, phone, tablet, wearable, liteWearable, smartVision
37   * @since 3
38   */
39  model: string;
40
41  /**
42   * Product number.
43   * @devices tv, phone, tablet, wearable, liteWearable, smartVision
44   * @since 3
45   */
46  product: string;
47
48  /**
49   * System language.
50   * @devices tv, phone, tablet, wearable, liteWearable
51   * @since 4
52   */
53  language: string;
54
55  /**
56   * System region.
57   * @devices tv, phone, tablet, wearable, liteWearable
58   * @since 4
59   */
60  region: string;
61
62  /**
63   * Window width.
64   * @devices tv, phone, tablet, wearable, liteWearable, smartVision
65   * @since 3
66   */
67  windowWidth: number;
68
69  /**
70   * Window Height.
71   * @devices tv, phone, tablet, wearable, liteWearable, smartVision
72   * @since 3
73   */
74  windowHeight: number;
75
76  /**
77   * Screen density.
78   * @devices tv, phone, tablet, wearable, liteWearable
79   * @since 4
80   */
81  screenDensity: number;
82
83  /**
84   * Screen shape. The options are as follows:
85   * rect: Rectangle screen.
86   * circle: Circle screen.
87   * @devices tv, phone, tablet, wearable, liteWearable
88   * @since 4
89   */
90  screenShape: "rect" | "circle";
91
92  /**
93   * API version.
94   * @devices tv, phone, tablet, wearable, liteWearable, smartVision
95   * @since 4
96   */
97  apiVersion: number;
98
99  /**
100   * Device type. The options are as follows:
101   * phone: smartphone
102   * tablet: tablet
103   * tv: smart TV
104   * wearable: wearable
105   * liteWearable: lite wearable
106   * ar: AR
107   * vr: virtual reality
108   * earphones: headset
109   * pc: personal computer
110   * speaker: speaker
111   * smartVision: smart visual device
112   * linkIoT: connection module
113   * @devices tv, phone, tablet, wearable, liteWearable, smartVision
114   * @since 4
115   */
116  deviceType: string;
117}
118
119export interface GetDeviceOptions {
120  /**
121   * Called when the device information is obtained.
122   * @since 3
123   */
124  success?: (data: DeviceResponse) => void;
125
126  /**
127   * Called when the device information fails to be obtained.
128   * @since 3
129   */
130  fail?: (data: any, code: number) => void;
131
132  /**
133   * Called when the execution is completed.
134   * @since 3
135   */
136  complete?: () => void;
137}
138
139/**
140 * @devices tv, phone, tablet, wearable, liteWearable, smartVision
141 */
142export default class Device {
143  /**
144   * Obtains the device information.
145   * @param options Options.
146   * @devices tv, phone, tablet, wearable, liteWearable
147   */
148  static getInfo(options?: GetDeviceOptions): void;
149}
150