ms-vite-plugin 1.5.8 → 1.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +6 -6
- package/dist/packaging/index.d.ts +4 -1
- package/dist/packaging/index.js +1 -1
- package/docs/api/device.md +5 -9
- package/docs/api/global.md +2 -2
- package/docs/api/jbclear.md +291 -0
- package/docs/api/jbdevice.md +574 -0
- package/docs/api/jbdylib.md +219 -0
- package/docs/api/jbshell.md +59 -0
- package/docs/api/jbsystem.md +211 -0
- package/docs/api/jbvpn.md +219 -0
- package/docs/api/pip.md +50 -15
- package/docs/api/plist.md +137 -0
- package/docs/api/ui.md +114 -0
- package/docs/apicn/device.md +4 -8
- package/docs/apicn/global.md +2 -2
- package/docs/apicn/pip.md +50 -15
- package/docs/apicn/ui.md +114 -0
- package/docs/apilua/device.md +5 -9
- package/docs/apilua/global.md +2 -2
- package/docs/apilua/jbclear.md +313 -0
- package/docs/apilua/jbdevice.md +609 -0
- package/docs/apilua/jbdylib.md +231 -0
- package/docs/apilua/jbshell.md +63 -0
- package/docs/apilua/jbsystem.md +225 -0
- package/docs/apilua/jbvpn.md +233 -0
- package/docs/apilua/pip.md +53 -15
- package/docs/apilua/plist.md +153 -0
- package/docs/apilua/ui.md +117 -0
- package/docs/apipython/device.md +6 -8
- package/docs/apipython/g.md +1 -1
- package/docs/apipython/jbclear.md +288 -0
- package/docs/apipython/jbdevice.md +570 -0
- package/docs/apipython/jbdylib.md +215 -0
- package/docs/apipython/jbshell.md +61 -0
- package/docs/apipython/jbsystem.md +216 -0
- package/docs/apipython/jbvpn.md +231 -0
- package/docs/apipython/overview.md +1 -1
- package/docs/apipython/pip.md +52 -15
- package/docs/apipython/plist.md +152 -0
- package/docs/apipython/ui.md +118 -0
- package/docs/httpapi/api.md +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
# 设备模块 (JBDevice)
|
|
2
|
+
|
|
3
|
+
仅越狱包可用。免越狱包没有 `jbdevice`。
|
|
4
|
+
|
|
5
|
+
可设置自动锁屏分钟数(`0` 为不自动锁屏)并还原,读取序列号和 Wi-Fi 信息 / MAC,打开或关闭 Wi-Fi / 蓝牙 / 蜂窝数据 / 飞行模式,读取开关,扫描附近或列出已保存无线网,加入或遗忘无线网,设置和获取音量与背光亮度。
|
|
6
|
+
|
|
7
|
+
## 类型
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
class WifiInfo(KuaiJSNamespace):
|
|
11
|
+
ssid: str
|
|
12
|
+
bssid: str
|
|
13
|
+
password: str
|
|
14
|
+
encryption: str
|
|
15
|
+
channel: int
|
|
16
|
+
hidden: bool
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
| 字段 | 类型 | 描述 |
|
|
20
|
+
| ------------ | ---- | ----------------------------------------- |
|
|
21
|
+
| `ssid` | str | 无线网名称 |
|
|
22
|
+
| `bssid` | str | BSSID;没有则为空串 |
|
|
23
|
+
| `password` | str | 已保存密码;开放网络为空串 |
|
|
24
|
+
| `encryption` | str | 加密方式:`WEP` / `WPA` / `EAP` / `NONE` |
|
|
25
|
+
| `channel` | int | 信道 |
|
|
26
|
+
| `hidden` | bool | 是否隐藏网络 |
|
|
27
|
+
|
|
28
|
+
## API 参考
|
|
29
|
+
|
|
30
|
+
### setAutoLockMinutes - 设置自动锁屏分钟数。
|
|
31
|
+
|
|
32
|
+
`0` 表示不自动锁屏。
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
def setAutoLockMinutes(minutes: int) -> bool:
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**参数:**
|
|
39
|
+
|
|
40
|
+
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
41
|
+
| --------- | ---- | -------- | ------ | -------------------------------- |
|
|
42
|
+
| `minutes` | int | 是 | - | 锁屏分钟数;`<= 0` 视为不自动锁屏 |
|
|
43
|
+
|
|
44
|
+
**返回值:**
|
|
45
|
+
|
|
46
|
+
| 类型 | 描述 |
|
|
47
|
+
| ---- | ------------- |
|
|
48
|
+
| bool | 成功为 `True` |
|
|
49
|
+
|
|
50
|
+
**示例:**
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from kuaijs import jbdevice
|
|
54
|
+
|
|
55
|
+
jbdevice.setAutoLockMinutes(0)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### restoreAutoLock - 还原自动锁屏分钟数。
|
|
59
|
+
|
|
60
|
+
没有可还原的值则失败。
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
def restoreAutoLock() -> bool:
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**返回值:**
|
|
67
|
+
|
|
68
|
+
| 类型 | 描述 |
|
|
69
|
+
| ---- | ------------- |
|
|
70
|
+
| bool | 成功为 `True` |
|
|
71
|
+
|
|
72
|
+
**示例:**
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
jbdevice.restoreAutoLock()
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### getAutoLockMinutes - 读取当前自动锁屏分钟数。
|
|
79
|
+
|
|
80
|
+
`0` 表示不自动锁屏。
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
def getAutoLockMinutes() -> int | None:
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**返回值:**
|
|
87
|
+
|
|
88
|
+
| 类型 | 描述 |
|
|
89
|
+
| ------------ | ------------------------ |
|
|
90
|
+
| `int \| None` | 分钟数;读不到返回 `None` |
|
|
91
|
+
|
|
92
|
+
**示例:**
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
minutes = jbdevice.getAutoLockMinutes()
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### serialNumber - 读取设备序列号。
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
def serialNumber() -> str | None:
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**返回值:**
|
|
105
|
+
|
|
106
|
+
| 类型 | 描述 |
|
|
107
|
+
| ------------- | ------------------------ |
|
|
108
|
+
| `str \| None` | 序列号;读不到返回 `None` |
|
|
109
|
+
|
|
110
|
+
**示例:**
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
serial = jbdevice.serialNumber()
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### wifiMac - 读取本机 Wi-Fi MAC。
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
def wifiMac() -> str | None:
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**返回值:**
|
|
123
|
+
|
|
124
|
+
| 类型 | 描述 |
|
|
125
|
+
| ------------- | --------------------------------------------- |
|
|
126
|
+
| `str \| None` | `aa:bb:cc:dd:ee:ff` 形式;读不到返回 `None` |
|
|
127
|
+
|
|
128
|
+
**示例:**
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
mac = jbdevice.wifiMac()
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### wifiInfo - 读取当前已连接无线网信息。
|
|
135
|
+
|
|
136
|
+
没连上返回 `None`。
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
def wifiInfo() -> WifiInfo | None:
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**返回值:**
|
|
143
|
+
|
|
144
|
+
| 类型 | 描述 |
|
|
145
|
+
| ------------------- | ---------------------------- |
|
|
146
|
+
| `WifiInfo \| None` | Wi-Fi 信息;没连上返回 `None` |
|
|
147
|
+
|
|
148
|
+
**示例:**
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
info = jbdevice.wifiInfo()
|
|
152
|
+
if info is not None:
|
|
153
|
+
print(info.ssid)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### wifiOn - 打开 Wi-Fi。
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
def wifiOn() -> bool:
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**返回值:**
|
|
163
|
+
|
|
164
|
+
| 类型 | 描述 |
|
|
165
|
+
| ---- | ------------- |
|
|
166
|
+
| bool | 成功为 `True` |
|
|
167
|
+
|
|
168
|
+
**示例:**
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
jbdevice.wifiOn()
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### wifiOff - 关闭 Wi-Fi。
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
def wifiOff() -> bool:
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**返回值:**
|
|
181
|
+
|
|
182
|
+
| 类型 | 描述 |
|
|
183
|
+
| ---- | ------------- |
|
|
184
|
+
| bool | 成功为 `True` |
|
|
185
|
+
|
|
186
|
+
**示例:**
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
jbdevice.wifiOff()
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### isWifiOn - 读取 Wi-Fi 是否打开。
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
def isWifiOn() -> bool | None
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**返回值:**
|
|
199
|
+
|
|
200
|
+
| 类型 | 描述 |
|
|
201
|
+
| ------------- | ------------------------------ |
|
|
202
|
+
| `bool \| None` | 当前是否打开;读不到返回 `None` |
|
|
203
|
+
|
|
204
|
+
**示例:**
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
on = jbdevice.isWifiOn()
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### bluetoothOn - 打开蓝牙。
|
|
211
|
+
|
|
212
|
+
```python
|
|
213
|
+
def bluetoothOn() -> bool:
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**返回值:**
|
|
217
|
+
|
|
218
|
+
| 类型 | 描述 |
|
|
219
|
+
| ---- | ------------- |
|
|
220
|
+
| bool | 成功为 `True` |
|
|
221
|
+
|
|
222
|
+
**示例:**
|
|
223
|
+
|
|
224
|
+
```python
|
|
225
|
+
jbdevice.bluetoothOn()
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### bluetoothOff - 关闭蓝牙。
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
def bluetoothOff() -> bool:
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**返回值:**
|
|
235
|
+
|
|
236
|
+
| 类型 | 描述 |
|
|
237
|
+
| ---- | ------------- |
|
|
238
|
+
| bool | 成功为 `True` |
|
|
239
|
+
|
|
240
|
+
**示例:**
|
|
241
|
+
|
|
242
|
+
```python
|
|
243
|
+
jbdevice.bluetoothOff()
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### isBluetoothOn - 读取蓝牙是否打开。
|
|
247
|
+
|
|
248
|
+
```python
|
|
249
|
+
def isBluetoothOn() -> bool | None
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**返回值:**
|
|
253
|
+
|
|
254
|
+
| 类型 | 描述 |
|
|
255
|
+
| ------------- | ------------------------------ |
|
|
256
|
+
| `bool \| None` | 当前是否打开;读不到返回 `None` |
|
|
257
|
+
|
|
258
|
+
**示例:**
|
|
259
|
+
|
|
260
|
+
```python
|
|
261
|
+
on = jbdevice.isBluetoothOn()
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### cellularOn - 打开蜂窝数据。
|
|
265
|
+
|
|
266
|
+
```python
|
|
267
|
+
def cellularOn() -> bool:
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**返回值:**
|
|
271
|
+
|
|
272
|
+
| 类型 | 描述 |
|
|
273
|
+
| ---- | ------------- |
|
|
274
|
+
| bool | 成功为 `True` |
|
|
275
|
+
|
|
276
|
+
**示例:**
|
|
277
|
+
|
|
278
|
+
```python
|
|
279
|
+
jbdevice.cellularOn()
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### cellularOff - 关闭蜂窝数据。
|
|
283
|
+
|
|
284
|
+
```python
|
|
285
|
+
def cellularOff() -> bool:
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**返回值:**
|
|
289
|
+
|
|
290
|
+
| 类型 | 描述 |
|
|
291
|
+
| ---- | ------------- |
|
|
292
|
+
| bool | 成功为 `True` |
|
|
293
|
+
|
|
294
|
+
**示例:**
|
|
295
|
+
|
|
296
|
+
```python
|
|
297
|
+
jbdevice.cellularOff()
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### isCellularOn - 读取蜂窝数据是否打开。
|
|
301
|
+
|
|
302
|
+
没有蜂窝能力时失败。
|
|
303
|
+
|
|
304
|
+
```python
|
|
305
|
+
def isCellularOn() -> bool | None
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**返回值:**
|
|
309
|
+
|
|
310
|
+
| 类型 | 描述 |
|
|
311
|
+
| ------------- | ------------------------------ |
|
|
312
|
+
| `bool \| None` | 当前是否打开;读不到返回 `None` |
|
|
313
|
+
|
|
314
|
+
**示例:**
|
|
315
|
+
|
|
316
|
+
```python
|
|
317
|
+
on = jbdevice.isCellularOn()
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### airplaneOn - 打开飞行模式。
|
|
321
|
+
|
|
322
|
+
```python
|
|
323
|
+
def airplaneOn() -> bool:
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
**返回值:**
|
|
327
|
+
|
|
328
|
+
| 类型 | 描述 |
|
|
329
|
+
| ---- | ------------- |
|
|
330
|
+
| bool | 成功为 `True` |
|
|
331
|
+
|
|
332
|
+
**示例:**
|
|
333
|
+
|
|
334
|
+
```python
|
|
335
|
+
jbdevice.airplaneOn()
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### airplaneOff - 关闭飞行模式。
|
|
339
|
+
|
|
340
|
+
```python
|
|
341
|
+
def airplaneOff() -> bool:
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
**返回值:**
|
|
345
|
+
|
|
346
|
+
| 类型 | 描述 |
|
|
347
|
+
| ---- | ------------- |
|
|
348
|
+
| bool | 成功为 `True` |
|
|
349
|
+
|
|
350
|
+
**示例:**
|
|
351
|
+
|
|
352
|
+
```python
|
|
353
|
+
jbdevice.airplaneOff()
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### isAirplaneOn - 读取飞行模式是否打开。
|
|
357
|
+
|
|
358
|
+
```python
|
|
359
|
+
def isAirplaneOn() -> bool | None
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
**返回值:**
|
|
363
|
+
|
|
364
|
+
| 类型 | 描述 |
|
|
365
|
+
| ------------- | ------------------------------ |
|
|
366
|
+
| `bool \| None` | 当前是否打开;读不到返回 `None` |
|
|
367
|
+
|
|
368
|
+
**示例:**
|
|
369
|
+
|
|
370
|
+
```python
|
|
371
|
+
on = jbdevice.isAirplaneOn()
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### joinWifi - 加入一个无线网。
|
|
375
|
+
|
|
376
|
+
开放网络密码传空串。有密码时至少 8 位。可传 SSID 或 BSSID。
|
|
377
|
+
|
|
378
|
+
```python
|
|
379
|
+
def joinWifi(ssid: str, password: str = "", timeoutMs: int = 0) -> bool:
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
**参数:**
|
|
383
|
+
|
|
384
|
+
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
385
|
+
| ----------- | ---- | -------- | ------ | -------------------------------------------------------------- |
|
|
386
|
+
| `ssid` | str | 是 | - | 无线网名称,也可传 BSSID;空串失败 |
|
|
387
|
+
| `password` | str | 否 | `""` | 密码;开放网络传空串;长度 `1-7` 失败 |
|
|
388
|
+
| `timeoutMs` | int | 否 | `0` | 等待上限毫秒;`<= 0` 时用 `15000`,最短 `5000`,最长 `120000` |
|
|
389
|
+
|
|
390
|
+
**返回值:**
|
|
391
|
+
|
|
392
|
+
| 类型 | 描述 |
|
|
393
|
+
| ---- | ------------------- |
|
|
394
|
+
| bool | 连上目标网为 `True` |
|
|
395
|
+
|
|
396
|
+
**示例:**
|
|
397
|
+
|
|
398
|
+
```python
|
|
399
|
+
jbdevice.joinWifi("Office", "password123")
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
### forgetWifi - 遗忘一个已保存的无线网。
|
|
403
|
+
|
|
404
|
+
可传 SSID 或 BSSID。空串失败。
|
|
405
|
+
|
|
406
|
+
```python
|
|
407
|
+
def forgetWifi(ssid: str) -> bool:
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
**参数:**
|
|
411
|
+
|
|
412
|
+
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
413
|
+
| ------ | ---- | -------- | ------ | ------------------ |
|
|
414
|
+
| `ssid` | str | 是 | - | 无线网名称或 BSSID |
|
|
415
|
+
|
|
416
|
+
**返回值:**
|
|
417
|
+
|
|
418
|
+
| 类型 | 描述 |
|
|
419
|
+
| ---- | ------------------- |
|
|
420
|
+
| bool | 找到并删掉为 `True` |
|
|
421
|
+
|
|
422
|
+
**示例:**
|
|
423
|
+
|
|
424
|
+
```python
|
|
425
|
+
jbdevice.forgetWifi("Office")
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
### listWifi - 列出已保存的无线网。
|
|
429
|
+
|
|
430
|
+
没有已存网络时是空列表。
|
|
431
|
+
|
|
432
|
+
```python
|
|
433
|
+
def listWifi() -> list | None
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
**返回值:**
|
|
437
|
+
|
|
438
|
+
| 类型 | 描述 |
|
|
439
|
+
| -------------- | -------------------------------- |
|
|
440
|
+
| `list \| None` | Wi-Fi 信息列表;读失败返回 `None` |
|
|
441
|
+
|
|
442
|
+
**示例:**
|
|
443
|
+
|
|
444
|
+
```python
|
|
445
|
+
lst = jbdevice.listWifi()
|
|
446
|
+
if lst:
|
|
447
|
+
for item in lst:
|
|
448
|
+
print(item.ssid)
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### scanWifi - 扫描附近无线网。
|
|
452
|
+
|
|
453
|
+
会先打开 Wi-Fi。附近没有网时是空列表。
|
|
454
|
+
|
|
455
|
+
```python
|
|
456
|
+
def scanWifi(timeoutMs: int = 0) -> list | None
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
**参数:**
|
|
460
|
+
|
|
461
|
+
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
462
|
+
| ----------- | ---- | -------- | ------ | -------------------------------------------------------------- |
|
|
463
|
+
| `timeoutMs` | int | 否 | `0` | 等待上限毫秒;`<= 0` 时用 `15000`,最短 `5000`,最长 `120000` |
|
|
464
|
+
|
|
465
|
+
**返回值:**
|
|
466
|
+
|
|
467
|
+
| 类型 | 描述 |
|
|
468
|
+
| -------------- | -------------------------------- |
|
|
469
|
+
| `list \| None` | Wi-Fi 信息列表;扫失败返回 `None` |
|
|
470
|
+
|
|
471
|
+
**示例:**
|
|
472
|
+
|
|
473
|
+
```python
|
|
474
|
+
lst = jbdevice.scanWifi()
|
|
475
|
+
if lst:
|
|
476
|
+
for item in lst:
|
|
477
|
+
print(item.ssid)
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### setVolume - 设置系统音量。
|
|
481
|
+
|
|
482
|
+
范围 `0.0-1.0`。
|
|
483
|
+
|
|
484
|
+
```python
|
|
485
|
+
def setVolume(volume: float) -> bool:
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
**参数:**
|
|
489
|
+
|
|
490
|
+
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
491
|
+
| -------- | ----- | -------- | ------ | -------- |
|
|
492
|
+
| `volume` | float | 是 | - | 目标音量 |
|
|
493
|
+
|
|
494
|
+
**返回值:**
|
|
495
|
+
|
|
496
|
+
| 类型 | 描述 |
|
|
497
|
+
| ---- | ------------- |
|
|
498
|
+
| bool | 成功为 `True` |
|
|
499
|
+
|
|
500
|
+
**示例:**
|
|
501
|
+
|
|
502
|
+
```python
|
|
503
|
+
jbdevice.setVolume(0.5)
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### getVolume - 读取系统音量。
|
|
507
|
+
|
|
508
|
+
范围 `0.0-1.0`。
|
|
509
|
+
|
|
510
|
+
```python
|
|
511
|
+
def getVolume() -> float | None:
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
**返回值:**
|
|
515
|
+
|
|
516
|
+
| 类型 | 描述 |
|
|
517
|
+
| --------------- | -------------------------- |
|
|
518
|
+
| `float \| None` | 当前音量;读不到返回 `None` |
|
|
519
|
+
|
|
520
|
+
**示例:**
|
|
521
|
+
|
|
522
|
+
```python
|
|
523
|
+
volume = jbdevice.getVolume()
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
### setBrightness - 设置背光亮度。
|
|
527
|
+
|
|
528
|
+
范围 `0.0-1.0`。
|
|
529
|
+
|
|
530
|
+
```python
|
|
531
|
+
def setBrightness(brightness: float) -> bool:
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
**参数:**
|
|
535
|
+
|
|
536
|
+
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
537
|
+
| ------------ | ----- | -------- | ------ | -------- |
|
|
538
|
+
| `brightness` | float | 是 | - | 目标亮度 |
|
|
539
|
+
|
|
540
|
+
**返回值:**
|
|
541
|
+
|
|
542
|
+
| 类型 | 描述 |
|
|
543
|
+
| ---- | ------------- |
|
|
544
|
+
| bool | 成功为 `True` |
|
|
545
|
+
|
|
546
|
+
**示例:**
|
|
547
|
+
|
|
548
|
+
```python
|
|
549
|
+
jbdevice.setBrightness(0.5)
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
### getBrightness - 读取背光亮度。
|
|
553
|
+
|
|
554
|
+
范围 `0.0-1.0`。
|
|
555
|
+
|
|
556
|
+
```python
|
|
557
|
+
def getBrightness() -> float | None:
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
**返回值:**
|
|
561
|
+
|
|
562
|
+
| 类型 | 描述 |
|
|
563
|
+
| --------------- | -------------------------- |
|
|
564
|
+
| `float \| None` | 当前亮度;读不到返回 `None` |
|
|
565
|
+
|
|
566
|
+
**示例:**
|
|
567
|
+
|
|
568
|
+
```python
|
|
569
|
+
brightness = jbdevice.getBrightness()
|
|
570
|
+
```
|