using Aurora.Api; using Aurora.Api.Devices; using AuroraLaser.Ekspla.NL202; using PropertyTools.DataAnnotations; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AuroraLaser.Ekspla { public class LaserEksplaConfig : IDeviceConfig { [SortIndex(0)] //////////////////////////////////////// [Category("Common")] [Browsable(false), ReadOnly(true), DisplayName("Device Type")] public eLaserEksplaDeviceType LaserType { get; set; } [SortIndex(1)] //////////////////////////////////////// [Category("Serial Connection")] [DisplayName("Serial Connection")] public IConnConfig ConnConfig { get; set; } [SortIndex(2)] //////////////////////////////////////// [Category("Laser Parameters")] [Browsable(false), DisplayName("Is NL202 Device")] public bool IsNL202 { get; set; } [VisibleBy("IsNL202"), DisplayName("NL202 Configs")] public LaserNL202Config NL202Config { get; set; } public LaserEksplaConfig() { LaserType = eLaserEksplaDeviceType.UNKNOWN; // Serial Config ConnConfig = new SerialConnConfig() { PortNum = 11, BaudRate = 115200, Parity = System.IO.Ports.Parity.None, StopBits = System.IO.Ports.StopBits.One, DataBits = 8, ReadTimeout = 1000, DtrEnable = true, RtsEnable = true }; // RS232_OpenComport(m_nPort, 115200, "8N1") -> (8=bits, N=parity, 1=StopBits), dtr=on rts=on // NL202 Config IsNL202 = false; NL202Config = new LaserNL202Config(); } public static LaserEksplaConfig GetDefaultConfig(eLaserEksplaDeviceType type) { var config = new LaserEksplaConfig(); config.LaserType = type; config.ConnConfig = new SerialConnConfig() { PortNum = 11, BaudRate = 115200, Parity = System.IO.Ports.Parity.None, StopBits = System.IO.Ports.StopBits.One, DataBits = 8, ReadTimeout = 1000, DtrEnable = true, RtsEnable = true }; // RS232_OpenComport(m_nPort, 115200, "8N1") -> (8=bits, N=parity, 1=StopBits), dtr=on rts=on if (type == eLaserEksplaDeviceType.NL202) { config.IsNL202 = true; config.NL202Config = LaserNL202Config.GetDefaultConfig(); } return config; } } }