diff --git a/CHANGELOGS/V1.2.1.md b/CHANGELOGS/V1.2.1.md new file mode 100644 index 0000000..9ff0b3f --- /dev/null +++ b/CHANGELOGS/V1.2.1.md @@ -0,0 +1,40 @@ +# V1.2.1 更新日志 + +- **更新日期**: 2026年05月19日 +- **版本号**: 1.2.1 + +## Bug 修复 + +### 1. [上位机获取修改曝光参数失败](https://pms.anxinyun.cn/bug-view-28454.html) +- **修复多设备环境下曝光参数读写失败问题**:当局域网内存在多台已连接的 ADB 设备时,读取或设置曝光参数可能出现 `more than one device/emulator` 错误。 +- **明确指定 ADB 目标设备**:曝光参数读取和写入时,ADB `pull` / `push` 操作会按当前连接设备 IP 指定目标设备,避免 ADB 在多设备列表中无法自动选择。 +- **优化 ADB 断开逻辑**:断开设备连接时,仅断开当前设备对应的 ADB 连接,避免影响其他已连接设备。 +- **提升多设备使用稳定性**:多台设备同时在线、切换设备连接、重复读取/设置曝光参数时,操作目标更加明确,降低串设备或操作失败风险。 + +## 技术细节 + +### ADB 设备选择 +- 新增 ADB serial 规范化处理: + - 输入设备 IP 时,自动转换为 ADB TCP serial 格式,例如 `192.168.1.100:5555` + - 如果已传入带端口的地址,则保持原值 +- ADB 文件操作改为定向执行: + - `adb -s <设备serial> pull /data/OLE.ini ...` + - `adb -s <设备serial> push OLE.ini /data/` + - `adb -s <设备serial> push OLE.ini /system/etc/` + +## 影响范围 +- 曝光参数读取 +- 曝光参数设置 +- 设备断开时的 ADB 连接清理 + + +## 依赖更新 +- 无依赖包更新 + +## 注意事项 +1. 本版本默认 ADB TCP 端口为 `5555`,业务 TCP 通信端口仍为 `2230`。 +2. 如设备 ADB 端口不是 `5555`,需使用带端口的设备地址或调整 ADB 连接配置。 + +--- + +**完整更新内容请查看项目 Git 提交记录** diff --git a/README.md b/README.md index 9170cd4..76a7c3e 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ > 基于 Electron + React + Vite 开发的光电挠度仪上位机应用程序 ![Platform](https://img.shields.io/badge/platform-Windows-lightgrey.svg) -![Version](https://img.shields.io/badge/version-1.1.0-green.svg) +![Version](https://img.shields.io/badge/version-1.2.1-green.svg) --- ## 最新版本下载 -- [Latest Releases](https://iotfileres.anxinyun.cn/FlexometerSetup/FlexometerSetup-1.1.0-setup.exe) 下载最新安装包 +- [Latest Releases](https://iotfileres.anxinyun.cn/FlexometerSetup/FlexometerSetup-1.2.1-setup.exe) 下载最新安装包 ## 目录 @@ -413,8 +413,11 @@ nsis: 2. **创建 Release** - 在代码仓库创建新的 Release - 上传生成的 `setup.exe` 安装包 + - - 添加版本说明和更新日志 +该上位机发行包采用 .exe 可执行文件,发行地址位于[https://www.qiniu.com/](https://www.qiniu.com/) iot-filemanagement 空间下的 FlexometerSetup 目录。 + ### 开发规范 #### 代码风格 diff --git a/package-lock.json b/package-lock.json index 3636c7f..fece591 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "FlexometerSetup", - "version": "1.0.5", + "version": "1.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "FlexometerSetup", - "version": "1.0.5", + "version": "1.2.0", "hasInstallScript": true, "dependencies": { "@ant-design/icons": "^5.6.1", diff --git a/package.json b/package.json index 17a3eba..a623ee0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "FlexometerSetup", - "version": "1.2.0", + "version": "1.2.1", "description": "An Electron application with React", "main": "./out/main/index.js", "author": "cles", diff --git a/src/main/ipcRouter.js b/src/main/ipcRouter.js index 2389289..d0bff80 100644 --- a/src/main/ipcRouter.js +++ b/src/main/ipcRouter.js @@ -555,7 +555,7 @@ const disconnectDevice = (event, { ip }) => { // 停止重连和心跳检测 reconnectManager.stopReconnect(ip) stopHeartbeatCheck(ip) - disconnect() // 断开adb连接 + disconnect(ip) // 只断开当前设备的adb连接 connectionInfo.client.destroy() tcpClients.delete(ip) tcpConnectionData.delete(ip) // 清除连接数据 diff --git a/src/main/lib/adbClient.js b/src/main/lib/adbClient.js index e4cf3f1..4d0df19 100644 --- a/src/main/lib/adbClient.js +++ b/src/main/lib/adbClient.js @@ -42,6 +42,11 @@ function resolveAdbPath() { const adbPath = resolveAdbPath() const adbDir = path.dirname(adbPath) +function getAdbSerial(ip) { + if (!ip) throw new Error('ip required') + return ip.includes(':') ? ip : `${ip}:5555` +} + /** * 运行 adb 命令的通用封装 */ @@ -72,23 +77,25 @@ function runAdb(args, options = {}) { // 下面其余 API 保持不变(仅把 fs/promises 改为 fsp 引用) async function connect(ip) { if (!ip) throw new Error('ip required') - return runAdb(['connect', ip]) + return runAdb(['connect', getAdbSerial(ip)]) } async function disconnect(ip) { - if (ip) return runAdb(['disconnect', ip]) + if (ip) return runAdb(['disconnect', getAdbSerial(ip)]) return runAdb(['disconnect']) } -async function pull(remotePath, destFilename) { +async function pull(remotePath, destFilename, ip) { const dest = path.join(adbDir, destFilename || path.basename(remotePath)) await fsp.mkdir(adbDir, { recursive: true }) - await runAdb(['pull', remotePath, dest]) + const serialArgs = ip ? ['-s', getAdbSerial(ip)] : [] + await runAdb([...serialArgs, 'pull', remotePath, dest]) return dest } -async function push(localPath, remotePath) { - return runAdb(['push', localPath, remotePath]) +async function push(localPath, remotePath, ip) { + const serialArgs = ip ? ['-s', getAdbSerial(ip)] : [] + return runAdb([...serialArgs, 'push', localPath, remotePath]) } async function readLocalOLE() { @@ -113,7 +120,7 @@ async function writeFirstOLE(line1) { async function getParametersFromDevice(ip) { if (ip) await connect(ip) - await pull('/data/OLE.ini', 'OLE.ini') + await pull('/data/OLE.ini', 'OLE.ini', ip) return readLocalOLE() } @@ -121,11 +128,11 @@ async function setFirstParameter({ param, ip, toSystem = false }) { if (param == null) throw new Error('param required') const local = await writeFirstOLE(param) if (ip) await connect(ip) - await push(local, '/data/') + await push(local, '/data/', ip) if (toSystem) { - await push(local, '/system/etc/') + await push(local, '/system/etc/', ip) } return { local } } -export { adbPath, runAdb, connect, pull, push, readLocalOLE, writeFirstOLE, getParametersFromDevice, setFirstParameter, disconnect } +export { adbPath, runAdb, connect, pull, push, readLocalOLE, writeFirstOLE, getParametersFromDevice, setFirstParameter, disconnect, getAdbSerial }