using InnovEnergy.Lib.Protocols.Modbus.Protocol; namespace InnovEnergy.Lib.Protocols.Modbus.Reflection.Attributes; public abstract class ModbusRegister : ModbusAttribute { public Double Scale { get; init; } = 1; public Double Offset { get; init; } = 0; protected ModbusRegister(UInt16 address, Type modbusType, ModbusKind kind) : base(address, modbusType, kind) { if (!SupportedTypes.Contains(modbusType)) throw new ArgumentException($"Type {modbusType.Name} is not supported " + $"for {nameof(ModbusRegister)}", nameof(modbusType)); } private static readonly Type[] SupportedTypes = { typeof(Boolean), typeof(Int16) , typeof(UInt16), typeof(Int32), typeof(UInt32), typeof(Single), typeof(Int64) , typeof(UInt64), typeof(Double), }; }