ZL.IotHub.Bridges
2.3.0
dotnet add package ZL.IotHub.Bridges --version 2.3.0
NuGet\Install-Package ZL.IotHub.Bridges -Version 2.3.0
<PackageReference Include="ZL.IotHub.Bridges" Version="2.3.0" />
<PackageVersion Include="ZL.IotHub.Bridges" Version="2.3.0" />
<PackageReference Include="ZL.IotHub.Bridges" />
paket add ZL.IotHub.Bridges --version 2.3.0
#r "nuget: ZL.IotHub.Bridges, 2.3.0"
#:package ZL.IotHub.Bridges@2.3.0
#addin nuget:?package=ZL.IotHub.Bridges&version=2.3.0
#tool nuget:?package=ZL.IotHub.Bridges&version=2.3.0
ZL.IotHub.Bridges
把采集事件从 PlcNotificationHub 桥接到宿主应用(WinForm / WPF / 控制台 / SignalR / 任意自定义出口)。
只做分发,不含采集逻辑;事件是增量(仅变化的点位),不是全量快照。
装什么
dotnet add package ZL.IotEngine
dotnet add package ZL.IotDriver
dotnet add package ZL.IotHub.Bridges
目标框架:netstandard2.0 / net48 / net8.0 / net10.0
桌面应用(WinForm / WPF)—— 一行启动
using ZL.IotHub.Bridges;
// 创建并**立即启动**本地事件桥(内部自动挂到 PlcNotificationHub 单例并泵送)
var bridge = PlcBridgeBootstrap.CreateAndStartLocalBridge(
synchronizationContext: SynchronizationContext.Current); // UI 应用传入 UI 上下文
bridge.EventReceived += e =>
{
// e.Kind : PlcBridgeEventKind.TagChanges / Connection / DeviceStateChanged
// e.DeviceId : 设备 Id
// e.Changes : 变化的点位(增量)
// e.Connected : 连接状态(Kind=Connection 时有效)
// e.RuntimeState : 设备运行态(Kind=DeviceStateChanged 时有效)
// e.Sequence / e.Timestamp / e.Message / e.PingOk / e.ExeSuccess
};
// 退出时释放
bridge.Dispose();
为什么需要传
SynchronizationContext:事件来自后台采集线程, 传 UI 上下文后回调会被投递到 UI 线程,宿主不需要自己写InvokeRequired。 不传则回调在后台线程触发,宿主必须自行切线程。
SignalR(推给远程客户端)
// 1) 建一个 sink:把事件 POST 到远端 Hub 方法
var sink = new SignalRPlcBridgeSink(
hubUrl: "https://your-server/scadahub",
methodName: "PublishPlcEvent"); // 远端 Hub 上的方法名
// 2) 建泵并启动
var pump = PlcBridgeBootstrap.CreateAndStartPump(sink);
...
pump.Dispose();
自定义出口(回调 / 消息队列 / 你自己的 IPC)
// 用回调 sink:把事件丢进你自己的队列即可
var sink = new CallbackPlcBridgeSink(async (evt, ct) =>
{
await myQueue.EnqueueAsync(evt, ct);
});
var pump = PlcBridgeBootstrap.CreateAndStartPump(sink);
也可以直接实现
IPlcBridgeSink(唯一成员:Task PublishAsync(PlcBridgeEvent evt, CancellationToken ct = default))。
主要类型
| 类型 | 用途 |
|---|---|
PlcBridgeBootstrap |
两个工厂:CreateAndStartLocalBridge(...) / CreateAndStartPump(sink, ...) |
PlcLocalEventBridge |
本地事件桥;暴露 event Action<PlcBridgeEvent> EventReceived |
PlcBridgePump |
从 Hub 拉事件并推给 IPlcBridgeSink |
IPlcBridgeSink |
出口抽象(PublishAsync) |
CallbackPlcBridgeSink |
回调式出口 |
SignalRPlcBridgeSink |
SignalR 出口 |
PlcBridgeFilter |
过滤(按设备/事件类型) |
PlcBridgeEvent / PlcBridgeEventKind |
事件体 / 事件类型枚举 |
DeviceRuntimeState |
设备运行态枚举 |
边界
- 只做分发,不含采集逻辑(采集在
ZL.IotEngine/ZL.IotDriver) - 事件是增量(仅变化点),不是全量快照;需要全量请查
PlcNotificationHub.GetLatestSnapshot() PlcLocalEventBridge/PlcBridgePump都实现IDisposable—— 宿主退出时必须 Dispose, 否则后台泵不会停- 默认不做批量合并以外的业务加工;如需限流/聚合请用
PlcBridgeFilter或在 sink 侧实现
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- Microsoft.AspNetCore.SignalR.Client (>= 8.0.32)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- MQTTnet (>= 4.3.7.1207)
- System.Text.Json (>= 8.0.6)
- System.Threading.Channels (>= 8.0.0)
- ZL.IotAbstraction (>= 2.3.0)
- ZL.IotDriver (>= 2.3.0)
- ZL.IotEngine (>= 2.3.0)
-
.NETStandard 2.0
- Microsoft.AspNetCore.SignalR.Client (>= 8.0.32)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- MQTTnet (>= 4.3.7.1207)
- System.Text.Json (>= 8.0.6)
- System.Threading.Channels (>= 8.0.0)
- ZL.IotAbstraction (>= 2.3.0)
- ZL.IotDriver (>= 2.3.0)
- ZL.IotEngine (>= 2.3.0)
-
net10.0
- Microsoft.AspNetCore.SignalR.Client (>= 8.0.32)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- MQTTnet (>= 4.3.7.1207)
- ZL.IotAbstraction (>= 2.3.0)
- ZL.IotDriver (>= 2.3.0)
- ZL.IotEngine (>= 2.3.0)
-
net8.0
- Microsoft.AspNetCore.SignalR.Client (>= 8.0.32)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- MQTTnet (>= 4.3.7.1207)
- ZL.IotAbstraction (>= 2.3.0)
- ZL.IotDriver (>= 2.3.0)
- ZL.IotEngine (>= 2.3.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ZL.IotHub.Bridges:
| Package | Downloads |
|---|---|
|
ZL.IotHub.Server
SCADA / Web API 实时通信服务端:基于 SignalR Server,对接 ZL.IotEngine + ZL.IotDriver 采集内核(事件桥接经 ZL.IotHub.Bridges)。 示例见 https://github.com/qwdingyu/ZL.IotHubDemo 。 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.3.0 | 105 | 11/19/2026 |
| 2.2.18 | 124 | 11/7/2026 |
| 2.2.17 | 133 | 10/27/2026 |
| 2.2.16-beta.3 | 81 | 10/15/2026 |
| 2.2.16-beta.2 | 65 | 10/15/2026 |
| 2.2.16-beta.1 | 77 | 10/15/2026 |
| 2.2.15 | 116 | 10/8/2026 |
| 2.2.14 | 127 | 10/6/2026 |
| 2.2.13 | 110 | 9/29/2026 |
| 2.2.12 | 109 | 9/28/2026 |
| 2.2.11 | 117 | 9/23/2026 |
| 2.2.10 | 118 | 9/21/2026 |
| 2.2.8 | 131 | 9/11/2026 |
| 2.2.7 | 119 | 9/11/2026 |
| 2.2.6 | 132 | 9/10/2026 |
| 2.2.5 | 130 | 9/10/2026 |
| 2.2.4 | 176 | 9/6/2026 |
| 2.2.3 | 125 | 9/4/2026 |
| 2.2.2 | 121 | 9/4/2026 |
| 2.2.1 | 160 | 6/26/2026 |