ms-types 0.1.23 → 0.1.26
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/package.json +20 -20
- package/types/action.d.ts +298 -298
- package/types/{appleocr.d.ts → appleOcr.d.ts} +102 -102
- package/types/config.d.ts +54 -54
- package/types/device.d.ts +105 -105
- package/types/global.d.ts +185 -185
- package/types/hid.d.ts +289 -289
- package/types/hotUpdate.d.ts +104 -104
- package/types/http.d.ts +300 -300
- package/types/ime.d.ts +99 -99
- package/types/index.d.ts +26 -26
- package/types/media.d.ts +90 -90
- package/types/mysql.d.ts +174 -174
- package/types/netCard.d.ts +77 -42
- package/types/node.d.ts +279 -279
- package/types/{paddleocr.d.ts → paddleOcr.d.ts} +73 -73
- package/types/pip.d.ts +51 -51
- package/types/system.d.ts +195 -195
- package/types/thread.d.ts +101 -101
- package/types/{tomatoocr.d.ts → tomatoOcr.d.ts} +199 -199
- package/types/tts.d.ts +91 -91
- package/types/ui.d.ts +165 -165
- package/types/yolo.d.ts +98 -98
- package/types/zh/HID/346/250/241/345/235/227.d.ts +293 -293
- package/types/zh/HTTP/346/250/241/345/235/227.d.ts +301 -301
- package/types/zh/{MySql → MySQL}/346/250/241/345/235/227.d.ts +175 -175
- package/types/zh/PaddleOCR/346/250/241/345/235/227.d.ts +74 -74
- package/types/zh/YOLO/346/250/241/345/235/227.d.ts +101 -101
- package/types/zh/index.d.ts +24 -24
- package/types/zh//345/205/250/345/261/200/346/250/241/345/235/227.d.ts +180 -180
- package/types/zh//345/212/250/344/275/234/346/250/241/345/235/227.d.ts +300 -300
- package/types/zh//345/215/241/345/257/206/346/250/241/345/235/227.d.ts +90 -55
- package/types/zh//345/252/222/344/275/223/346/250/241/345/235/227.d.ts +91 -91
- package/types/zh//345/267/245/345/205/267/346/250/241/345/235/227.d.ts +30 -30
- package/types/zh//346/202/254/346/265/256/347/252/227/346/250/241/345/235/227.d.ts +55 -55
- package/types/zh//346/226/207/345/255/227/350/275/254/350/257/255/351/237/263/346/250/241/345/235/227.d.ts +92 -92
- package/types/zh//347/203/255/346/233/264/346/226/260/346/250/241/345/235/227.d.ts +105 -105
- package/types/zh//347/263/273/347/273/237/346/250/241/345/235/227.d.ts +194 -194
- package/types/zh//347/272/277/347/250/213/346/250/241/345/235/227.d.ts +102 -102
- package/types/zh//350/212/202/347/202/271/346/250/241/345/235/227.d.ts +280 -280
- package/types/zh//350/213/271/346/236/234OCR.d.ts +104 -104
- package/types/zh//350/247/206/345/233/276/346/250/241/345/235/227.d.ts +167 -167
- package/types/zh//350/256/276/345/244/207/346/250/241/345/235/227.d.ts +106 -106
- package/types/zh//350/276/223/345/205/245/346/263/225/346/250/241/345/235/227.d.ts +100 -100
- package/types/zh//351/205/215/347/275/256/346/250/241/345/235/227.d.ts +56 -56
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Apple OCR模块 使用Apple Vision框架进行文本识别
|
|
3
|
-
*/
|
|
4
|
-
declare namespace appleOcr {
|
|
5
|
-
/**
|
|
6
|
-
* OCR识别结果接口
|
|
7
|
-
*/
|
|
8
|
-
interface OCRResult {
|
|
9
|
-
/** 识别的文本内容 */
|
|
10
|
-
text: string;
|
|
11
|
-
/** 识别置信度 (0-1) */
|
|
12
|
-
confidence: number;
|
|
13
|
-
/** 文本区域左上角 x 坐标 */
|
|
14
|
-
x: number;
|
|
15
|
-
/** 文本区域左上角 y 坐标 */
|
|
16
|
-
y: number;
|
|
17
|
-
/** 文本区域右下角 x 坐标 */
|
|
18
|
-
ex: number;
|
|
19
|
-
/** 文本区域右下角 y 坐标 */
|
|
20
|
-
ey: number;
|
|
21
|
-
/** 文本区域宽度 */
|
|
22
|
-
width: number;
|
|
23
|
-
/** 文本区域高度 */
|
|
24
|
-
height: number;
|
|
25
|
-
/** 文本区域中心点 x 坐标 */
|
|
26
|
-
centerX: number;
|
|
27
|
-
/** 文本区域中心点 y 坐标 */
|
|
28
|
-
centerY: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 执行OCR识别(使用Apple Vision框架)
|
|
33
|
-
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
34
|
-
* @param x 边界框左上角x坐标 默认 0
|
|
35
|
-
* @param y 边界框左上角y坐标 默认 0
|
|
36
|
-
* @param ex 边界框右下角x坐标 默认 0
|
|
37
|
-
* @param ey 边界框右下角y坐标 默认 0
|
|
38
|
-
* @param languages 识别语言数组,默认为["zh-Hans", "en-US"]
|
|
39
|
-
* @returns 识别结果数组,包含文本、置信度、坐标等信息
|
|
40
|
-
* @example
|
|
41
|
-
* const results = appleOcr.recognize("screen", 0, 0, 100, 100, ["zh-Hans", "en-US"])
|
|
42
|
-
* results.forEach(result => {
|
|
43
|
-
* logi(`文本: ${result.text}, 置信度: ${result.confidence}`)
|
|
44
|
-
* })
|
|
45
|
-
*/
|
|
46
|
-
function recognize(
|
|
47
|
-
input: string,
|
|
48
|
-
x?: number,
|
|
49
|
-
y?: number,
|
|
50
|
-
ex?: number,
|
|
51
|
-
ey?: number,
|
|
52
|
-
languages?: string[]
|
|
53
|
-
): OCRResult[];
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* 执行OCR识别(仅识别数字)0-9.,+-
|
|
57
|
-
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
58
|
-
* @param x 边界框左上角x坐标
|
|
59
|
-
* @param y 边界框左上角y坐标
|
|
60
|
-
* @param ex 边界框右下角x坐标
|
|
61
|
-
* @param ey 边界框右下角y坐标
|
|
62
|
-
* @returns 识别结果数组,包含文本、置信度、坐标等信息
|
|
63
|
-
* @example
|
|
64
|
-
* const results = appleOcr.recognizeNumbers("screen", 0, 0, 100, 100)
|
|
65
|
-
* results.forEach(result => {
|
|
66
|
-
* logi(`文本: ${result.text}, 置信度: ${result.confidence}`)
|
|
67
|
-
* })
|
|
68
|
-
*/
|
|
69
|
-
function recognizeNumbers(
|
|
70
|
-
input: string,
|
|
71
|
-
x?: number,
|
|
72
|
-
y?: number,
|
|
73
|
-
ex?: number,
|
|
74
|
-
ey?: number
|
|
75
|
-
): OCRResult[];
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* 执行OCR识别(查找指定文本)
|
|
79
|
-
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
80
|
-
* @param texts 要查找的文本数组
|
|
81
|
-
* @param x 边界框左上角x坐标
|
|
82
|
-
* @param y 边界框左上角y坐标
|
|
83
|
-
* @param ex 边界框右下角x坐标
|
|
84
|
-
* @param ey 边界框右下角y坐标
|
|
85
|
-
* @param languages 识别语言数组,默认为["zh-Hans", "en-US"]
|
|
86
|
-
* @returns 识别结果数组,包含文本、置信度、坐标等信息
|
|
87
|
-
* @example
|
|
88
|
-
* const results = appleOcr.findText("screen", ["123", "456"], 0, 0, 100, 100, ["zh-Hans", "en-US"])
|
|
89
|
-
* results.forEach(result => {
|
|
90
|
-
* logi(`文本: ${result.text}, 置信度: ${result.confidence}`)
|
|
91
|
-
* })
|
|
92
|
-
*/
|
|
93
|
-
function findText(
|
|
94
|
-
input: string,
|
|
95
|
-
texts: string[],
|
|
96
|
-
x?: number,
|
|
97
|
-
y?: number,
|
|
98
|
-
ex?: number,
|
|
99
|
-
ey?: number,
|
|
100
|
-
languages?: string[]
|
|
101
|
-
): OCRResult[];
|
|
102
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Apple OCR模块 使用Apple Vision框架进行文本识别
|
|
3
|
+
*/
|
|
4
|
+
declare namespace appleOcr {
|
|
5
|
+
/**
|
|
6
|
+
* OCR识别结果接口
|
|
7
|
+
*/
|
|
8
|
+
interface OCRResult {
|
|
9
|
+
/** 识别的文本内容 */
|
|
10
|
+
text: string;
|
|
11
|
+
/** 识别置信度 (0-1) */
|
|
12
|
+
confidence: number;
|
|
13
|
+
/** 文本区域左上角 x 坐标 */
|
|
14
|
+
x: number;
|
|
15
|
+
/** 文本区域左上角 y 坐标 */
|
|
16
|
+
y: number;
|
|
17
|
+
/** 文本区域右下角 x 坐标 */
|
|
18
|
+
ex: number;
|
|
19
|
+
/** 文本区域右下角 y 坐标 */
|
|
20
|
+
ey: number;
|
|
21
|
+
/** 文本区域宽度 */
|
|
22
|
+
width: number;
|
|
23
|
+
/** 文本区域高度 */
|
|
24
|
+
height: number;
|
|
25
|
+
/** 文本区域中心点 x 坐标 */
|
|
26
|
+
centerX: number;
|
|
27
|
+
/** 文本区域中心点 y 坐标 */
|
|
28
|
+
centerY: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 执行OCR识别(使用Apple Vision框架)
|
|
33
|
+
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
34
|
+
* @param x 边界框左上角x坐标 默认 0
|
|
35
|
+
* @param y 边界框左上角y坐标 默认 0
|
|
36
|
+
* @param ex 边界框右下角x坐标 默认 0
|
|
37
|
+
* @param ey 边界框右下角y坐标 默认 0
|
|
38
|
+
* @param languages 识别语言数组,默认为["zh-Hans", "en-US"]
|
|
39
|
+
* @returns 识别结果数组,包含文本、置信度、坐标等信息
|
|
40
|
+
* @example
|
|
41
|
+
* const results = appleOcr.recognize("screen", 0, 0, 100, 100, ["zh-Hans", "en-US"])
|
|
42
|
+
* results.forEach(result => {
|
|
43
|
+
* logi(`文本: ${result.text}, 置信度: ${result.confidence}`)
|
|
44
|
+
* })
|
|
45
|
+
*/
|
|
46
|
+
function recognize(
|
|
47
|
+
input: string,
|
|
48
|
+
x?: number,
|
|
49
|
+
y?: number,
|
|
50
|
+
ex?: number,
|
|
51
|
+
ey?: number,
|
|
52
|
+
languages?: string[]
|
|
53
|
+
): OCRResult[];
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 执行OCR识别(仅识别数字)0-9.,+-
|
|
57
|
+
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
58
|
+
* @param x 边界框左上角x坐标
|
|
59
|
+
* @param y 边界框左上角y坐标
|
|
60
|
+
* @param ex 边界框右下角x坐标
|
|
61
|
+
* @param ey 边界框右下角y坐标
|
|
62
|
+
* @returns 识别结果数组,包含文本、置信度、坐标等信息
|
|
63
|
+
* @example
|
|
64
|
+
* const results = appleOcr.recognizeNumbers("screen", 0, 0, 100, 100)
|
|
65
|
+
* results.forEach(result => {
|
|
66
|
+
* logi(`文本: ${result.text}, 置信度: ${result.confidence}`)
|
|
67
|
+
* })
|
|
68
|
+
*/
|
|
69
|
+
function recognizeNumbers(
|
|
70
|
+
input: string,
|
|
71
|
+
x?: number,
|
|
72
|
+
y?: number,
|
|
73
|
+
ex?: number,
|
|
74
|
+
ey?: number
|
|
75
|
+
): OCRResult[];
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 执行OCR识别(查找指定文本)
|
|
79
|
+
* @param input 输入源(imageId、URL字符串、文件路径或"screen","screen"表示使用当前屏幕)
|
|
80
|
+
* @param texts 要查找的文本数组
|
|
81
|
+
* @param x 边界框左上角x坐标
|
|
82
|
+
* @param y 边界框左上角y坐标
|
|
83
|
+
* @param ex 边界框右下角x坐标
|
|
84
|
+
* @param ey 边界框右下角y坐标
|
|
85
|
+
* @param languages 识别语言数组,默认为["zh-Hans", "en-US"]
|
|
86
|
+
* @returns 识别结果数组,包含文本、置信度、坐标等信息
|
|
87
|
+
* @example
|
|
88
|
+
* const results = appleOcr.findText("screen", ["123", "456"], 0, 0, 100, 100, ["zh-Hans", "en-US"])
|
|
89
|
+
* results.forEach(result => {
|
|
90
|
+
* logi(`文本: ${result.text}, 置信度: ${result.confidence}`)
|
|
91
|
+
* })
|
|
92
|
+
*/
|
|
93
|
+
function findText(
|
|
94
|
+
input: string,
|
|
95
|
+
texts: string[],
|
|
96
|
+
x?: number,
|
|
97
|
+
y?: number,
|
|
98
|
+
ex?: number,
|
|
99
|
+
ey?: number,
|
|
100
|
+
languages?: string[]
|
|
101
|
+
): OCRResult[];
|
|
102
|
+
}
|
package/types/config.d.ts
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 配置模块 包含读取配置、更新配置、删除配置等功能
|
|
3
|
-
*/
|
|
4
|
-
declare namespace config {
|
|
5
|
-
/**
|
|
6
|
-
* 读取配置Int
|
|
7
|
-
* @param key 配置key
|
|
8
|
-
* @returns 配置值
|
|
9
|
-
* @example config.readConfigInt("key")
|
|
10
|
-
*/
|
|
11
|
-
function readConfigInt(key: string): number;
|
|
12
|
-
/**
|
|
13
|
-
* 读取配置Double
|
|
14
|
-
* @param key 配置key
|
|
15
|
-
* @returns 配置值
|
|
16
|
-
* @example config.readConfigDouble("key")
|
|
17
|
-
*/
|
|
18
|
-
function readConfigDouble(key: string): number;
|
|
19
|
-
/**
|
|
20
|
-
* 读取配置String
|
|
21
|
-
* @param key 配置key
|
|
22
|
-
* @returns 配置值,如果不存在返回 null
|
|
23
|
-
* @example config.readConfigString("key")
|
|
24
|
-
*/
|
|
25
|
-
function readConfigString(key: string): string | null;
|
|
26
|
-
/**
|
|
27
|
-
* 读取配置Bool
|
|
28
|
-
* @param key 配置key
|
|
29
|
-
* @returns 配置值
|
|
30
|
-
* @example config.readConfigBool("key")
|
|
31
|
-
*/
|
|
32
|
-
function readConfigBool(key: string): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* 获取所有配置JSON
|
|
35
|
-
* @returns 所有配置JSON
|
|
36
|
-
* @example config.getConfigJSON()
|
|
37
|
-
*/
|
|
38
|
-
function getConfigJSON(): Record<string, any>;
|
|
39
|
-
/**
|
|
40
|
-
* 更新配置
|
|
41
|
-
* @param key 配置key
|
|
42
|
-
* @param value 配置值
|
|
43
|
-
* @returns 更新是否成功
|
|
44
|
-
* @example config.updateConfig("key", 100)
|
|
45
|
-
*/
|
|
46
|
-
function updateConfig(key: string, value: any): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* 删除配置
|
|
49
|
-
* @param key 配置key
|
|
50
|
-
* @returns 删除是否成功
|
|
51
|
-
* @example config.deleteConfig("key")
|
|
52
|
-
*/
|
|
53
|
-
function deleteConfig(key: string): boolean;
|
|
54
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 配置模块 包含读取配置、更新配置、删除配置等功能
|
|
3
|
+
*/
|
|
4
|
+
declare namespace config {
|
|
5
|
+
/**
|
|
6
|
+
* 读取配置Int
|
|
7
|
+
* @param key 配置key
|
|
8
|
+
* @returns 配置值
|
|
9
|
+
* @example config.readConfigInt("key")
|
|
10
|
+
*/
|
|
11
|
+
function readConfigInt(key: string): number;
|
|
12
|
+
/**
|
|
13
|
+
* 读取配置Double
|
|
14
|
+
* @param key 配置key
|
|
15
|
+
* @returns 配置值
|
|
16
|
+
* @example config.readConfigDouble("key")
|
|
17
|
+
*/
|
|
18
|
+
function readConfigDouble(key: string): number;
|
|
19
|
+
/**
|
|
20
|
+
* 读取配置String
|
|
21
|
+
* @param key 配置key
|
|
22
|
+
* @returns 配置值,如果不存在返回 null
|
|
23
|
+
* @example config.readConfigString("key")
|
|
24
|
+
*/
|
|
25
|
+
function readConfigString(key: string): string | null;
|
|
26
|
+
/**
|
|
27
|
+
* 读取配置Bool
|
|
28
|
+
* @param key 配置key
|
|
29
|
+
* @returns 配置值
|
|
30
|
+
* @example config.readConfigBool("key")
|
|
31
|
+
*/
|
|
32
|
+
function readConfigBool(key: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 获取所有配置JSON
|
|
35
|
+
* @returns 所有配置JSON
|
|
36
|
+
* @example config.getConfigJSON()
|
|
37
|
+
*/
|
|
38
|
+
function getConfigJSON(): Record<string, any>;
|
|
39
|
+
/**
|
|
40
|
+
* 更新配置
|
|
41
|
+
* @param key 配置key
|
|
42
|
+
* @param value 配置值
|
|
43
|
+
* @returns 更新是否成功
|
|
44
|
+
* @example config.updateConfig("key", 100)
|
|
45
|
+
*/
|
|
46
|
+
function updateConfig(key: string, value: any): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 删除配置
|
|
49
|
+
* @param key 配置key
|
|
50
|
+
* @returns 删除是否成功
|
|
51
|
+
* @example config.deleteConfig("key")
|
|
52
|
+
*/
|
|
53
|
+
function deleteConfig(key: string): boolean;
|
|
54
|
+
}
|
package/types/device.d.ts
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 设备模块 包含获取设备信息、设备操作等功能
|
|
3
|
-
*/
|
|
4
|
-
declare namespace device {
|
|
5
|
-
/**
|
|
6
|
-
* 获取电池信息
|
|
7
|
-
* @returns 电池信息
|
|
8
|
-
* @example device.getBatteryInfo()
|
|
9
|
-
*/
|
|
10
|
-
function getBatteryInfo(): {
|
|
11
|
-
/**
|
|
12
|
-
* 电池电量
|
|
13
|
-
*/
|
|
14
|
-
level: number;
|
|
15
|
-
/**
|
|
16
|
-
* 是否充电
|
|
17
|
-
*/
|
|
18
|
-
isCharging: boolean;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* 获取设备ID
|
|
22
|
-
* @returns 设备ID
|
|
23
|
-
* @example device.getDeviceID()
|
|
24
|
-
*/
|
|
25
|
-
function getDeviceID(): string;
|
|
26
|
-
/**
|
|
27
|
-
* 获取服务器设备ID
|
|
28
|
-
* @returns 服务器设备ID
|
|
29
|
-
* @example device.getServerDeviceId()
|
|
30
|
-
*/
|
|
31
|
-
function getServerDeviceId(): string;
|
|
32
|
-
/**
|
|
33
|
-
* 获取设备名称
|
|
34
|
-
* @returns 设备名称
|
|
35
|
-
* @example device.getDeviceName()
|
|
36
|
-
*/
|
|
37
|
-
function getDeviceName(): string;
|
|
38
|
-
/**
|
|
39
|
-
* 获取设备型号
|
|
40
|
-
* @returns 设备型号
|
|
41
|
-
* @example device.getDeviceModel()
|
|
42
|
-
*/
|
|
43
|
-
function getDeviceModel(): string;
|
|
44
|
-
/**
|
|
45
|
-
* 获取屏幕宽高
|
|
46
|
-
* @returns 获取屏幕宽高缩放后的,实际宽高,请使用`getScreenRealSize()`获取未缩放的宽高
|
|
47
|
-
* @example device.getScreenSize()
|
|
48
|
-
*/
|
|
49
|
-
function getScreenSize(): {
|
|
50
|
-
/**
|
|
51
|
-
* 屏幕宽度
|
|
52
|
-
*/
|
|
53
|
-
width: number;
|
|
54
|
-
/**
|
|
55
|
-
* 屏幕高度
|
|
56
|
-
*/
|
|
57
|
-
height: number;
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* 获取屏幕实际大小
|
|
61
|
-
* @returns 屏幕实际大小
|
|
62
|
-
* @example device.getScreenRealSize()
|
|
63
|
-
*/
|
|
64
|
-
function getScreenRealSize(): {
|
|
65
|
-
/**
|
|
66
|
-
* 屏幕宽度
|
|
67
|
-
*/
|
|
68
|
-
width: number;
|
|
69
|
-
/**
|
|
70
|
-
* 屏幕高度
|
|
71
|
-
*/
|
|
72
|
-
height: number;
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* 获取屏幕缩放比例
|
|
76
|
-
* @returns 屏幕缩放比例
|
|
77
|
-
* @example device.getScreenScale()
|
|
78
|
-
*/
|
|
79
|
-
function getScreenScale(): number;
|
|
80
|
-
/**
|
|
81
|
-
* 获取屏幕方向 PORTRAIT 竖屏 LANDSCAPE 横屏
|
|
82
|
-
* @returns 设备方向
|
|
83
|
-
* @example device.getOrientation()
|
|
84
|
-
*/
|
|
85
|
-
function getOrientation(): "PORTRAIT" | "LANDSCAPE";
|
|
86
|
-
/**
|
|
87
|
-
* 获取系统版本 例如 16.7.11
|
|
88
|
-
* @returns 系统版本
|
|
89
|
-
* @example device.getOSVersion()
|
|
90
|
-
*/
|
|
91
|
-
function getOSVersion(): string;
|
|
92
|
-
/**
|
|
93
|
-
* 获取局域网IP 例如 192.168.1.100
|
|
94
|
-
* @returns 局域网IP
|
|
95
|
-
* @example device.getLanIp()
|
|
96
|
-
*/
|
|
97
|
-
function getLanIp(): string;
|
|
98
|
-
/**
|
|
99
|
-
* 振动
|
|
100
|
-
* @param duration 持续时间 单位毫秒
|
|
101
|
-
* @param intensity 强度 0.0-1.0
|
|
102
|
-
* @example device.vibrate(1000, 0.5)
|
|
103
|
-
*/
|
|
104
|
-
function vibrate(duration: number, intensity: number): void | Promise<void>;
|
|
105
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 设备模块 包含获取设备信息、设备操作等功能
|
|
3
|
+
*/
|
|
4
|
+
declare namespace device {
|
|
5
|
+
/**
|
|
6
|
+
* 获取电池信息
|
|
7
|
+
* @returns 电池信息
|
|
8
|
+
* @example device.getBatteryInfo()
|
|
9
|
+
*/
|
|
10
|
+
function getBatteryInfo(): {
|
|
11
|
+
/**
|
|
12
|
+
* 电池电量
|
|
13
|
+
*/
|
|
14
|
+
level: number;
|
|
15
|
+
/**
|
|
16
|
+
* 是否充电
|
|
17
|
+
*/
|
|
18
|
+
isCharging: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* 获取设备ID
|
|
22
|
+
* @returns 设备ID
|
|
23
|
+
* @example device.getDeviceID()
|
|
24
|
+
*/
|
|
25
|
+
function getDeviceID(): string;
|
|
26
|
+
/**
|
|
27
|
+
* 获取服务器设备ID
|
|
28
|
+
* @returns 服务器设备ID
|
|
29
|
+
* @example device.getServerDeviceId()
|
|
30
|
+
*/
|
|
31
|
+
function getServerDeviceId(): string;
|
|
32
|
+
/**
|
|
33
|
+
* 获取设备名称
|
|
34
|
+
* @returns 设备名称
|
|
35
|
+
* @example device.getDeviceName()
|
|
36
|
+
*/
|
|
37
|
+
function getDeviceName(): string;
|
|
38
|
+
/**
|
|
39
|
+
* 获取设备型号
|
|
40
|
+
* @returns 设备型号
|
|
41
|
+
* @example device.getDeviceModel()
|
|
42
|
+
*/
|
|
43
|
+
function getDeviceModel(): string;
|
|
44
|
+
/**
|
|
45
|
+
* 获取屏幕宽高
|
|
46
|
+
* @returns 获取屏幕宽高缩放后的,实际宽高,请使用`getScreenRealSize()`获取未缩放的宽高
|
|
47
|
+
* @example device.getScreenSize()
|
|
48
|
+
*/
|
|
49
|
+
function getScreenSize(): {
|
|
50
|
+
/**
|
|
51
|
+
* 屏幕宽度
|
|
52
|
+
*/
|
|
53
|
+
width: number;
|
|
54
|
+
/**
|
|
55
|
+
* 屏幕高度
|
|
56
|
+
*/
|
|
57
|
+
height: number;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* 获取屏幕实际大小
|
|
61
|
+
* @returns 屏幕实际大小
|
|
62
|
+
* @example device.getScreenRealSize()
|
|
63
|
+
*/
|
|
64
|
+
function getScreenRealSize(): {
|
|
65
|
+
/**
|
|
66
|
+
* 屏幕宽度
|
|
67
|
+
*/
|
|
68
|
+
width: number;
|
|
69
|
+
/**
|
|
70
|
+
* 屏幕高度
|
|
71
|
+
*/
|
|
72
|
+
height: number;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* 获取屏幕缩放比例
|
|
76
|
+
* @returns 屏幕缩放比例
|
|
77
|
+
* @example device.getScreenScale()
|
|
78
|
+
*/
|
|
79
|
+
function getScreenScale(): number;
|
|
80
|
+
/**
|
|
81
|
+
* 获取屏幕方向 PORTRAIT 竖屏 LANDSCAPE 横屏
|
|
82
|
+
* @returns 设备方向
|
|
83
|
+
* @example device.getOrientation()
|
|
84
|
+
*/
|
|
85
|
+
function getOrientation(): "PORTRAIT" | "LANDSCAPE";
|
|
86
|
+
/**
|
|
87
|
+
* 获取系统版本 例如 16.7.11
|
|
88
|
+
* @returns 系统版本
|
|
89
|
+
* @example device.getOSVersion()
|
|
90
|
+
*/
|
|
91
|
+
function getOSVersion(): string;
|
|
92
|
+
/**
|
|
93
|
+
* 获取局域网IP 例如 192.168.1.100
|
|
94
|
+
* @returns 局域网IP
|
|
95
|
+
* @example device.getLanIp()
|
|
96
|
+
*/
|
|
97
|
+
function getLanIp(): string;
|
|
98
|
+
/**
|
|
99
|
+
* 振动
|
|
100
|
+
* @param duration 持续时间 单位毫秒
|
|
101
|
+
* @param intensity 强度 0.0-1.0
|
|
102
|
+
* @example device.vibrate(1000, 0.5)
|
|
103
|
+
*/
|
|
104
|
+
function vibrate(duration: number, intensity: number): void | Promise<void>;
|
|
105
|
+
}
|