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