public bool ProcessCommand(Device device, double value) { if (device is AnalogInput || device is DigitalInput) { return(false); } if (device is AnalogOutput) { if (validator.Validate(device, value)) { var analogCommand = new AnalogCommand() { Address = device.Address, Value = value }; commandExecutor.PutCommand(analogCommand); } else { notificationService.ShowNotification("Error", "Value out of range!", Notifications.Wpf.NotificationType.Error); logger.Warning($"Value {value} out of range for device at address {device.TypeOfRegister}{device.Address}"); } return(true); } else { var digitalCommand = new DigitalCommand() { Address = device.Address, Value = (byte)value }; commandExecutor.PutCommand(digitalCommand); return(true); } }
public void DoWork() { logger.Debug("Automation started!"); DigitalOutput output1 = FindByAddress(1001) as DigitalOutput; if (output1.Value == 1) { executor.PutCommand(new DigitalCommand() { Address = 1001, Value = 0 }); } }