ms-types 0.10.10 → 0.10.12
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 +1 -1
- package/types/cryptoUtils.d.ts +50 -36
- package/types/dotocr.d.ts +9 -2
- package/types/file.d.ts +1 -1
- package/types/hid.d.ts +46 -4
- package/types/hotUpdate.d.ts +0 -3
- package/types/image.d.ts +447 -447
- package/types/lua/action.lua +6 -6
- package/types/lua/ai.lua +3 -3
- package/types/lua/appleocr.lua +3 -3
- package/types/lua/cloud.lua +1 -1
- package/types/lua/cryptoUtils.lua +7 -7
- package/types/lua/cv.lua +142 -142
- package/types/lua/dotocr.lua +4 -4
- package/types/lua/file.lua +1 -1
- package/types/lua/global.lua +9 -7
- package/types/lua/hid.lua +22 -22
- package/types/lua/hotupdate.lua +7 -8
- package/types/lua/http.lua +27 -12
- package/types/lua/image.lua +23 -19
- package/types/lua/ime.lua +9 -9
- package/types/lua/media.lua +9 -9
- package/types/lua/mysql.lua +11 -11
- package/types/lua/netcard.lua +6 -6
- package/types/lua/node.lua +1 -1
- package/types/lua/paddleocr.lua +3 -3
- package/types/lua/pip.lua +6 -6
- package/types/lua/system.lua +23 -23
- package/types/lua/tomatoocr.lua +12 -17
- package/types/lua/tts.lua +3 -3
- package/types/lua/ui.lua +5 -5
- package/types/lua/yolo.lua +2 -2
- package/types/lua/yolocls.lua +2 -2
- package/types/mysql.d.ts +0 -2
- package/types/node.d.ts +1 -0
- package/types/opencv.d.ts +571 -38
- package/types/paddleocr.d.ts +1 -0
- package/types/pip.d.ts +11 -0
- package/types/system.d.ts +1 -0
- package/types/tomatoocr.d.ts +3 -41
- package/types/tts.d.ts +1 -1
- package/types/ui.d.ts +2 -0
- package/types/web.d.ts +16 -0
- package/types/yolo.d.ts +1 -1
- package/types/yoloCls.d.ts +1 -1
- package/types/zh/HID/346/250/241/345/235/227.d.ts +46 -4
- package/types/zh/MySql/346/250/241/345/235/227.d.ts +1 -3
- package/types/zh/PaddleOCR/346/250/241/345/235/227.d.ts +1 -0
- package/types/zh//345/212/250/344/275/234/346/250/241/345/235/227.d.ts +1 -1
- package/types/zh//345/233/276/347/211/207/346/250/241/345/235/227.d.ts +447 -447
- package/types/zh//346/202/254/346/265/256/347/252/227/346/250/241/345/235/227.d.ts +10 -0
- package/types/zh//346/226/207/344/273/266/346/250/241/345/235/227.d.ts +1 -1
- package/types/zh//347/202/271/351/230/265OCR/346/250/241/345/235/227.d.ts +9 -2
- package/types/zh//347/203/255/346/233/264/346/226/260/346/250/241/345/235/227.d.ts +0 -3
- package/types/zh//347/263/273/347/273/237/346/250/241/345/235/227.d.ts +1 -0
- package/types/zh//350/212/202/347/202/271/346/250/241/345/235/227.d.ts +1 -0
- package/types/zh//350/247/206/345/233/276/346/250/241/345/235/227.d.ts +2 -0
package/types/lua/media.lua
CHANGED
|
@@ -9,7 +9,7 @@ local _Media = {}
|
|
|
9
9
|
---@return boolean 是否播放成功
|
|
10
10
|
---@example local played = media.playMp3("music.mp3", true)
|
|
11
11
|
--- if played then
|
|
12
|
-
---
|
|
12
|
+
--- print("播放成功")
|
|
13
13
|
--- end
|
|
14
14
|
function _Media.playMp3(file, loop) return true end
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@ function _Media.playMp3(file, loop) return true end
|
|
|
17
17
|
---@return boolean 是否停止成功
|
|
18
18
|
---@example local stopped = media.stopMp3()
|
|
19
19
|
--- if stopped then
|
|
20
|
-
---
|
|
20
|
+
--- print("停止成功")
|
|
21
21
|
--- end
|
|
22
22
|
function _Media.stopMp3() return true end
|
|
23
23
|
|
|
@@ -26,7 +26,7 @@ function _Media.stopMp3() return true end
|
|
|
26
26
|
---@return boolean 是否正常播放到结尾
|
|
27
27
|
---@example local played = media.playMp3WaitEnd("music.mp3")
|
|
28
28
|
--- if played then
|
|
29
|
-
---
|
|
29
|
+
--- print("播放成功")
|
|
30
30
|
--- end
|
|
31
31
|
function _Media.playMp3WaitEnd(file) return true end
|
|
32
32
|
|
|
@@ -34,7 +34,7 @@ function _Media.playMp3WaitEnd(file) return true end
|
|
|
34
34
|
---@return boolean 是否正在播放
|
|
35
35
|
---@example local playing = media.isMp3Playing()
|
|
36
36
|
--- if playing then
|
|
37
|
-
---
|
|
37
|
+
--- print("正在播放")
|
|
38
38
|
--- end
|
|
39
39
|
function _Media.isMp3Playing() return true end
|
|
40
40
|
|
|
@@ -45,7 +45,7 @@ function _Media.isMp3Playing() return true end
|
|
|
45
45
|
--- if imageId then
|
|
46
46
|
--- local saved = media.saveImageToAlbum(imageId)
|
|
47
47
|
--- if saved then
|
|
48
|
-
---
|
|
48
|
+
--- print("保存成功")
|
|
49
49
|
--- end
|
|
50
50
|
--- end
|
|
51
51
|
function _Media.saveImageToAlbum(imageId) return true end
|
|
@@ -55,7 +55,7 @@ function _Media.saveImageToAlbum(imageId) return true end
|
|
|
55
55
|
---@return boolean 是否保存成功
|
|
56
56
|
---@example local saved = media.saveVideoToAlbumPath("video.mp4")
|
|
57
57
|
--- if saved then
|
|
58
|
-
---
|
|
58
|
+
--- print("保存成功")
|
|
59
59
|
--- end
|
|
60
60
|
function _Media.saveVideoToAlbumPath(path) return true end
|
|
61
61
|
|
|
@@ -63,7 +63,7 @@ function _Media.saveVideoToAlbumPath(path) return true end
|
|
|
63
63
|
---@return boolean 是否删除成功
|
|
64
64
|
---@example local deleted = media.deleteAllPhotos()
|
|
65
65
|
--- if deleted then
|
|
66
|
-
---
|
|
66
|
+
--- print("删除成功")
|
|
67
67
|
--- end
|
|
68
68
|
function _Media.deleteAllPhotos() return true end
|
|
69
69
|
|
|
@@ -71,7 +71,7 @@ function _Media.deleteAllPhotos() return true end
|
|
|
71
71
|
---@return boolean 是否删除成功
|
|
72
72
|
---@example local deleted = media.deleteAllVideos()
|
|
73
73
|
--- if deleted then
|
|
74
|
-
---
|
|
74
|
+
--- print("删除成功")
|
|
75
75
|
--- end
|
|
76
76
|
function _Media.deleteAllVideos() return true end
|
|
77
77
|
|
|
@@ -79,7 +79,7 @@ function _Media.deleteAllVideos() return true end
|
|
|
79
79
|
---@return boolean 是否删除成功
|
|
80
80
|
---@example local deleted = media.deleteAllScreenshots()
|
|
81
81
|
--- if deleted then
|
|
82
|
-
---
|
|
82
|
+
--- print("删除成功")
|
|
83
83
|
--- end
|
|
84
84
|
function _Media.deleteAllScreenshots() return true end
|
|
85
85
|
|
package/types/lua/mysql.lua
CHANGED
|
@@ -26,7 +26,7 @@ local _MySQL = {}
|
|
|
26
26
|
---@example local connected = mysql.connect({ host = "localhost", port = 3306, username = "root", password = "password", database = "test_db", charset = "utf8mb4" })
|
|
27
27
|
---
|
|
28
28
|
--- if connected then
|
|
29
|
-
---
|
|
29
|
+
--- print("数据库连接成功")
|
|
30
30
|
--- end
|
|
31
31
|
function _MySQL.connect(config) return true end
|
|
32
32
|
|
|
@@ -37,7 +37,7 @@ function _MySQL.disconnect() end
|
|
|
37
37
|
--- 是否连接
|
|
38
38
|
---@return boolean 是否已连接
|
|
39
39
|
---@example if mysql.isConnected() then
|
|
40
|
-
---
|
|
40
|
+
--- print("数据库已连接")
|
|
41
41
|
--- end
|
|
42
42
|
function _MySQL.isConnected() return false end
|
|
43
43
|
|
|
@@ -48,12 +48,12 @@ function _MySQL.isConnected() return false end
|
|
|
48
48
|
---@example local result = mysql.query("SELECT * FROM users")
|
|
49
49
|
--- result = mysql.query("SELECT * FROM users WHERE id = ?", {1})
|
|
50
50
|
--- if result.success then
|
|
51
|
-
---
|
|
51
|
+
--- print("查询到 " .. #result.rows .. " 条记录")
|
|
52
52
|
--- for _, row in ipairs(result.rows) do
|
|
53
|
-
---
|
|
53
|
+
--- print(row)
|
|
54
54
|
--- end
|
|
55
55
|
--- else
|
|
56
|
-
---
|
|
56
|
+
--- print("查询失败: " .. tostring(result.error))
|
|
57
57
|
--- end
|
|
58
58
|
function _MySQL.query(sql, params)
|
|
59
59
|
---@type MySQLResult
|
|
@@ -70,9 +70,9 @@ end
|
|
|
70
70
|
--- {"张三", "zhangsan@example.com"}
|
|
71
71
|
--- )
|
|
72
72
|
--- if result.success then
|
|
73
|
-
---
|
|
73
|
+
--- print("影响了 " .. tostring(result.affectedRows) .. " 行")
|
|
74
74
|
--- else
|
|
75
|
-
---
|
|
75
|
+
--- print("执行失败: " .. tostring(result.error))
|
|
76
76
|
--- end
|
|
77
77
|
function _MySQL.execute(sql, params)
|
|
78
78
|
---@type MySQLResult
|
|
@@ -86,10 +86,10 @@ end
|
|
|
86
86
|
--- mysql.execute("INSERT INTO users (name) VALUES (?)", {"用户1"})
|
|
87
87
|
--- mysql.execute("INSERT INTO users (name) VALUES (?)", {"用户2"})
|
|
88
88
|
--- if mysql.commit() then
|
|
89
|
-
---
|
|
89
|
+
--- print("事务提交成功")
|
|
90
90
|
--- else
|
|
91
91
|
--- mysql.rollback()
|
|
92
|
-
---
|
|
92
|
+
--- print("事务回滚")
|
|
93
93
|
--- end
|
|
94
94
|
--- end
|
|
95
95
|
function _MySQL.beginTransaction() return true end
|
|
@@ -99,7 +99,7 @@ function _MySQL.beginTransaction() return true end
|
|
|
99
99
|
---@example mysql.beginTransaction()
|
|
100
100
|
--- mysql.execute("INSERT INTO users (name) VALUES (?)", {"测试用户"})
|
|
101
101
|
--- if mysql.commit() then
|
|
102
|
-
---
|
|
102
|
+
--- print("事务提交成功")
|
|
103
103
|
--- end
|
|
104
104
|
function _MySQL.commit() return true end
|
|
105
105
|
|
|
@@ -108,7 +108,7 @@ function _MySQL.commit() return true end
|
|
|
108
108
|
---@example mysql.beginTransaction()
|
|
109
109
|
--- mysql.execute("INSERT INTO users (name) VALUES (?)", {"测试用户"})
|
|
110
110
|
--- if mysql.rollback() then
|
|
111
|
-
---
|
|
111
|
+
--- print("事务回滚成功")
|
|
112
112
|
--- end
|
|
113
113
|
function _MySQL.rollback() return true end
|
|
114
114
|
|
package/types/lua/netcard.lua
CHANGED
|
@@ -13,7 +13,7 @@ local _NetCard = {}
|
|
|
13
13
|
--- 当前是否为授权卡密模式
|
|
14
14
|
---@return boolean 当前 App 处于授权卡密模式返回 true,否则返回 false
|
|
15
15
|
---@example if netcard.isAuthCardMode() then
|
|
16
|
-
---
|
|
16
|
+
--- print("当前为授权卡密模式,不需要重复调用 verify")
|
|
17
17
|
--- end
|
|
18
18
|
function _NetCard.isAuthCardMode() return false end
|
|
19
19
|
|
|
@@ -21,13 +21,13 @@ function _NetCard.isAuthCardMode() return false end
|
|
|
21
21
|
---@param cardNo string 卡密
|
|
22
22
|
---@return boolean 是否验证成功
|
|
23
23
|
---@example local isVerified = netcard.verify("1234567890")
|
|
24
|
-
---
|
|
24
|
+
--- print(isVerified)
|
|
25
25
|
function _NetCard.verify(cardNo) return true end
|
|
26
26
|
|
|
27
27
|
--- 卡信息
|
|
28
28
|
---@return CardInfo|nil 卡密信息
|
|
29
29
|
---@example local cardInfo = netcard.getCardInfo()
|
|
30
|
-
---
|
|
30
|
+
--- print(ToJsonString(cardInfo))
|
|
31
31
|
function _NetCard.getCardInfo()
|
|
32
32
|
---@type CardInfo
|
|
33
33
|
local ret
|
|
@@ -38,7 +38,7 @@ end
|
|
|
38
38
|
---@param remark string 备注
|
|
39
39
|
---@return boolean 是否设置成功
|
|
40
40
|
---@example local isSet = netcard.setCardRemark("我的卡密")
|
|
41
|
-
---
|
|
41
|
+
--- print(isSet)
|
|
42
42
|
function _NetCard.setCardRemark(remark) return true end
|
|
43
43
|
|
|
44
44
|
--- 设置值
|
|
@@ -46,14 +46,14 @@ function _NetCard.setCardRemark(remark) return true end
|
|
|
46
46
|
---@param value string 值
|
|
47
47
|
---@return string 成功返回设置的value,失败返回空字符串
|
|
48
48
|
---@example local value = netcard.setValue("cardNo", "1234567890")
|
|
49
|
-
---
|
|
49
|
+
--- print(value)
|
|
50
50
|
function _NetCard.setValue(key, value) return '' end
|
|
51
51
|
|
|
52
52
|
--- 获取值
|
|
53
53
|
---@param key string 键
|
|
54
54
|
---@return string 成功返回值,失败返回空字符串
|
|
55
55
|
---@example local value = netcard.getValue("cardNo")
|
|
56
|
-
---
|
|
56
|
+
--- print(value)
|
|
57
57
|
function _NetCard.getValue(key) return '' end
|
|
58
58
|
|
|
59
59
|
---@type NetCard
|
package/types/lua/node.lua
CHANGED
|
@@ -77,7 +77,7 @@ local _Node = {}
|
|
|
77
77
|
--- 创建选择器。可用 `local selector <close> = ...` 自动释放,或用完后 `selector:releaseNode()` 手动释放。
|
|
78
78
|
---@param params SelectorParams|nil
|
|
79
79
|
---@return NodeSelector 选择器
|
|
80
|
-
---@example node.createNodeSelector(
|
|
80
|
+
---@example node.createNodeSelector({ maxDepth = 50, mode = 1 })
|
|
81
81
|
function _Node.createNodeSelector(params)
|
|
82
82
|
---@type NodeSelector
|
|
83
83
|
local ret
|
package/types/lua/paddleocr.lua
CHANGED
|
@@ -22,7 +22,7 @@ local _PaddleOCR = {}
|
|
|
22
22
|
---@param useGpu boolean|nil 是否使用GPU,默认false,可不传
|
|
23
23
|
---@return boolean 加载成功或目标模型已加载返回true
|
|
24
24
|
---@example local ok = paddleocr.loadModel("ppocr-v6-small", false)
|
|
25
|
-
---
|
|
25
|
+
--- print("PaddleOCR 模型加载结果: " .. ok)
|
|
26
26
|
function _PaddleOCR.loadModel(modelId, useGpu) return true end
|
|
27
27
|
|
|
28
28
|
--- 设置检测长边;0 或负数时使用 768
|
|
@@ -42,7 +42,7 @@ function _PaddleOCR.setMaxSideLen(maxSideLen) return true end
|
|
|
42
42
|
---@return PaddleOCRResult[] 识别结果数组,坐标为原图/全屏绝对坐标
|
|
43
43
|
---@example local results = paddleocr.recognizeAbs("screen", 100, 100, 500, 300)
|
|
44
44
|
--- if #results > 0 then
|
|
45
|
-
--- action.click(results[
|
|
45
|
+
--- action.click(results[1].centerX, results[1].centerY)
|
|
46
46
|
--- end
|
|
47
47
|
function _PaddleOCR.recognizeAbs(input, x, y, ex, ey, confidenceThreshold)
|
|
48
48
|
---@type PaddleOCRResult[]
|
|
@@ -62,7 +62,7 @@ end
|
|
|
62
62
|
---@return PaddleOCRResult[] 匹配到的子串结果数组,坐标为原图/全屏绝对坐标
|
|
63
63
|
---@example local results = paddleocr.findTextAbs("screen", {"确定"}, 100, 100, 500, 300, 0.6)
|
|
64
64
|
--- if #results > 0 then
|
|
65
|
-
--- action.click(results[
|
|
65
|
+
--- action.click(results[1].centerX, results[1].centerY)
|
|
66
66
|
--- end
|
|
67
67
|
function _PaddleOCR.findTextAbs(input, targets, x, y, ex, ey, confidenceThreshold, exactMatch)
|
|
68
68
|
---@type PaddleOCRResult[]
|
package/types/lua/pip.lua
CHANGED
|
@@ -32,37 +32,37 @@ function _Pip.closeWindow() return true end
|
|
|
32
32
|
---@param width number 宽度方向比例值(与 height 共同决定宽高比,不是像素)
|
|
33
33
|
---@param height number 高度方向比例值(与 width 共同决定宽高比,不是像素)
|
|
34
34
|
---@return boolean true代表尺寸已提交,false代表当前模式不允许设置或宽高无效
|
|
35
|
-
---@example pip.setContentSize(
|
|
35
|
+
---@example pip.setContentSize(200, 120)
|
|
36
36
|
function _Pip.setContentSize(width, height) return true end
|
|
37
37
|
|
|
38
38
|
--- 设置日志字号;缺省 8
|
|
39
39
|
---@param fontSize number|nil 日志字号,必须是有效数字
|
|
40
40
|
---@return boolean true代表日志文字大小已提交,false代表字号无效
|
|
41
|
-
---@example pip.setLogFontSize(
|
|
41
|
+
---@example pip.setLogFontSize(14)
|
|
42
42
|
function _Pip.setLogFontSize(fontSize) return true end
|
|
43
43
|
|
|
44
44
|
--- 设置自定义文本(不自动切模式)
|
|
45
45
|
---@param text string 要显示的文本,支持换行
|
|
46
46
|
---@return boolean true代表文本已提交
|
|
47
|
-
---@example pip.setCustomText(
|
|
47
|
+
---@example pip.setCustomText("hello")
|
|
48
48
|
function _Pip.setCustomText(text) return true end
|
|
49
49
|
|
|
50
50
|
--- 设置自定义文字颜色,支持 RRGGBB / RRGGBBAA
|
|
51
51
|
---@param color string 文字颜色,支持 RRGGBB、RRGGBBAA,可带 # 前缀;末尾 AA 为透明度
|
|
52
52
|
---@return boolean true代表文字颜色已提交
|
|
53
|
-
---@example pip.setCustomTextColor(
|
|
53
|
+
---@example pip.setCustomTextColor("#FFFFFF")
|
|
54
54
|
function _Pip.setCustomTextColor(color) return true end
|
|
55
55
|
|
|
56
56
|
--- 设置自定义文字大小;缺省 12
|
|
57
57
|
---@param fontSize number|nil 文字字号,必须是有效数字
|
|
58
58
|
---@return boolean true代表文字大小已提交,false代表字号无效
|
|
59
|
-
---@example pip.setCustomTextSize(
|
|
59
|
+
---@example pip.setCustomTextSize(14)
|
|
60
60
|
function _Pip.setCustomTextSize(fontSize) return true end
|
|
61
61
|
|
|
62
62
|
--- 设置自定义背景色
|
|
63
63
|
---@param color string 背景颜色,支持 RRGGBB、RRGGBBAA,可带 # 前缀;末尾 AA 为透明度
|
|
64
64
|
---@return boolean true代表背景色已提交
|
|
65
|
-
---@example pip.setCustomBackgroundColor(
|
|
65
|
+
---@example pip.setCustomBackgroundColor("#FFFFFF")
|
|
66
66
|
function _Pip.setCustomBackgroundColor(color) return true end
|
|
67
67
|
|
|
68
68
|
---@type Pip
|
package/types/lua/system.lua
CHANGED
|
@@ -19,7 +19,7 @@ local _System = {}
|
|
|
19
19
|
---@return boolean 是否启动成功
|
|
20
20
|
---@example local started = system.startApp("cn.magicnode.script")
|
|
21
21
|
--- if started then
|
|
22
|
-
---
|
|
22
|
+
--- print("启动成功")
|
|
23
23
|
--- end
|
|
24
24
|
function _System.startApp(bundleId) return true end
|
|
25
25
|
|
|
@@ -28,7 +28,7 @@ function _System.startApp(bundleId) return true end
|
|
|
28
28
|
---@return boolean 是否关闭成功
|
|
29
29
|
---@example local stopped = system.stopApp("cn.magicnode.script")
|
|
30
30
|
--- if stopped then
|
|
31
|
-
---
|
|
31
|
+
--- print("关闭成功")
|
|
32
32
|
--- end
|
|
33
33
|
function _System.stopApp(bundleId) return true end
|
|
34
34
|
|
|
@@ -37,7 +37,7 @@ function _System.stopApp(bundleId) return true end
|
|
|
37
37
|
---@return boolean 是否激活成功
|
|
38
38
|
---@example local activated = system.activateApp("cn.magicnode.script")
|
|
39
39
|
--- if activated then
|
|
40
|
-
---
|
|
40
|
+
--- print("激活成功")
|
|
41
41
|
--- end
|
|
42
42
|
function _System.activateApp(bundleId) return true end
|
|
43
43
|
|
|
@@ -45,7 +45,7 @@ function _System.activateApp(bundleId) return true end
|
|
|
45
45
|
---@return ActivateAppInfo|nil 当前在前台的应用信息
|
|
46
46
|
---@example local info = system.activateAppInfo()
|
|
47
47
|
--- if info then
|
|
48
|
-
---
|
|
48
|
+
--- print(info.name)
|
|
49
49
|
--- end
|
|
50
50
|
function _System.activateAppInfo()
|
|
51
51
|
---@type ActivateAppInfo
|
|
@@ -67,7 +67,7 @@ function _System.foregroundAppInfos() return {} end
|
|
|
67
67
|
---@return ActivateAppInfo[] 包含应用信息的字典数组,每个字典包含应用的Bundle ID和显示名称
|
|
68
68
|
---@example local apps = system.backgroundAppInfos()
|
|
69
69
|
--- if #apps > 0 then
|
|
70
|
-
---
|
|
70
|
+
--- print(apps[1].name)
|
|
71
71
|
--- end
|
|
72
72
|
function _System.backgroundAppInfos() return {} end
|
|
73
73
|
|
|
@@ -75,7 +75,7 @@ function _System.backgroundAppInfos() return {} end
|
|
|
75
75
|
---@return InstalledAppInfo[] 包含应用信息的字典数组,每个字典包含应用的Bundle ID和显示名称
|
|
76
76
|
---@example local apps = system.getInstalledAppList()
|
|
77
77
|
--- if #apps > 0 then
|
|
78
|
-
---
|
|
78
|
+
--- print(apps[1].appName)
|
|
79
79
|
--- end
|
|
80
80
|
function _System.getInstalledAppList() return {} end
|
|
81
81
|
|
|
@@ -83,7 +83,7 @@ function _System.getInstalledAppList() return {} end
|
|
|
83
83
|
---@return boolean 是否打开成功
|
|
84
84
|
---@example local opened = system.recent()
|
|
85
85
|
--- if opened then
|
|
86
|
-
---
|
|
86
|
+
--- print("打开成功")
|
|
87
87
|
--- end
|
|
88
88
|
function _System.recent() return true end
|
|
89
89
|
|
|
@@ -92,7 +92,7 @@ function _System.recent() return true end
|
|
|
92
92
|
---@return boolean 是否打开成功
|
|
93
93
|
---@example local opened = system.openURL("https://www.baidu.com")
|
|
94
94
|
--- if opened then
|
|
95
|
-
---
|
|
95
|
+
--- print("打开成功")
|
|
96
96
|
--- end
|
|
97
97
|
function _System.openURL(url) return true end
|
|
98
98
|
|
|
@@ -108,7 +108,7 @@ function _System.notify(msg, title, id) end
|
|
|
108
108
|
---@return boolean 是否设置成功
|
|
109
109
|
---@example local set = system.setClipboard("hello")
|
|
110
110
|
--- if set then
|
|
111
|
-
---
|
|
111
|
+
--- print("设置成功")
|
|
112
112
|
--- end
|
|
113
113
|
function _System.setClipboard(s) return true end
|
|
114
114
|
|
|
@@ -116,7 +116,7 @@ function _System.setClipboard(s) return true end
|
|
|
116
116
|
---@return string 剪贴板内容
|
|
117
117
|
---@example local text = system.getClipboard()
|
|
118
118
|
--- if text then
|
|
119
|
-
---
|
|
119
|
+
--- print(text)
|
|
120
120
|
--- end
|
|
121
121
|
function _System.getClipboard() return '' end
|
|
122
122
|
|
|
@@ -124,7 +124,7 @@ function _System.getClipboard() return '' end
|
|
|
124
124
|
---@return boolean 是否锁屏
|
|
125
125
|
---@example local locked = system.isLocked()
|
|
126
126
|
--- if locked then
|
|
127
|
-
---
|
|
127
|
+
--- print("锁屏")
|
|
128
128
|
--- end
|
|
129
129
|
function _System.isLocked() return false end
|
|
130
130
|
|
|
@@ -132,7 +132,7 @@ function _System.isLocked() return false end
|
|
|
132
132
|
---@return boolean 是否锁屏成功
|
|
133
133
|
---@example local locked = system.lock()
|
|
134
134
|
--- if locked then
|
|
135
|
-
---
|
|
135
|
+
--- print("锁屏成功")
|
|
136
136
|
--- end
|
|
137
137
|
function _System.lock() return true end
|
|
138
138
|
|
|
@@ -140,14 +140,14 @@ function _System.lock() return true end
|
|
|
140
140
|
---@return boolean 是否解锁成功
|
|
141
141
|
---@example local unlocked = system.unlock()
|
|
142
142
|
--- if unlocked then
|
|
143
|
-
---
|
|
143
|
+
--- print("解锁成功")
|
|
144
144
|
--- end
|
|
145
145
|
function _System.unlock() return true end
|
|
146
146
|
|
|
147
147
|
--- 获取内存使用信息(MB)
|
|
148
148
|
---@return MemoryInfo 内存使用信息,包含应用占用、系统可用/总量、系统已用和系统占用率(单位:MB)
|
|
149
149
|
---@example local memInfo = system.getMemoryInfo()
|
|
150
|
-
---
|
|
150
|
+
--- print("应用: " .. memInfo.used .. "MB, 系统: " .. memInfo.systemUsed .. "/" .. memInfo.total .. "MB, 占用: " .. memInfo.usagePercentage .. "%")
|
|
151
151
|
function _System.getMemoryInfo()
|
|
152
152
|
---@type MemoryInfo
|
|
153
153
|
local ret
|
|
@@ -157,38 +157,38 @@ end
|
|
|
157
157
|
--- 获取已使用内存(MB)
|
|
158
158
|
---@return integer 已使用内存大小(单位:MB)
|
|
159
159
|
---@example local usedMemory = system.getUsedMemory()
|
|
160
|
-
---
|
|
160
|
+
--- print("已使用内存: " .. usedMemory .. "MB")
|
|
161
161
|
function _System.getUsedMemory() return 0 end
|
|
162
162
|
|
|
163
163
|
--- 获取可用内存(MB)
|
|
164
164
|
---@return integer 可用内存大小(单位:MB)
|
|
165
165
|
---@example local availableMemory = system.getAvailableMemory()
|
|
166
|
-
---
|
|
166
|
+
--- print("可用内存: " .. availableMemory .. "MB")
|
|
167
167
|
function _System.getAvailableMemory() return 0 end
|
|
168
168
|
|
|
169
169
|
--- 获取系统总内存(MB)
|
|
170
170
|
---@return integer 系统总内存大小(单位:MB)
|
|
171
171
|
---@example local totalMemory = system.getTotalMemory()
|
|
172
|
-
---
|
|
172
|
+
--- print("系统总内存: " .. totalMemory .. "MB")
|
|
173
173
|
function _System.getTotalMemory() return 0 end
|
|
174
174
|
|
|
175
175
|
--- 获取系统已用内存(MB)
|
|
176
176
|
---@return number 系统已用内存大小(单位:MB,物理内存总量减去可用内存)
|
|
177
177
|
---@example local systemUsed = system.getSystemUsedMemory()
|
|
178
|
-
---
|
|
178
|
+
--- print("系统已用内存: " .. systemUsed .. "MB")
|
|
179
179
|
function _System.getSystemUsedMemory() return 0 end
|
|
180
180
|
|
|
181
181
|
--- 获取 CPU 使用率
|
|
182
182
|
---@return number 当前应用 CPU 使用率(百分比)
|
|
183
183
|
---@example local cpuUsage = system.getCpuUsage()
|
|
184
|
-
---
|
|
184
|
+
--- print("CPU 使用率: " .. cpuUsage .. "%")
|
|
185
185
|
function _System.getCpuUsage() return 0 end
|
|
186
186
|
|
|
187
187
|
--- 启动 Agent 服务
|
|
188
188
|
---@return boolean 是否启动成功
|
|
189
189
|
---@example local started = system.startAgent()
|
|
190
190
|
--- if started then
|
|
191
|
-
---
|
|
191
|
+
--- print("Agent 启动成功")
|
|
192
192
|
--- end
|
|
193
193
|
function _System.startAgent() return true end
|
|
194
194
|
|
|
@@ -196,9 +196,9 @@ function _System.startAgent() return true end
|
|
|
196
196
|
---@return boolean Agent 是否正在运行
|
|
197
197
|
---@example local isRunning = system.getAgentStatus()
|
|
198
198
|
--- if isRunning then
|
|
199
|
-
---
|
|
199
|
+
--- print("Agent 服务正在运行")
|
|
200
200
|
--- else
|
|
201
|
-
---
|
|
201
|
+
--- print("Agent 服务未运行")
|
|
202
202
|
--- end
|
|
203
203
|
function _System.getAgentStatus() return false end
|
|
204
204
|
|
|
@@ -206,7 +206,7 @@ function _System.getAgentStatus() return false end
|
|
|
206
206
|
---@return boolean 是否关闭成功
|
|
207
207
|
---@example local stopped = system.stopAgent()
|
|
208
208
|
--- if stopped then
|
|
209
|
-
---
|
|
209
|
+
--- print("Agent 服务关闭成功")
|
|
210
210
|
--- end
|
|
211
211
|
function _System.stopAgent() return true end
|
|
212
212
|
|
package/types/lua/tomatoocr.lua
CHANGED
|
@@ -15,11 +15,9 @@ local _TomatoOCR = {}
|
|
|
15
15
|
---@param licenseData string 授权码 请传入你在 TomatoOCR 官网申请的授权码
|
|
16
16
|
---@param remark string|nil 备注信息(可选)
|
|
17
17
|
---@return TomatoInitResult|nil 设置结果
|
|
18
|
-
---@example
|
|
19
|
-
--- local result1 = tomatoocr.initializeWithConfig("online", "授权码")
|
|
20
|
-
--- -- 带备注
|
|
18
|
+
---@example local result1 = tomatoocr.initializeWithConfig("online", "授权码")
|
|
21
19
|
--- local result2 = tomatoocr.initializeWithConfig("online", "授权码", "测试环境")
|
|
22
|
-
---
|
|
20
|
+
--- print(result1, result2)
|
|
23
21
|
function _TomatoOCR.initializeWithConfig(mode, licenseData, remark) return nil end
|
|
24
22
|
|
|
25
23
|
--- 设置HTTP间隔
|
|
@@ -29,8 +27,7 @@ function _TomatoOCR.setHttpIntervalTime(v) end
|
|
|
29
27
|
|
|
30
28
|
--- 设置识别类型
|
|
31
29
|
---@param s string 识别类型 模型类型,默认 ch-3.0,除此之外还有 ch-2.0, ch, cht, japan, korean, number
|
|
32
|
-
---@example
|
|
33
|
-
--- tomatoocr.setRecType("ch-3.0")
|
|
30
|
+
---@example tomatoocr.setRecType("ch-3.0")
|
|
34
31
|
--- -- 普通中英文识别,2.0版模型
|
|
35
32
|
--- tomatoocr.setRecType("ch-2.0")
|
|
36
33
|
--- -- 普通中英文识别,1.0版模型
|
|
@@ -47,8 +44,7 @@ function _TomatoOCR.setRecType(s) end
|
|
|
47
44
|
|
|
48
45
|
--- 设置检测框类型
|
|
49
46
|
---@param s string 检测框类型 默认"rect": 由于手机上截图文本均为矩形文本;"quad":可准确检测倾斜文本
|
|
50
|
-
---@example
|
|
51
|
-
--- tomatoocr.setDetBoxType("rect")
|
|
47
|
+
---@example tomatoocr.setDetBoxType("rect")
|
|
52
48
|
--- -- 倾斜文本
|
|
53
49
|
--- tomatoocr.setDetBoxType("quad")
|
|
54
50
|
function _TomatoOCR.setDetBoxType(s) end
|
|
@@ -98,29 +94,28 @@ function _TomatoOCR.setFilterColor(filterColor, backgroundColor) end
|
|
|
98
94
|
---@param ex integer 边界框右下角x坐标
|
|
99
95
|
---@param ey integer 边界框右下角y坐标
|
|
100
96
|
---@return string OCR识别结果JSON字符串
|
|
101
|
-
---@example
|
|
102
|
-
---
|
|
103
|
-
--- logi("识别屏幕结果:" .. result1)
|
|
97
|
+
---@example local result1 = tomatoocr.ocrImage("screen", 3)
|
|
98
|
+
--- print("识别屏幕结果:" .. result1)
|
|
104
99
|
--- -- 识别文件
|
|
105
|
-
--- local result2 = tomatoocr.ocrImage("/path/to/image.png",
|
|
106
|
-
---
|
|
100
|
+
--- local result2 = tomatoocr.ocrImage("/path/to/image.png", 3)
|
|
101
|
+
--- print("识别文件结果:" .. result2)
|
|
107
102
|
--- -- 识别指定屏幕区域
|
|
108
|
-
--- local result3 = tomatoocr.ocrImage("screen",
|
|
109
|
-
---
|
|
103
|
+
--- local result3 = tomatoocr.ocrImage("screen", 3, 100, 100, 500, 300)
|
|
104
|
+
--- print("识别指定屏幕区域结果:" .. result3)
|
|
110
105
|
function _TomatoOCR.ocrImage(input, type, x, y, ex, ey) return '' end
|
|
111
106
|
|
|
112
107
|
--- 查找点击点
|
|
113
108
|
---@param js string 要找的文字
|
|
114
109
|
---@return string 找“要找的文字”的中心点 没有找到返回空字符串
|
|
115
110
|
---@example local result = tomatoocr.findTapPoint('{"text": "确定"}')
|
|
116
|
-
---
|
|
111
|
+
--- print(result)
|
|
117
112
|
function _TomatoOCR.findTapPoint(js) return '' end
|
|
118
113
|
|
|
119
114
|
--- 查找多个点击点
|
|
120
115
|
---@param js string 要找的文字
|
|
121
116
|
---@return string 找“要找的文字”的所有相匹配的中心点 没有找到返回空字符串
|
|
122
117
|
---@example local result = tomatoocr.findTapPoints('{"texts": ["确定", "取消"]}')
|
|
123
|
-
---
|
|
118
|
+
--- print(result)
|
|
124
119
|
function _TomatoOCR.findTapPoints(js) return '' end
|
|
125
120
|
|
|
126
121
|
--- 释放已加载的 OCR 模型和内部资源
|
package/types/lua/tts.lua
CHANGED
|
@@ -30,7 +30,7 @@ function _TTS.stop() end
|
|
|
30
30
|
--- 是否正在说话
|
|
31
31
|
---@return boolean 是否正在播放
|
|
32
32
|
---@example if tts.isSpeaking() then
|
|
33
|
-
---
|
|
33
|
+
--- print("正在播放")
|
|
34
34
|
--- end
|
|
35
35
|
function _TTS.isSpeaking() return false end
|
|
36
36
|
|
|
@@ -39,7 +39,7 @@ function _TTS.isSpeaking() return false end
|
|
|
39
39
|
---@return boolean 是否设置成功
|
|
40
40
|
---@example local success = tts.setVoice("com.apple.ttsbundle.siri_Yu-shu_zh-CN_compact")
|
|
41
41
|
--- if success then
|
|
42
|
-
---
|
|
42
|
+
--- print("语音设置成功")
|
|
43
43
|
--- end
|
|
44
44
|
function _TTS.setVoice(voice) return true end
|
|
45
45
|
|
|
@@ -47,7 +47,7 @@ function _TTS.setVoice(voice) return true end
|
|
|
47
47
|
---@return VoiceInfo[] 语音信息数组
|
|
48
48
|
---@example local voices = tts.getAvailableVoices()
|
|
49
49
|
--- for _, voice in ipairs(voices) do
|
|
50
|
-
---
|
|
50
|
+
--- print("语音: " .. voice.name .. ", 语言: " .. voice.language)
|
|
51
51
|
--- end
|
|
52
52
|
function _TTS.getAvailableVoices() return {} end
|
|
53
53
|
|
package/types/lua/ui.lua
CHANGED
|
@@ -22,9 +22,9 @@ function _UI.showToast(message) end
|
|
|
22
22
|
---@return boolean 用户选择结果,确定返回true,取消返回false
|
|
23
23
|
---@example local result = ui.confirm("确认", "是否继续操作?")
|
|
24
24
|
--- if result then
|
|
25
|
-
---
|
|
25
|
+
--- print("用户点击了确定")
|
|
26
26
|
--- else
|
|
27
|
-
---
|
|
27
|
+
--- print("用户点击了取消")
|
|
28
28
|
--- end
|
|
29
29
|
function _UI.confirm(title, message) return false end
|
|
30
30
|
|
|
@@ -34,9 +34,9 @@ function _UI.confirm(title, message) return false end
|
|
|
34
34
|
---@return string 用户输入的内容,取消返回空字符串
|
|
35
35
|
---@example local input = ui.confirmInput("输入", "请输入您的姓名:")
|
|
36
36
|
--- if input then
|
|
37
|
-
---
|
|
37
|
+
--- print("用户输入了:" .. input)
|
|
38
38
|
--- else
|
|
39
|
-
---
|
|
39
|
+
--- print("用户取消了输入")
|
|
40
40
|
--- end
|
|
41
41
|
function _UI.confirmInput(title, message) return '' end
|
|
42
42
|
|
|
@@ -49,7 +49,7 @@ function _UI.alert(title, message) end
|
|
|
49
49
|
--- 事件监听
|
|
50
50
|
---@param callback UIEventCallback 事件回调函数,传入 null 会取消监听
|
|
51
51
|
---@example ui.onEvent(function(event, data)
|
|
52
|
-
---
|
|
52
|
+
--- print("event: " .. event, data)
|
|
53
53
|
--- end)
|
|
54
54
|
function _UI.onEvent(callback) end
|
|
55
55
|
|
package/types/lua/yolo.lua
CHANGED
|
@@ -38,13 +38,13 @@ function _Yolo.load(paramPath, binPath, nc, version, useGpu) return nil end
|
|
|
38
38
|
---@return YoloResult[] 检测结果数组,坐标为原图/全屏绝对坐标
|
|
39
39
|
---@example local results = yolo.detectAbs(modelId, "screen", 100, 100, 500, 400, 640, 0.4, 0.5)
|
|
40
40
|
--- if #results > 0 then
|
|
41
|
-
--- action.click(results[
|
|
41
|
+
--- action.click(results[1].centerX, results[1].centerY)
|
|
42
42
|
--- end
|
|
43
43
|
function _Yolo.detectAbs(id, input, x, y, ex, ey, target, thr, nms) return {} end
|
|
44
44
|
|
|
45
45
|
--- 释放模型
|
|
46
46
|
---@param id string 模型ID
|
|
47
|
-
---@example yolo.free(modelId)
|
|
47
|
+
---@example yolo.free("modelId")
|
|
48
48
|
function _Yolo.free(id) end
|
|
49
49
|
|
|
50
50
|
--- 释放全部模型
|
package/types/lua/yolocls.lua
CHANGED
|
@@ -26,7 +26,7 @@ function _YoloCls.load(paramPath, binPath, nc, useGpu) return nil end
|
|
|
26
26
|
---@return YoloClsProbs Ultralytics Probs 风格分类概率结果
|
|
27
27
|
---@example local result = yolocls.classify(modelId, "screen", 224)
|
|
28
28
|
--- if result.top1 ~= nil then
|
|
29
|
-
---
|
|
29
|
+
--- print(result.top1 .. ": " .. result.top1conf)
|
|
30
30
|
--- end
|
|
31
31
|
function _YoloCls.classify(modelId, img, targetSize)
|
|
32
32
|
---@type YoloClsProbs
|
|
@@ -50,7 +50,7 @@ end
|
|
|
50
50
|
|
|
51
51
|
--- 释放指定模型
|
|
52
52
|
---@param modelId string 模型 ID
|
|
53
|
-
---@example yolocls.free(modelId)
|
|
53
|
+
---@example yolocls.free("modelId")
|
|
54
54
|
function _YoloCls.free(modelId) end
|
|
55
55
|
|
|
56
56
|
--- 释放全部模型
|
package/types/mysql.d.ts
CHANGED
|
@@ -83,7 +83,6 @@ declare namespace mysql {
|
|
|
83
83
|
* @param params 查询参数数组,可选
|
|
84
84
|
* @returns 查询结果对象
|
|
85
85
|
* @example
|
|
86
|
-
* // 简单查询
|
|
87
86
|
* const result = mysql.query("SELECT * FROM users")
|
|
88
87
|
*
|
|
89
88
|
* // 带参数查询
|
|
@@ -107,7 +106,6 @@ declare namespace mysql {
|
|
|
107
106
|
* @param params 参数数组,可选
|
|
108
107
|
* @returns 执行结果对象
|
|
109
108
|
* @example
|
|
110
|
-
* // 插入数据
|
|
111
109
|
* const result = mysql.execute(
|
|
112
110
|
* "INSERT INTO users (name, email) VALUES (?, ?)",
|
|
113
111
|
* ["张三", "zhangsan@example.com"]
|