You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
开放接口设备连接测试:/openApi 新增 POST /device/testConnection(文档 4.21),用调用方传入的协议名与未保存的连接配置真实连接一次现场设备(与管理端 POST /device/testDeviceConnection 同一条驱动路径),供管理平台「新建设备对象」在保存前校验连接配置。只探测:不写网关配置、不改设备状态;失败返回 40003 并原样带回驱动错误(地址不可达、串口被占用、超时等),调用方应原样展示。
OPC UA 验证工具:新增 backend/cmd/opcuaprobe,用标准 OPC UA 客户端完成 connect / browse / read / subscribe,独立验证网关 OPC UA Server 通道有没有把点位供出去,不依赖 UaExpert,便于在服务器、CI 或录屏环境里重复执行。
构建脚本目标校验:build.bat 新增 linux / native 目标,未知目标直接报错退出;此前未知目标会静默回落到全量构建,build.bat linux 实际编译了四个平台。
修复
开机后的无谓采集重建:插件管理器首次扫描(Manager.Start)不再安排采集配置刷新。该次扫描必然早于采集引擎启动,加载到的驱动会自然进入首个采集任务;此前它仍会排一次 2s 防抖刷新,定时器到期时引擎已运行,导致每次开机后约 2 秒白白重建一轮全部采集任务(go test -race 下还会表现为 TestCollectionContinuesAcrossPluginHotUpgrade 偶发失败)。运行期的插件增删与热升级行为不变。
Added
Per-point engineering transform: device points gain an "engineering transform" (device_address.transform_json, migration 036_device_address_transform.sql) that runs a scale / round / trim / default pipeline once at collection. Live values, point threshold alarms, trigger rules, the offline spool and every push channel (MQTT / Kafka / HTTP / OPC UA / TDengine / InfluxDB) see the same engineering value, so TSDB channels no longer need their own conversion. scale (or round with decimal digits) promotes numeric points' kind to float, and integer OPC UA nodes become Double accordingly; on failure the raw value is kept and the error is logged with rate limiting. The outbound mapping-json transform remains a presentation layer — remove any duplicate scale from channel mappings after moving it to the point.
Point list shows bindings and transforms: the device point configuration list gains an "Engineering Transform" column with a readable summary (e.g. Scale ×0.1 → Round 2 dp, full pipeline on hover) and "Raw" when unset; the "Thing Model Property" column is no longer hidden on narrow screens, since both the binding and the conversion rule are needed to interpret a collected value.
OpenAPI configuration sync: adds a configuration-sync API group under /openApi (docs 4.16): capability negotiation via GET /config/capabilities, masked reads for thing models / devices & points / push channels / alarm webhooks / runtime switches (each with contentHash), and batch writes for push channels, alarm webhooks, runtime switches and device points. Writes only change gateway configuration — never field devices — and report per-item results; "***" keeps the existing secret, and hashes use sha256-canonical-json-v1 (secrets count by presence only). Thing-model upsert gains replaceProperties to drop absent properties; new error codes 42001–42009.
OpenAPI push channel connectivity test: /openApi gains POST /pushChannel/testConnectivity (docs 4.16.7), connecting once to the downstream (MQTT / HTTP / time-series database, …) with the caller's channel type and unsaved config, then disconnecting immediately, so the management platform can validate a push channel before saving it. configJson has the same shape as the config used by configuration sync, but secrets must hold real values ("***" cannot authenticate); failures return the gateway's concrete reason (bad credentials, unreachable host, refused port). Probe only — nothing is persisted and gateway configuration is unchanged.
OpenAPI collector group list: /openApi gains GET /collectorGroup/list (docs 4.16.2), returning the gateway's collector groups with an optional deviceId, for the management platform's push channel "collector group subscription" selector — config.groupIds are gateway-local keys, so the platform can only get this list from the gateway. The collector-group VO gains the device code deviceCode, so the platform can align groups with master data by "device code + group code".
OpenAPI outbound mapping preview: /openApi gains POST /pushChannel/previewMapping (docs 4.16.8), encoding native-json / group-json / mapping-json / script against the gateway's fixed sample batch, for the management platform's visual mapping editor and mapping-less formats to preview instantly; native-json / group-json need no mapping and pick the encoder from format alone. Encoding only — nothing is sent downstream or persisted, and mapping/encoding errors are returned in data.error rather than as API failures.
OpenAPI push channel runtime status: /openApi gains GET /pushChannel/status (docs 4.22), returning the push engine's in-memory snapshot (running/connected state, queue and spool depth, publish/row/dropped counters, last success and error) for the management platform to aggregate per gateway. Read-only with no downstream access; counters reset on restart and only enabled, successfully loaded channels appear.
Platform-defined thing-model categories: OpenAPI category validation now checks the format (lowercase letter start, ≤32) instead of a built-in whitelist, so the management platform owns the vocabulary; the local console still creates only built-in categories but keeps and displays custom codes delivered through the API.
Overridable Docker base images: Dockerfile gains NODE_IMAGE / GOLANG_IMAGE / ALPINE_IMAGE build args wired through docker-compose.yml, easing the switch to mainland mirrors or a private registry; defaults stay on the official tags.
Discovery broadcasts carry platform info: notify / reply gain os / arch fields taken from Go's runtime.GOOS / runtime.GOARCH (e.g. linux/amd64, linux/arm64, windows/amd64), so the management platform can deliver the matching plugin binaries. Both fields use omitempty, so older receivers parse the rest unchanged.
OpenAPI plugin binary delivery: /openApi gains GET /plugin/info (platform / naming rules / upload limits), GET /plugin/status (sha256 snapshot of loaded plugins) and POST /plugin/importPlugin (multipart upload with optional X-Content-SHA256 integrity check), so the management platform can select and deliver a package by os/arch. Uploads remain bounded by plugin.enabled and the per-file / per-batch / request-body limits; new error code 90007 (docs 4.17).
OpenAPI device scan: /openApi gains device-scan endpoints (docs 4.18): capabilities, start / status / continue / cancel, point-scan capability, and two point-scan modes — by deviceCode using the gateway's own device config, or by protocolName + protocolJson using the platform's master data for not-yet-delivered devices; discoverPointsFromScan scans one device in a job result by jobId + index, with the connection config taken from the job snapshot rather than the client. Scan results are not persisted here — devices and points still go through 4.16.3 deviceConfig/batchUpsert — and everything is gated by deviceScan.enabled; new error codes 40021–40027.
OpenAPI realtime snapshot: /openApi gains GET /realtime/snapshot (docs 4.19), locating a device by deviceId or device code code (deviceId wins when both are given) and returning online / collecting / collector-engine status, last success time and each point's latest value (quality code, stale flag) for the management platform's realtime device monitoring. Values come straight from the collector engine's in-memory snapshot — no time-series reads, no field-device access; points not yet collected still occupy a row (collected=false) so row order stays stable across pages, and stale=true means no update for 3× the point's effective period (the group period when bound to a collector group). The admin side queries by UUID and the OpenAPI by natural key, with both ending at the same GetDeviceSnapshot, so realtime semantics never drift.
OpenAPI control capability query: /openApi gains GET /control/capability (docs 4.20), returning by deviceId or device code code the control.enabled switch, protocol writability writable and a reason when not writable (disabled / device_disabled / protocol_missing / protocol_not_writable), so the management platform can decide whether to show a write entry. Read-only and never touching field devices; actual writes still go through 4.8 /control/write.
OpenAPI device connection test: /openApi gains POST /device/testConnection (docs 4.21), opening a real connection once to a field device with the caller's protocol name and unsaved connection config (the same driver path as the admin POST /device/testDeviceConnection), for the management platform to validate connection settings before saving a new device object. Probe only — no gateway config or device state changes; failures return 40003 with the raw driver error (unreachable address, serial port busy, timeout, …) that callers should surface verbatim.
OPC UA verification tool: adds backend/cmd/opcuaprobe, a standard OPC UA client with connect / browse / read / subscribe modes that independently checks whether the gateway's OPC UA Server channel exposes points, without UaExpert, so it can be re-run on a server, in CI or on a recording host.
Raw vs. engineering values in realtime writes: the realtime device snapshot now passes each point's transformJson through; the control-write dialog keeps the input in the raw value and shows a read-only preview of the corresponding engineering value (the write path has no inverse transform, so an engineering value is never sent as if it were raw). The same dialog gains a device identity card and "copy address". The frontend pipeline mirrors the backend mappingdsl operators (scale defaults to ×1+0, round to fixed decimals) and shows no preview when conversion fails.
Changed
Console interaction polish: point and trigger-rule edit dialogs are split into sectioned cards with inline help, and the point dialog widens to min(900px, 94vw); the device scan page gains a stat card, a protocol-help aside and a stable results area, so in-flight results no longer jump between polls.
Build script target validation: build.bat gains linux / native targets and rejects unknown targets; previously an unknown target silently fell back to the full build, so build.bat linux compiled all four platforms.
Fixed
Pointless collection rebuild after boot: the plugin manager's initial scan (Manager.Start) no longer schedules a collector refresh. That scan always runs before the collector starts, so the drivers it loads are picked up by the first collection task; previously it still queued a 2s-debounced refresh, which by then saw a running engine and rebuilt the entire collection task about 2 seconds after every boot (and made TestCollectionContinuesAcrossPluginHotUpgrade flaky under go test -race). Runtime plugin add/remove and hot-upgrade behavior is unchanged.