using Aurora.Api; using Aurora.Api.Devices; using PropertyTools.DataAnnotations; namespace AuroraLaser.Ekspla { public class LaserConfig : IDeviceConfig { [SortIndex(0)] //////////////////////////////////////// [Category("Common")] [DisplayName("Simulation Mode (this device)")] public bool IsSimul { get; set; } [Browsable(false), ReadOnly(true), DisplayName("Device Type")] public eLaserDeviceType 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 LaserConfigNL202 NL202Config { get; set; } public LaserConfig() { IsSimul = false; LaserType = eLaserDeviceType.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 LaserConfigNL202(); } public static LaserConfig GetDeviceConfig(eLaserDeviceType type) { var config = new LaserConfig(); config.IsSimul = false; 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 == eLaserDeviceType.NL202) { config.IsNL202 = true; config.NL202Config = LaserConfigNL202.GetDeviceConfig(); } return config; } } public class LaserConfigNL202 { [SortIndex(1)] [Category("Laser Parameter")] public double PUMP_LEVEL { get; set; } public double BURST_COUNT { get; set; } public double BURST_MODE { get; set; } public double REPETITION_RATE { get; set; } public double ENERGY_LEVEL { get; set; } public double WAVE_LENGTH { get; set; } public double ATTEN { get; set; } public double SYNC_MODE { get; set; } // Default Config (NL202 - Serial) public static LaserConfigNL202 GetDeviceConfig() { var config = new LaserConfigNL202(); config.PUMP_LEVEL = 1; config.BURST_COUNT = 1; config.BURST_MODE = 1; config.REPETITION_RATE = 0.4; config.ENERGY_LEVEL = 1; config.WAVE_LENGTH = 10; config.ATTEN = 2; config.SYNC_MODE = 2; return config; } } }