using InnovEnergy.Lib.Devices.Adam6060; using InnovEnergy.Lib.Protocols.Modbus.Channels; namespace InnovEnergy.App.SaliMax.SaliMaxRelays; public class RelaysDeviceAdam6060 { private Adam6060Device AdamDevice6060 { get; } public RelaysDeviceAdam6060(String hostname) => AdamDevice6060 = new Adam6060Device(hostname, 2); public RelaysDeviceAdam6060(Channel channel) => AdamDevice6060 = new Adam6060Device(channel, 2); public RelaysRecordAdam6060? Read() { try { return AdamDevice6060.Read(); } catch (Exception e) { $"Failed to read from {nameof(RelaysDeviceAdam6060)}\n{e}".LogError(); return null; } } public void Write(RelaysRecordAdam6060 r) { try { AdamDevice6060.Write(r); } catch (Exception e) { $"Failed to write to {nameof(RelaysDeviceAdam6060)}\n{e}".LogError(); } } }