tbf/TBF/BenchControl/Modbus/PressureMeter/Meter/PressureMeterCfg.cs

77 lines
2.3 KiB
C#

///
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
///
using System;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
using System.Collections.Generic;
namespace TBF.BenchControl.Modbus.PressureMeter.Meret
{
public class PressureMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg, IDrawingItemWithMeasuredVal
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PressureMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new PressureMeterCfgCtrl(); }
///
/// Serialized parameters
///
public byte ModbusAddress; /// 1..255
/// Schematic drawing info
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public Sz Sz { get; set; }
public Orient Orient { get; set; }
public bool Flip { get; set; }
public int LblX { get; set; }
public int LblY { get; set; }
public Orient LblOrient { get; set; }
public int MsrdX { get; set; }
public int MsrdY { get; set; }
public Orient MsrdOrient { get; set; }
public Config.Unit MsrdUnits { get; set; }
public string MsrdFormat { get; set; }
public double MsrdValLimLo { get; set; }
public double MsrdValLimHi { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
PressureMeterCfg()
{
GNodes = new List<GNode>();
}
public PressureMeterCfg(IComponentFactory factory)
: this()
{
Shape = Shape.PressM;
Sz = Sz.M;
Factory = factory;
Name = "Pr";
ParentName = "Modbus";
ModbusAddress = 49;
}
public string ToString(int i)
{
return string.Format("{0}(1) {2}[{3},{4}] addr={5}",
Name,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
Shape,
X,
Y,
ModbusAddress);
}
}
}