完成S7变量启用和停用更新

This commit is contained in:
2025-09-16 14:42:23 +08:00
parent 3102938f92
commit 74fde6bd8b
59 changed files with 226 additions and 454 deletions

View File

@@ -0,0 +1,46 @@
using System.Collections.Concurrent;
using DMS.Core.Models;
using DMS.Infrastructure.Interfaces.Services;
namespace DMS.Infrastructure.Services.Mqtt
{
/// <summary>
/// MQTT设备上下文用于存储单个MQTT服务器的连接信息和状态
/// </summary>
public class MqttDeviceContext
{
/// <summary>
/// MQTT服务器配置
/// </summary>
public MqttServer MqttServer { get; set; }
/// <summary>
/// MQTT服务实例
/// </summary>
public IMqttService MqttService { get; set; }
/// <summary>
/// 连接状态
/// </summary>
public bool IsConnected { get; set; }
/// <summary>
/// 重连尝试次数
/// </summary>
public int ReconnectAttempts { get; set; }
/// <summary>
/// 与该MQTT服务器关联的所有变量MQTT别名
/// </summary>
public ConcurrentDictionary<int, VariableMqttAlias> VariableMqttAliases { get; set; }
/// <summary>
/// 构造函数
/// </summary>
public MqttDeviceContext()
{
VariableMqttAliases = new ConcurrentDictionary<int, VariableMqttAlias>();
ReconnectAttempts = 0;
}
}
}