ms-types 0.9.24 → 0.9.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 +1 -1
- package/types/dotocr.d.ts +1 -1
- package/types/image.d.ts +30 -24
- package/types/lua/README.md +13 -0
- package/types/lua/action.lua +232 -0
- package/types/lua/alias/cv.lua +2 -0
- package/types/lua/alias/dotOcr.lua +2 -0
- package/types/lua/alias/yoloCls.lua +2 -0
- package/types/lua/appleocr.lua +115 -0
- package/types/lua/cloud.lua +32 -0
- package/types/lua/config.lua +34 -0
- package/types/lua/cryptoUtils.lua +47 -0
- package/types/lua/device.lua +105 -0
- package/types/lua/dotocr.lua +46 -0
- package/types/lua/file.lua +96 -0
- package/types/lua/global.lua +122 -0
- package/types/lua/hid.lua +274 -0
- package/types/lua/hotupdate.lua +23 -0
- package/types/lua/http.lua +144 -0
- package/types/lua/image.lua +205 -0
- package/types/lua/ime.lua +48 -0
- package/types/lua/logger.lua +48 -0
- package/types/lua/media.lua +46 -0
- package/types/lua/mysql.lua +64 -0
- package/types/lua/netcard.lua +45 -0
- package/types/lua/node.lua +74 -0
- package/types/lua/opencv.lua +729 -0
- package/types/lua/paddleocr.lua +99 -0
- package/types/lua/pip.lua +56 -0
- package/types/lua/system.lua +139 -0
- package/types/lua/tomatoocr.lua +83 -0
- package/types/lua/tts.lua +42 -0
- package/types/lua/ui.lua +46 -0
- package/types/lua/utils.lua +49 -0
- package/types/lua/yolo.lua +63 -0
- package/types/lua/yolocls.lua +41 -0
- package/types/zh//345/233/276/347/211/207/346/250/241/345/235/227.d.ts +30 -24
- package/types/zh//347/202/271/351/230/265OCR/346/250/241/345/235/227.d.ts +1 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---@meta paddleocr
|
|
2
|
+
---@class PaddleOCR
|
|
3
|
+
local _PaddleOCR = {}
|
|
4
|
+
|
|
5
|
+
---@class PaddleOCRResult
|
|
6
|
+
---@field text string 识别的文本内容
|
|
7
|
+
---@field confidence number 识别置信度 (0-1)
|
|
8
|
+
---@field x integer 文本区域左上角 x 坐标
|
|
9
|
+
---@field y integer 文本区域左上角 y 坐标
|
|
10
|
+
---@field ex integer 文本区域右下角 x 坐标
|
|
11
|
+
---@field ey integer 文本区域右下角 y 坐标
|
|
12
|
+
---@field width integer 文本区域宽度
|
|
13
|
+
---@field height integer 文本区域高度
|
|
14
|
+
---@field centerX integer 文本区域中心点 x 坐标
|
|
15
|
+
---@field centerY integer 文本区域中心点 y 坐标
|
|
16
|
+
---@field angle number 文本旋转角度 (度)
|
|
17
|
+
---@field orientation integer 文本方向 (0=水平,1=垂直 等)
|
|
18
|
+
|
|
19
|
+
--- 加载 V5 模型
|
|
20
|
+
--- @param maxSideLen integer|nil 目标边长,默认 640
|
|
21
|
+
--- @param useGpu boolean|nil 是否启用 GPU,默认 false
|
|
22
|
+
--- @return boolean 成功
|
|
23
|
+
function _PaddleOCR.loadV5(maxSideLen, useGpu) return true end
|
|
24
|
+
|
|
25
|
+
--- 按内置模型 ID 加载
|
|
26
|
+
--- @param modelId string `"ppocr-v6-tiny"` / `"ppocr-v6-small"` / `"ppocr-v5"`
|
|
27
|
+
--- @param useGpu boolean|nil 是否启用 GPU,默认 false
|
|
28
|
+
--- @return boolean 成功
|
|
29
|
+
function _PaddleOCR.loadModel(modelId, useGpu) return true end
|
|
30
|
+
|
|
31
|
+
--- 设置检测长边;0 或负数时使用 768
|
|
32
|
+
--- @param maxSideLen integer|nil
|
|
33
|
+
--- @return boolean 成功
|
|
34
|
+
function _PaddleOCR.setMaxSideLen(maxSideLen) return true end
|
|
35
|
+
|
|
36
|
+
--- 识别文本
|
|
37
|
+
--- @param input string 图像ID或路径
|
|
38
|
+
--- @param x integer|nil 默认0
|
|
39
|
+
--- @param y integer|nil 默认0
|
|
40
|
+
--- @param ex integer|nil 默认0
|
|
41
|
+
--- @param ey integer|nil 默认0
|
|
42
|
+
--- @param confidenceThreshold number|nil 置信阈值 默认0.6
|
|
43
|
+
--- @return PaddleOCRResult[] 结果数组
|
|
44
|
+
function _PaddleOCR.recognize(input, x, y, ex, ey, confidenceThreshold)
|
|
45
|
+
---@type PaddleOCRResult[]
|
|
46
|
+
local ret = {}
|
|
47
|
+
return ret
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
--- 识别文本,坐标映射为原图/全屏绝对坐标
|
|
51
|
+
--- @param input string 图像ID或路径
|
|
52
|
+
--- @param x integer|nil 默认0
|
|
53
|
+
--- @param y integer|nil 默认0
|
|
54
|
+
--- @param ex integer|nil 默认0
|
|
55
|
+
--- @param ey integer|nil 默认0
|
|
56
|
+
--- @param confidenceThreshold number|nil 置信阈值 默认0.6
|
|
57
|
+
--- @return PaddleOCRResult[] 结果数组
|
|
58
|
+
function _PaddleOCR.recognizeAbs(input, x, y, ex, ey, confidenceThreshold)
|
|
59
|
+
---@type PaddleOCRResult[]
|
|
60
|
+
local ret = {}
|
|
61
|
+
return ret
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
--- 查找目标文本
|
|
65
|
+
--- @param input string 图像ID或路径
|
|
66
|
+
--- @param targets string[]|string 目标文本数组或逗号分隔字符串
|
|
67
|
+
--- @param x integer|nil 默认0
|
|
68
|
+
--- @param y integer|nil 默认0
|
|
69
|
+
--- @param ex integer|nil 默认0
|
|
70
|
+
--- @param ey integer|nil 默认0
|
|
71
|
+
--- @param confidenceThreshold number|nil 置信阈值 默认0.6
|
|
72
|
+
--- @param exactMatch boolean|nil 是否完整匹配,默认 false
|
|
73
|
+
--- @return PaddleOCRResult[] 结果数组
|
|
74
|
+
function _PaddleOCR.findText(input, targets, x, y, ex, ey, confidenceThreshold, exactMatch)
|
|
75
|
+
---@type PaddleOCRResult[]
|
|
76
|
+
local ret = {}
|
|
77
|
+
return ret
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
--- 查找目标文本,坐标映射为原图/全屏绝对坐标
|
|
81
|
+
--- @param input string 图像ID或路径
|
|
82
|
+
--- @param targets string[]|string 目标文本数组或逗号分隔字符串
|
|
83
|
+
--- @param x integer|nil 默认0
|
|
84
|
+
--- @param y integer|nil 默认0
|
|
85
|
+
--- @param ex integer|nil 默认0
|
|
86
|
+
--- @param ey integer|nil 默认0
|
|
87
|
+
--- @param confidenceThreshold number|nil 置信阈值 默认0.6
|
|
88
|
+
--- @param exactMatch boolean|nil 是否完整匹配,默认 false
|
|
89
|
+
--- @return PaddleOCRResult[] 结果数组
|
|
90
|
+
function _PaddleOCR.findTextAbs(input, targets, x, y, ex, ey, confidenceThreshold, exactMatch)
|
|
91
|
+
---@type PaddleOCRResult[]
|
|
92
|
+
local ret = {}
|
|
93
|
+
return ret
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
--- 释放资源
|
|
97
|
+
function _PaddleOCR.free() end
|
|
98
|
+
|
|
99
|
+
return _PaddleOCR
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---@meta pip
|
|
2
|
+
---@class Pip
|
|
3
|
+
local _Pip = {}
|
|
4
|
+
|
|
5
|
+
--- 悬浮窗是否打开
|
|
6
|
+
---@return boolean
|
|
7
|
+
function _Pip.isPipActive() return false end
|
|
8
|
+
|
|
9
|
+
--- 切换到日志模式(首次显示时 App 须在前台)
|
|
10
|
+
---@return boolean
|
|
11
|
+
function _Pip.switchToLogMode() return true end
|
|
12
|
+
|
|
13
|
+
--- 切换到保活模式(首次显示时 App 须在前台)
|
|
14
|
+
---@return boolean
|
|
15
|
+
function _Pip.switchToKeepAliveMode() return true end
|
|
16
|
+
|
|
17
|
+
--- 切换到自定义模式(首次显示时 App 须在前台)
|
|
18
|
+
---@return boolean
|
|
19
|
+
function _Pip.switchToCustomMode() return true end
|
|
20
|
+
|
|
21
|
+
--- 关闭悬浮窗
|
|
22
|
+
---@return boolean
|
|
23
|
+
function _Pip.closeWindow() return true end
|
|
24
|
+
|
|
25
|
+
--- 设置日志/自定义模式内容宽高比(不是最终像素)
|
|
26
|
+
---@param width number
|
|
27
|
+
---@param height number
|
|
28
|
+
---@return boolean
|
|
29
|
+
function _Pip.setContentSize(width, height) return true end
|
|
30
|
+
|
|
31
|
+
--- 设置日志字号;缺省 8
|
|
32
|
+
---@param fontSize number|nil
|
|
33
|
+
---@return boolean
|
|
34
|
+
function _Pip.setLogFontSize(fontSize) return true end
|
|
35
|
+
|
|
36
|
+
--- 设置自定义文本(不自动切模式)
|
|
37
|
+
---@param text string
|
|
38
|
+
---@return boolean
|
|
39
|
+
function _Pip.setCustomText(text) return true end
|
|
40
|
+
|
|
41
|
+
--- 设置自定义文字颜色,支持 RRGGBB / RRGGBBAA
|
|
42
|
+
---@param color string
|
|
43
|
+
---@return boolean
|
|
44
|
+
function _Pip.setCustomTextColor(color) return true end
|
|
45
|
+
|
|
46
|
+
--- 设置自定义文字大小;缺省 12
|
|
47
|
+
---@param fontSize number|nil
|
|
48
|
+
---@return boolean
|
|
49
|
+
function _Pip.setCustomTextSize(fontSize) return true end
|
|
50
|
+
|
|
51
|
+
--- 设置自定义背景色
|
|
52
|
+
---@param color string
|
|
53
|
+
---@return boolean
|
|
54
|
+
function _Pip.setCustomBackgroundColor(color) return true end
|
|
55
|
+
|
|
56
|
+
return _Pip
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---@meta system
|
|
2
|
+
---@class System
|
|
3
|
+
local _System = {}
|
|
4
|
+
|
|
5
|
+
---@class ProcessArguments
|
|
6
|
+
---@field env table<string, any> 环境变量映射(键为字符串,值为任意类型)
|
|
7
|
+
---@field args string[] 启动参数列表
|
|
8
|
+
|
|
9
|
+
---@class ActivateAppInfo
|
|
10
|
+
---@field name string 应用名称
|
|
11
|
+
---@field pid integer 进程 ID
|
|
12
|
+
---@field bundleId string 应用 Bundle ID
|
|
13
|
+
---@field processArguments ProcessArguments 启动参数信息
|
|
14
|
+
|
|
15
|
+
---@class MemoryInfo
|
|
16
|
+
---@field used integer 已使用内存(MB)
|
|
17
|
+
---@field available integer 可用内存(MB)
|
|
18
|
+
---@field total integer 系统总内存(MB)
|
|
19
|
+
---@field usagePercentage integer 使用率(0-100)
|
|
20
|
+
|
|
21
|
+
--- 启动应用
|
|
22
|
+
--- @param bundleId string 应用 Bundle ID
|
|
23
|
+
--- @param args string[]|nil 启动参数
|
|
24
|
+
--- @param env table<string, any>|nil 环境变量
|
|
25
|
+
--- @return boolean 成功
|
|
26
|
+
function _System.startApp(bundleId, args, env) return true end
|
|
27
|
+
|
|
28
|
+
--- 停止应用
|
|
29
|
+
--- @param bundleId string 应用 Bundle ID
|
|
30
|
+
--- @return boolean 成功
|
|
31
|
+
function _System.stopApp(bundleId) return true end
|
|
32
|
+
|
|
33
|
+
--- 激活应用到前台(未启动则启动)
|
|
34
|
+
--- @param bundleId string 应用 Bundle ID
|
|
35
|
+
--- @return boolean 成功
|
|
36
|
+
function _System.activateApp(bundleId) return true end
|
|
37
|
+
|
|
38
|
+
--- 获取当前运行的应用信息(可能为 nil)
|
|
39
|
+
--- @return ActivateAppInfo|nil 信息
|
|
40
|
+
function _System.activateAppInfo()
|
|
41
|
+
---@type ActivateAppInfo
|
|
42
|
+
local info
|
|
43
|
+
return info
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
--- 前台运行的应用列表
|
|
47
|
+
--- @return ActivateAppInfo[] 列表
|
|
48
|
+
function _System.foregroundAppInfos() return {} end
|
|
49
|
+
|
|
50
|
+
---@class InstalledAppInfo
|
|
51
|
+
---@field bundleVersion string 版本
|
|
52
|
+
---@field appName string 应用名
|
|
53
|
+
---@field bundleIdentifier string Bundle ID
|
|
54
|
+
|
|
55
|
+
--- 后台运行的应用列表
|
|
56
|
+
--- @return ActivateAppInfo[] 列表
|
|
57
|
+
function _System.backgroundAppInfos() return {} end
|
|
58
|
+
|
|
59
|
+
--- 已安装应用列表
|
|
60
|
+
--- @return InstalledAppInfo[] 列表
|
|
61
|
+
function _System.getInstalledAppList() return {} end
|
|
62
|
+
|
|
63
|
+
--- 打开 App 切换器
|
|
64
|
+
--- @return boolean 成功
|
|
65
|
+
function _System.recent() return true end
|
|
66
|
+
|
|
67
|
+
--- 使用系统浏览器打开 URL
|
|
68
|
+
--- @param url string 链接
|
|
69
|
+
--- @return boolean 成功
|
|
70
|
+
function _System.openURL(url) return true end
|
|
71
|
+
|
|
72
|
+
--- 发送系统通知(后台生效)
|
|
73
|
+
--- @param msg string 内容
|
|
74
|
+
--- @param title string|nil 标题,空或 "undefined" 使用应用名称
|
|
75
|
+
--- @param id string|nil 通知 ID,相同 ID 覆盖
|
|
76
|
+
function _System.notify(msg, title, id) end
|
|
77
|
+
|
|
78
|
+
--- 设置剪贴板文本(仅前台有效)
|
|
79
|
+
--- @param s string 内容
|
|
80
|
+
--- @return boolean 成功
|
|
81
|
+
function _System.setClipboard(s) return true end
|
|
82
|
+
|
|
83
|
+
--- 获取剪贴板文本(仅前台有效)
|
|
84
|
+
--- @return string 内容
|
|
85
|
+
function _System.getClipboard() return '' end
|
|
86
|
+
|
|
87
|
+
--- 是否锁屏
|
|
88
|
+
--- @return boolean 锁定
|
|
89
|
+
function _System.isLocked() return false end
|
|
90
|
+
|
|
91
|
+
--- 锁屏
|
|
92
|
+
--- @return boolean 成功
|
|
93
|
+
function _System.lock() return true end
|
|
94
|
+
|
|
95
|
+
--- 解锁
|
|
96
|
+
--- @return boolean 成功
|
|
97
|
+
function _System.unlock() return true end
|
|
98
|
+
|
|
99
|
+
--- 获取内存使用信息(MB)
|
|
100
|
+
--- @return MemoryInfo 信息
|
|
101
|
+
function _System.getMemoryInfo()
|
|
102
|
+
---@type MemoryInfo
|
|
103
|
+
local ret
|
|
104
|
+
return ret
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
--- 获取已使用内存(MB)
|
|
108
|
+
--- @return integer MB
|
|
109
|
+
function _System.getUsedMemory() return 0 end
|
|
110
|
+
|
|
111
|
+
--- 获取可用内存(MB)
|
|
112
|
+
--- @return integer MB
|
|
113
|
+
function _System.getAvailableMemory() return 0 end
|
|
114
|
+
|
|
115
|
+
--- 获取系统总内存(MB)
|
|
116
|
+
--- @return integer MB
|
|
117
|
+
function _System.getTotalMemory() return 0 end
|
|
118
|
+
|
|
119
|
+
--- 获取系统已用内存(MB)
|
|
120
|
+
--- @return number MB
|
|
121
|
+
function _System.getSystemUsedMemory() return 0 end
|
|
122
|
+
|
|
123
|
+
--- 获取 CPU 使用率
|
|
124
|
+
--- @return number 使用率
|
|
125
|
+
function _System.getCpuUsage() return 0 end
|
|
126
|
+
|
|
127
|
+
--- 启动 Agent 服务
|
|
128
|
+
--- @return boolean 成功
|
|
129
|
+
function _System.startAgent() return true end
|
|
130
|
+
|
|
131
|
+
--- 获取 Agent 状态(是否正在运行)
|
|
132
|
+
--- @return boolean 运行中
|
|
133
|
+
function _System.getAgentStatus() return false end
|
|
134
|
+
|
|
135
|
+
--- 停止 Agent 服务
|
|
136
|
+
--- @return boolean 成功
|
|
137
|
+
function _System.stopAgent() return true end
|
|
138
|
+
|
|
139
|
+
return _System
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---@meta tomatoocr
|
|
2
|
+
---@class TomatoOCR
|
|
3
|
+
local _TomatoOCR = {}
|
|
4
|
+
|
|
5
|
+
---@class TomatoInitResult
|
|
6
|
+
---@field deviceId string 设备 ID
|
|
7
|
+
---@field expiryTime string 过期时间
|
|
8
|
+
---@field message string 信息
|
|
9
|
+
---@field status string 状态
|
|
10
|
+
---@field versionName string 版本名称
|
|
11
|
+
|
|
12
|
+
--- 初始化 TomatoOCR 并设置基本配置
|
|
13
|
+
--- @param mode string 运行模式(例如 "fast")
|
|
14
|
+
--- @param licenseData string 许可证数据
|
|
15
|
+
--- @param remark string|nil 备注(nil/"" 为不传)
|
|
16
|
+
--- @return TomatoInitResult|nil 初始化结果(表),失败返回 nil
|
|
17
|
+
function _TomatoOCR.initializeWithConfig(mode, licenseData, remark) return nil end
|
|
18
|
+
|
|
19
|
+
--- 设置HTTP间隔
|
|
20
|
+
--- @param v number 秒
|
|
21
|
+
function _TomatoOCR.setHttpIntervalTime(v) end
|
|
22
|
+
|
|
23
|
+
--- 设置识别类型
|
|
24
|
+
--- @param s string 类型
|
|
25
|
+
function _TomatoOCR.setRecType(s) end
|
|
26
|
+
|
|
27
|
+
--- 设置检测框类型
|
|
28
|
+
--- @param s string 类型(rect/quad)
|
|
29
|
+
function _TomatoOCR.setDetBoxType(s) end
|
|
30
|
+
|
|
31
|
+
--- 设置检测框展开比例
|
|
32
|
+
--- @param v number 比例(建议 1.6-2.5)
|
|
33
|
+
function _TomatoOCR.setDetUnclipRatio(v) end
|
|
34
|
+
|
|
35
|
+
--- 设置检测框缩放比例
|
|
36
|
+
--- @param v number 缩放比例
|
|
37
|
+
function _TomatoOCR.setDetScaleRatio(v) end
|
|
38
|
+
|
|
39
|
+
--- 设置识别分数阈值
|
|
40
|
+
--- @param v number 阈值(默认 0.1)
|
|
41
|
+
function _TomatoOCR.setRecScoreThreshold(v) end
|
|
42
|
+
|
|
43
|
+
--- 设置返回类型
|
|
44
|
+
--- @param s string 类型
|
|
45
|
+
function _TomatoOCR.setReturnType(s) end
|
|
46
|
+
|
|
47
|
+
--- 设置二值化阈值
|
|
48
|
+
--- @param v number 阈值(0-255)
|
|
49
|
+
function _TomatoOCR.setBinaryThresh(v) end
|
|
50
|
+
|
|
51
|
+
--- 设置运行模式
|
|
52
|
+
--- @param s string 模式(如 fast)
|
|
53
|
+
function _TomatoOCR.setRunMode(s) end
|
|
54
|
+
|
|
55
|
+
--- 设置图像滤色参数
|
|
56
|
+
--- @param filterColor string 过滤颜色(多色用 | 连接)
|
|
57
|
+
--- @param backgroundColor string 背景颜色
|
|
58
|
+
function _TomatoOCR.setFilterColor(filterColor, backgroundColor) end
|
|
59
|
+
|
|
60
|
+
--- OCR识别
|
|
61
|
+
--- @param input string 图像ID或路径
|
|
62
|
+
--- @param type integer 类型
|
|
63
|
+
--- @param x integer
|
|
64
|
+
--- @param y integer
|
|
65
|
+
--- @param ex integer
|
|
66
|
+
--- @param ey integer
|
|
67
|
+
--- @return string JSON结果
|
|
68
|
+
function _TomatoOCR.ocrImage(input, type, x, y, ex, ey) return '' end
|
|
69
|
+
|
|
70
|
+
--- 查找点击点
|
|
71
|
+
--- @param js string JSON配置
|
|
72
|
+
--- @return string JSON结果
|
|
73
|
+
function _TomatoOCR.findTapPoint(js) return '' end
|
|
74
|
+
|
|
75
|
+
--- 查找多个点击点
|
|
76
|
+
--- @param js string JSON配置
|
|
77
|
+
--- @return string JSON结果
|
|
78
|
+
function _TomatoOCR.findTapPoints(js) return '' end
|
|
79
|
+
|
|
80
|
+
--- 释放已加载的 OCR 模型和内部资源
|
|
81
|
+
function _TomatoOCR.release() end
|
|
82
|
+
|
|
83
|
+
return _TomatoOCR
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---@meta tts
|
|
2
|
+
---@class TTS
|
|
3
|
+
local _TTS = {}
|
|
4
|
+
|
|
5
|
+
---@class VoiceInfo
|
|
6
|
+
---@field identifier string 语音标识符
|
|
7
|
+
---@field name string 名称
|
|
8
|
+
---@field language string 语言代码
|
|
9
|
+
---@field quality integer 质量等级
|
|
10
|
+
|
|
11
|
+
--- 说话
|
|
12
|
+
--- @param text string 文本
|
|
13
|
+
--- @param rate number|nil 语速(0.0-1.0,默认 0.5)
|
|
14
|
+
--- @param pitch number|nil 音调(0.5-2.0,默认 1.0)
|
|
15
|
+
--- @param volume number|nil 音量(0.0-1.0,默认 1.0)
|
|
16
|
+
--- @param lang string|nil 语言
|
|
17
|
+
--- @return boolean 成功
|
|
18
|
+
function _TTS.speak(text, rate, pitch, volume, lang) return true end
|
|
19
|
+
|
|
20
|
+
--- 等待结束
|
|
21
|
+
function _TTS.waitEnd() end
|
|
22
|
+
|
|
23
|
+
--- 停止
|
|
24
|
+
function _TTS.stop() end
|
|
25
|
+
|
|
26
|
+
--- 是否正在说话
|
|
27
|
+
--- @return boolean speaking
|
|
28
|
+
function _TTS.isSpeaking() return false end
|
|
29
|
+
|
|
30
|
+
--- 设置声音
|
|
31
|
+
--- @param voice string 声音标识
|
|
32
|
+
--- @return boolean 成功
|
|
33
|
+
function _TTS.setVoice(voice) return true end
|
|
34
|
+
|
|
35
|
+
--- 获取可用的语音列表
|
|
36
|
+
--- @return VoiceInfo[] 语音列表
|
|
37
|
+
function _TTS.getAvailableVoices() return {} end
|
|
38
|
+
|
|
39
|
+
--- 释放 TTS 资源
|
|
40
|
+
function _TTS.free() end
|
|
41
|
+
|
|
42
|
+
return _TTS
|
package/types/lua/ui.lua
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---@meta ui
|
|
2
|
+
---@class UI
|
|
3
|
+
local _UI = {}
|
|
4
|
+
|
|
5
|
+
--- 显示WebView
|
|
6
|
+
function _UI.show() end
|
|
7
|
+
|
|
8
|
+
--- 隐藏WebView
|
|
9
|
+
function _UI.hide() end
|
|
10
|
+
|
|
11
|
+
--- 显示Toast
|
|
12
|
+
--- @param message string 文本
|
|
13
|
+
function _UI.showToast(message) end
|
|
14
|
+
|
|
15
|
+
--- 确认框
|
|
16
|
+
--- @param title string 标题
|
|
17
|
+
--- @param message string 内容
|
|
18
|
+
--- @return boolean 确认
|
|
19
|
+
function _UI.confirm(title, message) return false end
|
|
20
|
+
|
|
21
|
+
--- 输入框
|
|
22
|
+
--- @param title string 标题
|
|
23
|
+
--- @param message string 内容
|
|
24
|
+
--- @return string 输入内容
|
|
25
|
+
function _UI.confirmInput(title, message) return '' end
|
|
26
|
+
|
|
27
|
+
--- 警告框
|
|
28
|
+
--- @param title string 标题
|
|
29
|
+
--- @param message string 内容
|
|
30
|
+
function _UI.alert(title, message) end
|
|
31
|
+
|
|
32
|
+
--- 事件监听
|
|
33
|
+
--- @alias UIEventCallback fun(event: string, data: table<string, any>): nil
|
|
34
|
+
--- @param callback UIEventCallback 回调函数(data 为表,来自 WebView 的对象已转换)
|
|
35
|
+
function _UI.onEvent(callback) end
|
|
36
|
+
|
|
37
|
+
--- 调用已注册函数
|
|
38
|
+
--- @param key string 函数名
|
|
39
|
+
--- @param data table<string, any> 参数(可选,表会在原生层保持为字典)
|
|
40
|
+
function _UI.call(key, data) end
|
|
41
|
+
|
|
42
|
+
--- 执行JS代码
|
|
43
|
+
--- @param code string 代码
|
|
44
|
+
function _UI.eval(code) end
|
|
45
|
+
|
|
46
|
+
return _UI
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---@meta utils
|
|
2
|
+
---@class Utils
|
|
3
|
+
local _Utils = {}
|
|
4
|
+
|
|
5
|
+
--- 时间格式化
|
|
6
|
+
--- @param fmt string 格式
|
|
7
|
+
--- @return string 文本
|
|
8
|
+
function _Utils.timeFormat(fmt) return '' end
|
|
9
|
+
|
|
10
|
+
--- 随机数
|
|
11
|
+
--- @param min integer 最小
|
|
12
|
+
--- @param max integer 最大
|
|
13
|
+
--- @return integer 随机值
|
|
14
|
+
function _Utils.random(min, max) return 0 end
|
|
15
|
+
|
|
16
|
+
--- 把应用带到前台
|
|
17
|
+
--- @return boolean 是否成功
|
|
18
|
+
function _Utils.takeMeToFront() return false end
|
|
19
|
+
|
|
20
|
+
--- 生成随机 UUID
|
|
21
|
+
--- @return string UUID
|
|
22
|
+
function _Utils.randomUUID() return '' end
|
|
23
|
+
|
|
24
|
+
--- 字符串转小写 hex
|
|
25
|
+
--- @param source string 源字符串
|
|
26
|
+
--- @return string hex
|
|
27
|
+
function _Utils.hexString(source) return '' end
|
|
28
|
+
|
|
29
|
+
--- 字符串转 Base64
|
|
30
|
+
--- @param source string 源字符串
|
|
31
|
+
--- @return string Base64
|
|
32
|
+
function _Utils.base64Encoded(source) return '' end
|
|
33
|
+
|
|
34
|
+
--- Base64 转字符串
|
|
35
|
+
--- @param source string Base64
|
|
36
|
+
--- @return string 文本
|
|
37
|
+
function _Utils.base64Decoded(source) return '' end
|
|
38
|
+
|
|
39
|
+
--- hex 字符串转 Base64
|
|
40
|
+
--- @param hexString string hex
|
|
41
|
+
--- @return string Base64
|
|
42
|
+
function _Utils.hexStringBase64Encoded(hexString) return '' end
|
|
43
|
+
|
|
44
|
+
--- Base64 转 hex 字符串
|
|
45
|
+
--- @param base64HexString string Base64
|
|
46
|
+
--- @return string hex
|
|
47
|
+
function _Utils.hexStringBase64Decoded(base64HexString) return '' end
|
|
48
|
+
|
|
49
|
+
return _Utils
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---@meta yolo
|
|
2
|
+
---@class Yolo
|
|
3
|
+
local _Yolo = {}
|
|
4
|
+
|
|
5
|
+
---@class YoloResult
|
|
6
|
+
---@field x integer 左上角 X
|
|
7
|
+
---@field y integer 左上角 Y
|
|
8
|
+
---@field ex integer 右下角 X
|
|
9
|
+
---@field ey integer 右下角 Y
|
|
10
|
+
---@field centerX integer 中心点 X
|
|
11
|
+
---@field centerY integer 中心点 Y
|
|
12
|
+
---@field width integer 宽度
|
|
13
|
+
---@field height integer 高度
|
|
14
|
+
---@field confidence number 置信度
|
|
15
|
+
---@field classId integer 类别 ID
|
|
16
|
+
|
|
17
|
+
--- 加载 YOLO 模型(版本 8/11/26)
|
|
18
|
+
--- @param paramPath string ncnn param 路径
|
|
19
|
+
--- @param binPath string ncnn bin 路径
|
|
20
|
+
--- @param nc integer|nil 标签数量;传 0 或省略时按模型输出推断
|
|
21
|
+
--- @param version integer|nil 模型版本,缺省 0 按 v11 处理
|
|
22
|
+
--- @param useGpu boolean|nil 是否启用 GPU,默认 false
|
|
23
|
+
--- @return string|nil 模型ID(失败返回 nil)
|
|
24
|
+
function _Yolo.load(paramPath, binPath, nc, version, useGpu) return nil end
|
|
25
|
+
|
|
26
|
+
--- 加载 YOLOv11 模型
|
|
27
|
+
--- @param paramPath string ncnn param 路径
|
|
28
|
+
--- @param binPath string ncnn bin 路径
|
|
29
|
+
--- @param nc integer|nil 标签数量;传 0 或省略时按模型输出推断
|
|
30
|
+
--- @param useGpu boolean|nil 是否启用 GPU,默认 false
|
|
31
|
+
--- @return string|nil 模型ID(失败返回 nil)
|
|
32
|
+
function _Yolo.loadV11(paramPath, binPath, nc, useGpu) return nil end
|
|
33
|
+
|
|
34
|
+
--- 检测
|
|
35
|
+
--- @param id string 模型ID
|
|
36
|
+
--- @param input string 图像ID或路径
|
|
37
|
+
--- @param target integer 目标边长(默认 640)
|
|
38
|
+
--- @param thr number 置信阈值(默认 0.4)
|
|
39
|
+
--- @param nms number NMS 阈值(默认 0.5)
|
|
40
|
+
--- @return YoloResult[] 结果数组
|
|
41
|
+
function _Yolo.detect(id, input, target, thr, nms) return {} end
|
|
42
|
+
|
|
43
|
+
--- 区域检测,坐标映射为原图/全屏绝对坐标
|
|
44
|
+
--- @param id string 模型ID
|
|
45
|
+
--- @param input string 图像ID或路径
|
|
46
|
+
--- @param x integer 区域左上角 X
|
|
47
|
+
--- @param y integer 区域左上角 Y
|
|
48
|
+
--- @param ex integer 区域右下角 X
|
|
49
|
+
--- @param ey integer 区域右下角 Y
|
|
50
|
+
--- @param target integer|nil 目标边长(默认 640)
|
|
51
|
+
--- @param thr number|nil 置信阈值(默认 0.4)
|
|
52
|
+
--- @param nms number|nil NMS 阈值(默认 0.5)
|
|
53
|
+
--- @return YoloResult[] 结果数组
|
|
54
|
+
function _Yolo.detectAbs(id, input, x, y, ex, ey, target, thr, nms) return {} end
|
|
55
|
+
|
|
56
|
+
--- 释放模型
|
|
57
|
+
--- @param id string 模型ID
|
|
58
|
+
function _Yolo.free(id) end
|
|
59
|
+
|
|
60
|
+
--- 释放全部模型
|
|
61
|
+
function _Yolo.freeAll() end
|
|
62
|
+
|
|
63
|
+
return _Yolo
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---@meta yolocls
|
|
2
|
+
---@class YoloCls
|
|
3
|
+
local _YoloCls = {}
|
|
4
|
+
|
|
5
|
+
--- load
|
|
6
|
+
---@param paramPath string
|
|
7
|
+
---@param binPath string
|
|
8
|
+
---@param nc integer|nil
|
|
9
|
+
---@param useGpu boolean|nil
|
|
10
|
+
---@return string|nil
|
|
11
|
+
function _YoloCls.load(paramPath, binPath, nc, useGpu) return nil end
|
|
12
|
+
|
|
13
|
+
--- classify
|
|
14
|
+
---@param modelId string
|
|
15
|
+
---@param img string
|
|
16
|
+
---@param targetSize integer|nil
|
|
17
|
+
---@return table
|
|
18
|
+
function _YoloCls.classify(modelId, img, targetSize) return { data = {}, top1 = nil, top5 = {}, top1conf = nil, top5conf = {} } end
|
|
19
|
+
|
|
20
|
+
--- classifyRegion
|
|
21
|
+
---@param modelId string
|
|
22
|
+
---@param img string
|
|
23
|
+
---@param x integer|nil
|
|
24
|
+
---@param y integer|nil
|
|
25
|
+
---@param ex integer|nil
|
|
26
|
+
---@param ey integer|nil
|
|
27
|
+
---@param targetSize integer|nil
|
|
28
|
+
---@return table
|
|
29
|
+
function _YoloCls.classifyRegion(modelId, img, x, y, ex, ey, targetSize) return { data = {}, top1 = nil, top5 = {}, top1conf = nil, top5conf = {} } end
|
|
30
|
+
|
|
31
|
+
--- free
|
|
32
|
+
---@param modelId string
|
|
33
|
+
function _YoloCls.free(modelId) end
|
|
34
|
+
|
|
35
|
+
--- freeAll
|
|
36
|
+
|
|
37
|
+
function _YoloCls.freeAll() end
|
|
38
|
+
|
|
39
|
+
package.loaded['yolocls'] = _YoloCls
|
|
40
|
+
package.loaded['yoloCls'] = _YoloCls
|
|
41
|
+
return _YoloCls
|