Files
tbf/TBF/BenchControl/Elde/PressureMeter/PressureMeterCfg.cs
T

78 lines
2.7 KiB
C#

///
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.PressureMeter
{
public class PressureMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg, SchematicDrawing.IDrawingItemCfg
{
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 int Idx0; /// 0..3
public MeretProtocol Protocol; /// Meret or Modbus
public byte RS485Address; /// 0..255
/// Calibration info serialized parameters displayed in Metrology tab page
public string CalibCertificateNr { get; set; }
public DateTime CalibDate { get; set; }
public DateTime CalibValidDate { get; set; }
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { get; set; }
public bool Flip { get; set; }
public int LblX { get; set; }
public int LblY { get; set; }
public SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
PressureMeterCfg()
{
Name = "Pr";
Shape = SchematicDrawing.Shape.PressM;
ParentName = "CB";
Idx0 = 0;
Protocol = MeretProtocol.Modbus;
RS485Address = 99;
}
public PressureMeterCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
return string.Format("Name={0}, Parent={1}, Idx0={2}, Protocol={3}, Address={4}",
Name,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
Idx0,
Protocol.ToDescription(),
RS485Address);
}
}
}