1# power-shell工具
2
3
4power-shell是实现设备电源状态转换等功能的工具,为开发者提供基本的设备电源状态调试能力,例如:熄屏、唤醒、设置电源模式等。
5
6## 环境要求
7<!--RP1-->
8在使用本工具前,开发者需要先获取[hdc工具](../dfx/hdc.md),执行hdc shell。
9<!--RP1End-->
10
11## power-shell命令工具列表
12
13| 命令 | 描述 |
14| -------- | -------- |
15| help | 帮助命令,显示power-shell支持的命令信息。 |
16| setmode | 设置电源模式命令,用来设置当前设备的电源模式。 |
17| wakeup | 亮屏命令,用来唤醒系统并亮屏。 |
18| suspend | 熄屏命令,用来暂停系统并熄屏。|
19| timeout | 自动熄屏命令,用来覆盖或恢复系统设置中自动熄屏时间。 |
20
21
22## 帮助命令
23
24```bash
25# 显示帮助信息
26power-shell help
27```
28
29
30## 设置电源模式命令
31
32```bash
33power-shell setmode
34```
35
36**设置电源模式命令列表**
37
38| 命令                                | 描述                       |
39| ----------------------------------- | -------------------------- |
40| power-shell setmode -h | 显示setmode支持的命令信息。 |
41| power-shell setmode 600 | 正常模式。 |
42| power-shell setmode 601 | 省电模式。 |
43| power-shell setmode 602 | 性能模式。 |
44| power-shell setmode 603 | 超级省电模式。 |
45
46示例:
47```bash
48# 设置设备电源状态为正常模式
49power-shell setmode 600
50# 设置设备电源状态为省电模式
51power-shell setmode 601
52# 设置设备电源状态为性能模式
53power-shell setmode 602
54# 设置设备电源状态为超级省电模式
55power-shell setmode 603
56```
57
58
59## 亮屏命令
60
61```bash
62power-shell wakeup
63```
64
65**亮屏命令列表**
66
67| 命令                          | 描述                     |
68| ----------------------------- | ------------------------ |
69| power-shell wakeup | 亮屏。 |
70
71
72示例:
73
74```bash
75# shell命令亮屏
76power-shell wakeup
77```
78
79
80## 熄屏命令
81
82```bash
83power-shell suspend
84```
85
86
87**熄屏命令列表**
88
89| 命令       | 描述                       |
90| ---------- | -------------------------- |
91| power-shell suspend  | 熄屏。 |
92
93
94示例:
95
96```bash
97# shell命令熄屏
98power-shell suspend
99```
100
101## 自动熄屏命令
102
103```bash
104power-shell timeout
105```
106
107**自动熄屏命令参数列表**
108| 参数       | 参数说明                       |
109| ---------- | -------------------------- |
110| -o \<time\> | 必选参数,设置自动熄屏时间。[time]单位为毫秒。 |
111| -r | 必选参数,恢复到当前系统设置中的自动熄屏时间。 |
112
113示例:
114
115```bash
116# 当前系统设置中自动熄屏时间为30秒
117# shell命令设置自动熄屏时间为15000毫秒
118power-shell timeout -o 15000
119# 恢复系统设置的自动熄屏时间,此时自动熄屏时间为30秒
120power-shell timeout -r
121```
122