using System;
namespace APS7100TestTool.Models
{
///
/// 应用程序设置
///
public class AppSettings
{
// APS7100 连接设置
public bool AutoConnectAPS7100 { get; set; } = false;
public string APS7100ConnectionType { get; set; } = "Serial"; // Serial or Ethernet
public string APS7100ComPort { get; set; } = "";
public int APS7100BaudRate { get; set; } = 9600;
public string APS7100IpAddress { get; set; } = "192.168.1.100";
public int APS7100Port { get; set; } = 2268;
// PSW250 连接设置
public bool AutoConnectPSW250 { get; set; } = false;
public string PSW250ConnectionType { get; set; } = "Serial"; // Serial or Ethernet
public string PSW250ComPort { get; set; } = "";
public int PSW250BaudRate { get; set; } = 9600;
public string PSW250IpAddress { get; set; } = "192.168.1.101";
public int PSW250Port { get; set; } = 2268;
// Modbus 服务设置
public bool AutoStartModbus { get; set; } = false;
public int ModbusPort { get; set; } = 502;
public string ModbusBindIpAddress { get; set; } = "0.0.0.0"; // 绑定IP地址,0.0.0.0表示所有接口
public string ModbusConfigPath { get; set; } = ""; // 自动加载的配置文件路径
// 心跳寄存器地址设置
public ushort HeartbeatRegisterAddress { get; set; } = 1; // 心跳寄存器地址(APP运行心跳)
public ushort DeviceStatusRegisterAddress { get; set; } = 2; // 设备状态寄存器地址
// 启动行为设置
public bool StartMinimized { get; set; } = false; // 启动时最小化到托盘
// 更新时间
public DateTime LastUpdated { get; set; } = DateTime.Now;
}
///
/// 设备连接信息(用于状态显示)
///
public class DeviceConnectionInfo
{
public DeviceType DeviceType { get; set; }
public bool IsConnected { get; set; }
public string ConnectionType { get; set; } = "";
public string ConnectionInfo { get; set; } = "";
public string DeviceIdentification { get; set; } = "";
public bool OutputState { get; set; }
public double Voltage { get; set; }
public double Current { get; set; }
public double Power { get; set; }
public double Frequency { get; set; }
public double PowerFactor { get; set; }
public DateTime LastUpdateTime { get; set; }
public string ErrorMessage { get; set; } = "";
}
}