• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (c) 2021 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 of display manager
18 * @devices tv, phone, tablet, wearable
19 */
20declare namespace display {
21  /**
22   * get the default display
23   * @devices tv, phone, tablet, wearable
24   */
25  function getDefaultDisplay(): Promise<Display>;
26
27  /**
28  /**
29   * the state of display
30   * @devices tv, phone, tablet, wearable
31   */
32  enum DisplayState {
33    /**
34     * unknown
35     */
36    STATE_UNKNOWN = 0,
37    /**
38     * screen off
39     */
40    STATE_OFF,
41    /**
42     * screen on
43     */
44    STATE_ON,
45    /**
46     * doze, but it will update for some important system messages
47     */
48    STATE_DOZE,
49    /**
50     * doze and not update
51     */
52    STATE_DOZE_SUSPEND,
53    /**
54     * VR node
55     */
56    STATE_VR,
57    /**
58     * screen on and not update
59     */
60    STATE_ON_SUSPEND,
61  }
62
63  /**
64   * Properties of display, it couldn't update automatically
65   * @devices tv, phone, tablet, wearable
66   */
67  interface Display {
68    /**
69     * display id
70     */
71    id: number;
72
73    /**
74     * display name
75     */
76    name: string;
77
78    /**
79     * the display is alive
80     */
81    alive: boolean;
82
83    /**
84     * the state of display
85     */
86    state: DisplayState;
87
88    /**
89     * refresh rate, unit: Hz
90     */
91    refreshRate: number;
92
93    /**
94     * the rotation degrees of the display
95     */
96    rotation: number;
97
98    /**
99     * the width of display, unit: pixel
100     */
101    width: number;
102
103    /**
104     * the height of display, unit: pixel
105     */
106    height: number;
107
108    /**
109     * indicates the display resolution.
110     */
111    densityDPI: number;
112
113    /**
114     * indicates the display density in pixels. The value of a low-resolution display is 1.0
115     */
116    densityPixels: number;
117
118    /**
119     * indicates the text scale density of a display.
120     */
121    scaledDensity: number;
122
123    /**
124     * the DPI on X-axis.
125     */
126    xDPI: number;
127
128    /**
129     * the DPI on Y-axis.
130     */
131    yDPI: number;
132  }
133}
134
135export default display;
136