ms-vite-plugin 1.4.58 → 1.4.60

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.
Files changed (83) hide show
  1. package/dist/luaBundle.js +1 -1
  2. package/dist/luaObfuscator/addVararg.d.ts +2 -0
  3. package/dist/luaObfuscator/addVararg.js +1 -0
  4. package/dist/luaObfuscator/antiTamper.d.ts +2 -0
  5. package/dist/luaObfuscator/antiTamper.js +26 -0
  6. package/dist/luaObfuscator/ast.d.ts +191 -0
  7. package/dist/luaObfuscator/ast.js +1 -0
  8. package/dist/luaObfuscator/cipher.d.ts +10 -0
  9. package/dist/luaObfuscator/cipher.js +28 -0
  10. package/dist/luaObfuscator/compiler.d.ts +31 -0
  11. package/dist/luaObfuscator/compiler.js +1 -0
  12. package/dist/luaObfuscator/constantArray.d.ts +5 -0
  13. package/dist/luaObfuscator/constantArray.js +1 -0
  14. package/dist/luaObfuscator/flatten.d.ts +2 -0
  15. package/dist/luaObfuscator/flatten.js +1 -0
  16. package/dist/luaObfuscator/index.d.ts +6 -0
  17. package/dist/luaObfuscator/index.js +1 -0
  18. package/dist/luaObfuscator/lexer.d.ts +14 -0
  19. package/dist/luaObfuscator/lexer.js +10 -0
  20. package/dist/luaObfuscator/minify.d.ts +3 -0
  21. package/dist/luaObfuscator/minify.js +1 -0
  22. package/dist/luaObfuscator/numbers.d.ts +2 -0
  23. package/dist/luaObfuscator/numbers.js +1 -0
  24. package/dist/luaObfuscator/opcodes.d.ts +3 -0
  25. package/dist/luaObfuscator/opcodes.js +1 -0
  26. package/dist/luaObfuscator/parser.d.ts +8 -0
  27. package/dist/luaObfuscator/parser.js +1 -0
  28. package/dist/luaObfuscator/rename.d.ts +3 -0
  29. package/dist/luaObfuscator/rename.js +1 -0
  30. package/dist/luaObfuscator/reserved.d.ts +5 -0
  31. package/dist/luaObfuscator/reserved.js +1 -0
  32. package/dist/luaObfuscator/scope.d.ts +11 -0
  33. package/dist/luaObfuscator/scope.js +1 -0
  34. package/dist/luaObfuscator/selftest.d.ts +1 -0
  35. package/dist/luaObfuscator/selftest.js +39 -0
  36. package/dist/luaObfuscator/splitStrings.d.ts +2 -0
  37. package/dist/luaObfuscator/splitStrings.js +1 -0
  38. package/dist/luaObfuscator/strings.d.ts +4 -0
  39. package/dist/luaObfuscator/strings.js +1 -0
  40. package/dist/luaObfuscator/visit.d.ts +5 -0
  41. package/dist/luaObfuscator/visit.js +1 -0
  42. package/dist/luaObfuscator/vmEmit.d.ts +2 -0
  43. package/dist/luaObfuscator/vmEmit.js +281 -0
  44. package/dist/luaObfuscator/wrapInFunction.d.ts +2 -0
  45. package/dist/luaObfuscator/wrapInFunction.js +1 -0
  46. package/docs/AGENTS.md +1 -1
  47. package/docs/SKILL.md +1 -1
  48. package/docs/api/media.md +22 -0
  49. package/docs/apicn/media.md +22 -0
  50. package/docs/apilua/action.md +2 -27
  51. package/docs/apilua/appleocr.md +41 -126
  52. package/docs/apilua/cloud.md +2 -6
  53. package/docs/apilua/config.md +2 -6
  54. package/docs/apilua/cryptoUtils.md +2 -7
  55. package/docs/apilua/device.md +2 -19
  56. package/docs/apilua/dotocr.md +2 -5
  57. package/docs/apilua/file.md +2 -17
  58. package/docs/apilua/global.md +1 -1
  59. package/docs/apilua/hid.md +2 -44
  60. package/docs/apilua/hotUpdate.md +2 -3
  61. package/docs/apilua/http.md +2 -7
  62. package/docs/apilua/image.md +16 -107
  63. package/docs/apilua/ime.md +2 -10
  64. package/docs/apilua/logger.md +3 -9
  65. package/docs/apilua/media.md +2 -9
  66. package/docs/apilua/mysql.md +2 -10
  67. package/docs/apilua/netCard.md +2 -6
  68. package/docs/apilua/node.md +2 -3
  69. package/docs/apilua/opencv.md +4 -30
  70. package/docs/apilua/paddleocr.md +20 -126
  71. package/docs/apilua/pip.md +2 -12
  72. package/docs/apilua/system.md +2 -40
  73. package/docs/apilua/tomatoocr.md +2 -16
  74. package/docs/apilua/tts.md +2 -9
  75. package/docs/apilua/ui.md +3 -22
  76. package/docs/apilua/utils.md +2 -9
  77. package/docs/apilua/yolo.md +25 -119
  78. package/docs/apilua/yolocls.md +2 -5
  79. package/docs/apipython/media.md +20 -0
  80. package/docs/mcp-agent-description.md +1 -1
  81. package/docs/quick/vscode/createProject.md +1 -1
  82. package/docs/quick/vscode/packProject.md +1 -1
  83. package/package.json +1 -1
@@ -1,5 +1,7 @@
1
1
  # AppleOCR 模块
2
2
 
3
+ 模块表是内置全局 `appleocr`,直接调用即可。不要 `require` 宿主模块。
4
+
3
5
  AppleOCR 模块基于 Apple Vision 框架,提供原生的光学字符识别(OCR)功能。该模块利用 iOS 系统内置的机器学习能力,无需额外模型文件,具有高效、准确的特点。
4
6
 
5
7
  <span style="color: red;">此模块仅支持 iOS 系统。</span>
@@ -59,9 +61,10 @@ AppleOCR 模块基于 Apple Vision 框架,提供原生的光学字符识别(
59
61
 
60
62
  ### 文字识别
61
63
 
62
- #### recognize - 执行 OCR 识别。
64
+ #### recognizeAbs - 执行 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
63
65
 
64
- 执行 OCR 识别。传入裁剪区域时,返回坐标相对于裁剪区域。全屏识别时 `x/y/ex/ey` 传 `0`。
66
+ 执行 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
67
+ 传入裁剪区域时,返回坐标会映射回原图或全屏坐标,可直接用于点击。
65
68
 
66
69
  ```lua
67
70
  ---@param input string
@@ -71,7 +74,7 @@ AppleOCR 模块基于 Apple Vision 框架,提供原生的光学字符识别(
71
74
  ---@param ey number?
72
75
  ---@param languages string[]?
73
76
  ---@return OCRResult[]
74
- function recognize(input, x, y, ex, ey, languages) end
77
+ function recognizeAbs(input, x, y, ex, ey, languages) end
75
78
  ```
76
79
 
77
80
  **参数:**
@@ -87,44 +90,13 @@ function recognize(input, x, y, ex, ey, languages) end
87
90
 
88
91
  **返回值:**
89
92
 
90
- | 类型 | 描述 |
91
- | ------------- | ---------------------------------------------- |
92
- | `OCRResult[]` | 识别结果数组,坐标相对于裁剪区域 |
93
+ | 类型 | 描述 |
94
+ | ------------- | -------------------------------------- |
95
+ | `OCRResult[]` | 识别结果数组,坐标为原图或全屏绝对坐标 |
93
96
 
94
97
  **示例:**
95
98
 
96
99
  ```lua
97
- local appleocr = require("appleocr")
98
- local action = require("action")
99
-
100
- local results = appleocr.recognize("screen", 100, 100, 500, 300)
101
- if #results > 0 then
102
- action.click(results[1].centerX, results[1].centerY)
103
- end
104
- ```
105
-
106
- #### recognizeAbs - 执行 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
107
-
108
- 传入裁剪区域时,返回坐标会映射回原图或全屏坐标,可直接用于点击。
109
-
110
- ```lua
111
- ---@param input string
112
- ---@param x number?
113
- ---@param y number?
114
- ---@param ex number?
115
- ---@param ey number?
116
- ---@param languages string[]?
117
- ---@return OCRResult[]
118
- function recognizeAbs(input, x, y, ex, ey, languages) end
119
- ```
120
-
121
- **参数:** 与 `recognize` 相同;返回坐标为原图或全屏绝对坐标。
122
-
123
- **示例:**
124
-
125
- ```lua
126
- local appleocr = require("appleocr")
127
- local action = require("action")
128
100
  local absResults = appleocr.recognizeAbs("screen", 100, 100, 500, 300)
129
101
  if #absResults > 0 then
130
102
  action.click(absResults[1].centerX, absResults[1].centerY)
@@ -133,9 +105,10 @@ end
133
105
 
134
106
  ### 数字识别
135
107
 
136
- #### recognizeNumbers - 执行数字 OCR 识别。
108
+ #### recognizeNumbersAbs - 执行数字 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
137
109
 
138
- 执行数字 OCR 识别。传入裁剪区域时,返回坐标相对于裁剪区域。
110
+ 执行数字 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
111
+ 传入裁剪区域时,返回坐标会映射回原图或全屏坐标,可直接用于点击。
139
112
 
140
113
  **支持字符**: 0-9 数字、逗号(,)、小数点(.)、加号(+)、减号(-)
141
114
 
@@ -146,69 +119,44 @@ end
146
119
  ---@param ex number?
147
120
  ---@param ey number?
148
121
  ---@return OCRResult[]
149
- function recognizeNumbers(input, x, y, ex, ey) end
122
+ function recognizeNumbersAbs(input, x, y, ex, ey) end
150
123
  ```
151
124
 
152
125
  **参数:**
153
126
 
154
- | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
155
- | ------- | ------ | -------- | ------ | --------------------------------------------------- |
127
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
128
+ | ------- | ------ | -------- | ------ | ----------------------------------------------------------- |
156
129
  | `input` | string | 是 | | 输入源,支持 `"screen"`、图片文件路径、URL 字符串或 imageId |
157
- | `x` | number | 否 | 0 | 裁剪区域左上角 x 坐标;全屏识别传 0 |
158
- | `y` | number | 否 | 0 | 裁剪区域左上角 y 坐标;全屏识别传 0 |
159
- | `ex` | number | 否 | 0 | 裁剪区域右下角 x 坐标;全屏识别传 0 |
160
- | `ey` | number | 否 | 0 | 裁剪区域右下角 y 坐标;全屏识别传 0 |
130
+ | `x` | number | 否 | 0 | 裁剪区域左上角 x 坐标;全屏识别传 0 |
131
+ | `y` | number | 否 | 0 | 裁剪区域左上角 y 坐标;全屏识别传 0 |
132
+ | `ex` | number | 否 | 0 | 裁剪区域右下角 x 坐标;全屏识别传 0 |
133
+ | `ey` | number | 否 | 0 | 裁剪区域右下角 y 坐标;全屏识别传 0 |
161
134
 
162
135
  **返回值:**
163
136
 
164
137
  | 类型 | 描述 |
165
138
  | ------------- | ---------------------------------------------- |
166
- | `OCRResult[]` | 数字识别结果数组,坐标相对于裁剪区域 |
167
-
168
- **示例:**
169
-
170
- ```lua
171
- local appleocr = require("appleocr")
172
- local action = require("action")
173
-
174
- local numberResults = appleocr.recognizeNumbers("screen", 100, 100, 500, 300)
175
- if #numberResults > 0 then
176
- action.click(numberResults[1].centerX, numberResults[1].centerY)
177
- end
178
- ```
179
-
180
- #### recognizeNumbersAbs - 执行数字 OCR 识别,并将结果坐标映射为原图/全屏绝对坐标。
181
-
182
- **支持字符**: 0-9 数字、逗号(,)、小数点(.)、加号(+)、减号(-)
183
-
184
- ```lua
185
- ---@param input string
186
- ---@param x number?
187
- ---@param y number?
188
- ---@param ex number?
189
- ---@param ey number?
190
- ---@return OCRResult[]
191
- function recognizeNumbersAbs(input, x, y, ex, ey) end
192
- ```
193
-
194
- **参数:** 与 `recognizeNumbers` 相同;返回坐标为原图或全屏绝对坐标。
139
+ | `OCRResult[]` | 数字识别结果数组,坐标为原图或全屏绝对坐标 |
195
140
 
196
141
  **示例:**
197
142
 
198
143
  ```lua
199
- local appleocr = require("appleocr")
200
144
  local absNumberResults = appleocr.recognizeNumbersAbs("screen", 100, 100, 500, 300)
145
+ if #absNumberResults > 0 then
146
+ action.click(absNumberResults[1].centerX, absNumberResults[1].centerY)
147
+ end
201
148
  ```
202
149
 
203
150
  ### 文本查找
204
151
 
205
- #### findText - 查找目标子串。
152
+ #### findTextAbs - 查找目标子串,并将子串结果坐标映射为原图/全屏绝对坐标。
206
153
 
207
- 在整段识别文本中查找指定子串。传入裁剪区域时,返回坐标相对于裁剪区域。
154
+ 查找目标子串,并将子串结果坐标映射为原图/全屏绝对坐标。
155
+ 传入裁剪区域时,返回坐标会映射回原图或全屏坐标,可直接用于点击。`texts` 也可以是逗号分隔字符串。
208
156
 
209
157
  ```lua
210
158
  ---@param input string
211
- ---@param texts string[]
159
+ ---@param texts string[]|string
212
160
  ---@param x number?
213
161
  ---@param y number?
214
162
  ---@param ex number?
@@ -216,64 +164,31 @@ local absNumberResults = appleocr.recognizeNumbersAbs("screen", 100, 100, 500, 3
216
164
  ---@param languages string[]?
217
165
  ---@param exactMatch boolean?
218
166
  ---@return OCRResult[]
219
- function findText(input, texts, x, y, ex, ey, languages, exactMatch) end
167
+ function findTextAbs(input, texts, x, y, ex, ey, languages, exactMatch) end
220
168
  ```
221
169
 
222
170
  **参数:**
223
171
 
224
- | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
225
- | ------------ | -------- | -------- | ----------------------- | ----------------------------------------------------------------------------------------------------- |
226
- | `input` | string | 是 | | 输入源,支持 `"screen"`、图片文件路径、URL 字符串或 imageId |
227
- | `texts` | string[] | 是 | | 要查找的目标文本数组,可匹配识别结果中的子串 |
228
- | `x` | number | 否 | 0 | 裁剪区域左上角 x 坐标;全屏识别传 0 |
229
- | `y` | number | 否 | 0 | 裁剪区域左上角 y 坐标;全屏识别传 0 |
230
- | `ex` | number | 否 | 0 | 裁剪区域右下角 x 坐标;全屏识别传 0 |
231
- | `ey` | number | 否 | 0 | 裁剪区域右下角 y 坐标;全屏识别传 0 |
232
- | `languages` | string[] | 否 | `{"zh-Hans", "en-US"}` | 识别语言数组 |
233
- | `exactMatch` | boolean | 否 | false | 是否完整匹配;`false` 表示包含匹配,`true` 要求整条 OCR 识别结果文本等于目标文本 |
172
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
173
+ | ------------ | ------------------ | -------- | ----------------------- | ----------------------------------------------------------------------------------------------------- |
174
+ | `input` | string | 是 | | 输入源,支持 `"screen"`、图片文件路径、URL 字符串或 imageId |
175
+ | `texts` | string[] \| string | 是 | | 要查找的目标文本数组,可匹配识别结果中的子串;也可以是逗号分隔字符串 |
176
+ | `x` | number | 否 | 0 | 裁剪区域左上角 x 坐标;全屏识别传 0 |
177
+ | `y` | number | 否 | 0 | 裁剪区域左上角 y 坐标;全屏识别传 0 |
178
+ | `ex` | number | 否 | 0 | 裁剪区域右下角 x 坐标;全屏识别传 0 |
179
+ | `ey` | number | 否 | 0 | 裁剪区域右下角 y 坐标;全屏识别传 0 |
180
+ | `languages` | string[] | 否 | `{"zh-Hans", "en-US"}` | 识别语言数组 |
181
+ | `exactMatch` | boolean | 否 | false | 是否完整匹配;`false` 表示包含匹配,`true` 要求整条 OCR 识别结果文本等于目标文本 |
234
182
 
235
183
  **返回值:**
236
184
 
237
- | 类型 | 描述 |
238
- | ------------- | ---------------------------------------------- |
239
- | `OCRResult[]` | 命中子串的识别结果数组,坐标相对于裁剪区域 |
240
-
241
- **示例:**
242
-
243
- ```lua
244
- local appleocr = require("appleocr")
245
- local action = require("action")
246
-
247
- local hits = appleocr.findText("screen", { "开始" }, 100, 100, 500, 400)
248
- if #hits > 0 then
249
- action.click(hits[1].centerX, hits[1].centerY)
250
- end
251
- ```
252
-
253
- #### findTextAbs - 查找目标子串,并将子串结果坐标映射为原图/全屏绝对坐标。
254
-
255
- 传入裁剪区域时,返回坐标会映射回原图或全屏坐标,可直接用于点击。`texts` 也可以是逗号分隔字符串。
256
-
257
- ```lua
258
- ---@param input string
259
- ---@param texts string[]|string
260
- ---@param x number?
261
- ---@param y number?
262
- ---@param ex number?
263
- ---@param ey number?
264
- ---@param languages string[]?
265
- ---@param exactMatch boolean?
266
- ---@return OCRResult[]
267
- function findTextAbs(input, texts, x, y, ex, ey, languages, exactMatch) end
268
- ```
269
-
270
- **参数:** 与 `findText` 相同;返回坐标为原图或全屏绝对坐标。
185
+ | 类型 | 描述 |
186
+ | ------------- | -------------------------------------------------- |
187
+ | `OCRResult[]` | 命中子串的识别结果数组,坐标为原图或全屏绝对坐标 |
271
188
 
272
189
  **示例:**
273
190
 
274
191
  ```lua
275
- local appleocr = require("appleocr")
276
- local action = require("action")
277
192
  local absHits = appleocr.findTextAbs("screen", { "开始" }, 100, 100, 500, 400)
278
193
  if #absHits > 0 then
279
194
  action.click(absHits[1].centerX, absHits[1].centerY)
@@ -1,5 +1,7 @@
1
1
  # 云控模块 (Cloud)
2
2
 
3
+ 模块表是内置全局 `cloud`,直接调用即可。不要 `require` 宿主模块。
4
+
3
5
  云控模块用于在主脚本中使用内置云控 WebSocket 连接。脚本可以主动连接云控服务器、判断连接状态、断开连接、上报事件数据,并监听服务器事件数据。
4
6
 
5
7
  ## 注意事项
@@ -64,7 +66,6 @@ function connect(url, deviceNo) end
64
66
  **示例**
65
67
 
66
68
  ```lua
67
- local cloud = require("cloud")
68
69
  local accepted = cloud.connect("wss = //example.com/control", "device-001")
69
70
  print("云控连接请求:", accepted)
70
71
  ```
@@ -85,7 +86,6 @@ function isConnected() end
85
86
  **示例**
86
87
 
87
88
  ```lua
88
- local cloud = require("cloud")
89
89
  if cloud.isConnected() then
90
90
  cloud.report("status", { value = "ready" })
91
91
  end
@@ -102,7 +102,6 @@ function disconnect() end
102
102
  **示例**
103
103
 
104
104
  ```lua
105
- local cloud = require("cloud")
106
105
  cloud.disconnect()
107
106
  ```
108
107
 
@@ -131,7 +130,6 @@ function report(event, data) end
131
130
  **示例**
132
131
 
133
132
  ```lua
134
- local cloud = require("cloud")
135
133
  local ok = cloud.report("taskFinished", {
136
134
  taskId = "A-1001",
137
135
  success = true,
@@ -147,7 +145,6 @@ print("上报结果:", ok)
147
145
  `data` 的 key 必须使用云控端已经配置好的设备总览自定义字段名。上报了云控端未配置的多余字段时,协议仍可发送,但云控端设备总览不会显示这些字段。
148
146
 
149
147
  ```lua
150
- local cloud = require("cloud")
151
148
  cloud.report("cloud = status", {
152
149
  taskName = "巡检任务",
153
150
  progress = 80,
@@ -174,7 +171,6 @@ function onEvent(callback) end
174
171
  **示例**
175
172
 
176
173
  ```lua
177
- local cloud = require("cloud")
178
174
  cloud.onEvent(function(event, data)
179
175
  if event == "startTask" then
180
176
  print("任务参数:", data)
@@ -1,5 +1,7 @@
1
1
  # 配置模块 (Config)
2
2
 
3
+ 模块表是内置全局 `config`,直接调用即可。不要 `require` 宿主模块。
4
+
3
5
  配置模块提供了读取、更新和删除应用配置的功能。
4
6
 
5
7
  网页的 ms.setConfig 对应 config.set
@@ -28,7 +30,6 @@ function all() end
28
30
  **示例:**
29
31
 
30
32
  ```lua
31
- local config = require("config")
32
33
  local allConfigs = config.all()
33
34
  print("所有配置: " .. tostring(ToJsonString(allConfigs, nil, 2)))
34
35
  ```
@@ -56,7 +57,6 @@ function setAll(config) end
56
57
  **示例:**
57
58
 
58
59
  ```lua
59
- local config = require("config")
60
60
  local success = config.setAll({ maxRetries = 5, debugEnabled = true })
61
61
  if success then
62
62
  print("所有配置已更新")
@@ -88,7 +88,6 @@ function set(key, value) end
88
88
  **示例:**
89
89
 
90
90
  ```lua
91
- local config = require("config")
92
91
  -- 更新不同类型的配置
93
92
  local success1 = config.set("maxRetries", 5)
94
93
  local success2 = config.set("apiBaseUrl", "https://api.example.com")
@@ -122,7 +121,6 @@ function get(key) end
122
121
  **示例:**
123
122
 
124
123
  ```lua
125
- local config = require("config")
126
124
  local maxRetries = config.get("maxRetries")
127
125
  if maxRetries ~= nil then
128
126
  print("最大重试次数: " .. tostring(maxRetries))
@@ -145,7 +143,6 @@ function getKuiConfig() end
145
143
  **示例:**
146
144
 
147
145
  ```lua
148
- local config = require("config")
149
146
  local kuiConfig = config.getKuiConfig()
150
147
  print("KUI 配置: " .. tostring(ToJsonString(kuiConfig, nil, 2)))
151
148
  ```
@@ -173,7 +170,6 @@ function remove(key) end
173
170
  **示例:**
174
171
 
175
172
  ```lua
176
- local config = require("config")
177
173
  local deleted = config.remove("temporaryConfig")
178
174
  if deleted then
179
175
  print("临时配置已删除")
@@ -1,5 +1,7 @@
1
1
  # 加密模块 (CryptoUtils)
2
2
 
3
+ 模块表是内置全局 `cryptoUtils`,直接调用即可。不要 `require` 宿主模块。
4
+
3
5
  加密模块提供了常用的加密和解密功能,支持 AES、RSA 以及 MD5、SHA1、SHA256 等哈希算法。
4
6
 
5
7
  ## 功能概览
@@ -41,7 +43,6 @@ function encryptWithAES_ECB(data, aesKey, noPadding) end
41
43
  **示例:**
42
44
 
43
45
  ```lua
44
- local cryptoUtils = require("cryptoUtils")
45
46
  local data = "Hello World"
46
47
  local key = "1234567890123456"; -- 16位密钥
47
48
  local encrypted = cryptoUtils.encryptWithAES_ECB(data, key)
@@ -77,7 +78,6 @@ function decryptWithAES_ECB(data, aesKey, noPadding) end
77
78
  **示例:**
78
79
 
79
80
  ```lua
80
- local cryptoUtils = require("cryptoUtils")
81
81
  local encryptedData = "Base64EncodedString..."
82
82
  local key = "1234567890123456"
83
83
  local decrypted = cryptoUtils.decryptWithAES_ECB(encryptedData, key)
@@ -113,7 +113,6 @@ function encryptWithRSA(data, rsaPublicKey) end
113
113
  **示例:**
114
114
 
115
115
  ```lua
116
- local cryptoUtils = require("cryptoUtils")
117
116
  local data = "123456"
118
117
  local publicKey = "-----BEGIN PUBLIC KEY-----
119
118
  公钥内容
@@ -150,7 +149,6 @@ function decryptWithRSA(data, rsaPrivateKey) end
150
149
  **示例:**
151
150
 
152
151
  ```lua
153
- local cryptoUtils = require("cryptoUtils")
154
152
  local encryptedData = "加密后字符串"
155
153
  local privateKey = "-----BEGIN PRIVATE KEY-----
156
154
  私钥内容
@@ -184,7 +182,6 @@ function md5(data) end
184
182
  **示例:**
185
183
 
186
184
  ```lua
187
- local cryptoUtils = require("cryptoUtils")
188
185
  local data = "123456"
189
186
  local hash = cryptoUtils.md5(data)
190
187
  print("MD5 = " .. tostring(hash)); -- e10adc3949ba59abbe56e057f20f883e
@@ -215,7 +212,6 @@ function sha1(data, key) end
215
212
  **示例:**
216
213
 
217
214
  ```lua
218
- local cryptoUtils = require("cryptoUtils")
219
215
  local data = "123456"
220
216
  local hash = cryptoUtils.sha1(data)
221
217
  print("SHA1 = " .. tostring(hash))
@@ -246,7 +242,6 @@ function sha256(data, key) end
246
242
  **示例:**
247
243
 
248
244
  ```lua
249
- local cryptoUtils = require("cryptoUtils")
250
245
  local data = "123456"
251
246
  local hash = cryptoUtils.sha256(data)
252
247
  print("SHA256 = " .. tostring(hash))
@@ -1,5 +1,7 @@
1
1
  # 设备模块 (Device)
2
2
 
3
+ 模块表是内置全局 `device`,直接调用即可。不要 `require` 宿主模块。
4
+
3
5
  设备模块提供了获取设备信息和设备操作的功能,包括电池信息、设备标识、屏幕信息、系统信息等。
4
6
 
5
7
  ## 电池信息
@@ -21,7 +23,6 @@ function getBatteryInfo() end
21
23
  **示例:**
22
24
 
23
25
  ```lua
24
- local device = require("device")
25
26
  -- 获取电池信息
26
27
  local battery = device.getBatteryInfo()
27
28
  print("电池电量: " .. tostring(battery.level) .. "%")
@@ -48,7 +49,6 @@ function getStorageSpace() end
48
49
  **示例:**
49
50
 
50
51
  ```lua
51
- local device = require("device")
52
52
  local storage = device.getStorageSpace()
53
53
  print("总存储: " .. tostring(storage.total) .. tostring(storage.unit))
54
54
  print("剩余存储: " .. tostring(storage.free) .. tostring(storage.unit))
@@ -77,7 +77,6 @@ function getDeviceID() end
77
77
  **示例:**
78
78
 
79
79
  ```lua
80
- local device = require("device")
81
80
  -- 获取设备ID
82
81
  local uuid = device.getDeviceID()
83
82
  print("设备ID = " .. tostring(uuid))
@@ -104,7 +103,6 @@ function getServerDeviceId() end
104
103
  **示例:**
105
104
 
106
105
  ```lua
107
- local device = require("device")
108
106
  -- 获取服务器设备ID
109
107
  local serverDeviceId = device.getServerDeviceId()
110
108
  print("服务器设备ID = " .. tostring(serverDeviceId))
@@ -126,7 +124,6 @@ function getECID() end
126
124
  **示例:**
127
125
 
128
126
  ```lua
129
- local device = require("device")
130
127
  -- 获取ECID
131
128
  local ecid = device.getECID()
132
129
  print("ECID = " .. tostring(ecid))
@@ -148,7 +145,6 @@ function getUDID() end
148
145
  **示例:**
149
146
 
150
147
  ```lua
151
- local device = require("device")
152
148
  -- 获取UDID
153
149
  local udid = device.getUDID()
154
150
  print("UDID = " .. tostring(udid))
@@ -170,7 +166,6 @@ function getDeviceName() end
170
166
  **示例:**
171
167
 
172
168
  ```lua
173
- local device = require("device")
174
169
  -- 获取设备名称
175
170
  local deviceName = device.getDeviceName()
176
171
  print("设备名称: " .. tostring(deviceName))
@@ -192,7 +187,6 @@ function getDeviceModel() end
192
187
  **示例:**
193
188
 
194
189
  ```lua
195
- local device = require("device")
196
190
  -- 获取设备型号
197
191
  local model = device.getDeviceModel()
198
192
  print("设备型号: " .. tostring(model))
@@ -222,7 +216,6 @@ function getScreenSize() end
222
216
  **示例:**
223
217
 
224
218
  ```lua
225
- local device = require("device")
226
219
  -- 获取屏幕尺寸
227
220
  local screenSize = device.getScreenSize()
228
221
  print("屏幕尺寸: " .. tostring(screenSize.width) .. " x " .. tostring(screenSize.height))
@@ -250,7 +243,6 @@ function getScreenRealSize() end
250
243
  **示例:**
251
244
 
252
245
  ```lua
253
- local device = require("device")
254
246
  -- 获取屏幕实际尺寸
255
247
  local screenRealSize = device.getScreenRealSize()
256
248
  print("屏幕实际尺寸: " .. tostring(screenRealSize.width) .. " x " .. tostring(screenRealSize.height))
@@ -272,7 +264,6 @@ function getScreenScale() end
272
264
  **示例:**
273
265
 
274
266
  ```lua
275
- local device = require("device")
276
267
  -- 获取屏幕缩放比例
277
268
  local scale = device.getScreenScale()
278
269
  print("屏幕缩放比例: " .. tostring(scale))
@@ -294,7 +285,6 @@ function getScreenBrightness() end
294
285
  **示例:**
295
286
 
296
287
  ```lua
297
- local device = require("device")
298
288
  -- 获取屏幕亮度
299
289
  local brightness = device.getScreenBrightness()
300
290
  print("屏幕亮度: " .. tostring(brightness))
@@ -325,7 +315,6 @@ function setScreenBrightness(brightness) end
325
315
  **示例:**
326
316
 
327
317
  ```lua
328
- local device = require("device")
329
318
  -- 设置屏幕亮度到 50%
330
319
  device.setScreenBrightness(0.5)
331
320
  ```
@@ -346,7 +335,6 @@ function getVolume() end
346
335
  **示例:**
347
336
 
348
337
  ```lua
349
- local device = require("device")
350
338
  -- 获取系统音量
351
339
  local volume = device.getVolume()
352
340
  print("系统音量: " .. tostring(volume))
@@ -377,7 +365,6 @@ function setVolume(volume) end
377
365
  **示例:**
378
366
 
379
367
  ```lua
380
- local device = require("device")
381
368
  -- 设置系统音量到 50%
382
369
  device.setVolume(0.5)
383
370
  ```
@@ -403,7 +390,6 @@ function getOrientation() end
403
390
  **示例:**
404
391
 
405
392
  ```lua
406
- local device = require("device")
407
393
  -- 获取屏幕方向
408
394
  local orientation = device.getOrientation()
409
395
  print("屏幕方向: " .. tostring(orientation))
@@ -427,7 +413,6 @@ function getOSVersion() end
427
413
  **示例:**
428
414
 
429
415
  ```lua
430
- local device = require("device")
431
416
  -- 获取系统版本
432
417
  local osVersion = device.getOSVersion()
433
418
  print("系统版本: iOS " .. tostring(osVersion))
@@ -449,7 +434,6 @@ function getLanIp() end
449
434
  **示例:**
450
435
 
451
436
  ```lua
452
- local device = require("device")
453
437
  -- 获取局域网IP
454
438
  local lanIp = device.getLanIp()
455
439
  print("局域网IP = " .. tostring(lanIp))
@@ -475,7 +459,6 @@ function vibrate(duration, intensity) end
475
459
  **示例:**
476
460
 
477
461
  ```lua
478
- local device = require("device")
479
462
  -- 基础振动
480
463
  device.vibrate(500, 0.5); -- 振动500ms,中等强度
481
464
  -- 不同强度的振动
@@ -1,5 +1,7 @@
1
1
  # 点阵 OCR 模块 (dotocr)
2
2
 
3
+ 模块表是内置全局 `dotocr`,直接调用即可。不要 `require` 宿主模块。
4
+
3
5
  点阵 OCR 模块基于图色工具生成的固定像素点阵字库,提供精确的文字识别与查找功能。字库保存在项目的 `res/fonts` 目录,使用前需先加载字库取得字库 ID,再复用该 ID 进行识别,使用完毕后释放。
4
6
 
5
7
  点阵模板按照制作时的原始像素尺寸匹配,不会自动缩放到其他分辨率。目标文字的字号、缩放比例或像素形状发生变化时,应制作对应的字库特征。
@@ -73,7 +75,6 @@ function loadFont(fontPath) end
73
75
  **示例:**
74
76
 
75
77
  ```lua
76
- local dotocr = require("dotocr")
77
78
  local fontId = dotocr.loadFont("/fonts/default.json")
78
79
  if not fontId then
79
80
  print("字库加载失败")
@@ -121,7 +122,6 @@ function recognizeAbs(fontId, input, x, y, ex, ey, confidenceThreshold) end
121
122
  **示例:**
122
123
 
123
124
  ```lua
124
- local dotocr = require("dotocr")
125
125
  local chars = dotocr.recognizeAbs(fontId, "screen", 100, 200, 600, 280, 0.95)
126
126
  print("识别数量: " .. tostring(#chars))
127
127
  if #chars > 0 then
@@ -173,7 +173,6 @@ function findTextAbs(fontId, input, targetTexts, x, y, ex, ey, confidenceThresho
173
173
  **示例:**
174
174
 
175
175
  ```lua
176
- local dotocr = require("dotocr")
177
176
  local hits = dotocr.findTextAbs(
178
177
  fontId,
179
178
  "screen",
@@ -208,7 +207,6 @@ function free(fontId) end
208
207
  **示例:**
209
208
 
210
209
  ```lua
211
- local dotocr = require("dotocr")
212
210
  if fontId then
213
211
  dotocr.free(fontId)
214
212
  print("字库 " .. tostring(fontId) .. " 资源已释放")
@@ -224,7 +222,6 @@ function freeAll() end
224
222
  **示例:**
225
223
 
226
224
  ```lua
227
- local dotocr = require("dotocr")
228
225
  dotocr.freeAll()
229
226
  print("所有点阵字库资源已释放")
230
227
  ```