2026-03-30 17:09:29 +09:00

68 lines
1.8 KiB
C#

using Aurora.Api;
using Aurora.Api.DataType;
using Aurora.Api.Devices;
using System.ComponentModel;
using System.IO.Ports;
namespace AuroraPowerMeter
{
public class PowerMeterConfig : IDeviceConfig
{
[DisplayName("Simulation Mode (this device)")]
public bool IsSimul { get; set; } = false;
public IConnConfig ConnConfig { get; set; }
public PowerMeterConfig()
{
ConnConfig = new SerialConnConfig() {
BaudRate = 9600,
DataBits = 8,
StopBits = StopBits.One,
Parity = Parity.None,
PortNum = 1,
NewLine = "\n",
ReadTimeout = 5000,
WriteTimeout = 1000
};
}
public static PowerMeterConfig GetDefaultConfig()
{
var config = new PowerMeterConfig();
config.IsSimul = false;
config.ConnConfig = new SerialConnConfig() {
BaudRate = 9600,
DataBits = 8,
StopBits = StopBits.One,
Parity = Parity.None,
PortNum = 1,
NewLine = "\n",
ReadTimeout = 5000,
WriteTimeout = 1000
};
return config;
}
public static PowerMeterConfig GetGentecIntegraConfig()
{
var config = new PowerMeterConfig();
config.IsSimul = false;
config.ConnConfig = new SerialConnConfig() {
BaudRate = 115200,
DataBits = 8,
StopBits = StopBits.One,
Parity = Parity.None,
PortNum = 1,
NewLine = "\n",
ReadTimeout = 5000,
WriteTimeout = 1000
};
return config;
}
}
}