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