tbf/TBF/Rig/Elde/PressureMeter/PressureMeterCfg.cs

63 lines
2.0 KiB
C#

///
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Common;
using TBF.Rig.Generic;
namespace TBF.Rig.Elde.PressureMeter
{
public class PressureMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.Rig.GenericDevices.ICalibInfoCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PressureMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { 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 string CertPath { get; set; }
public DateTime CalibDate { get; set; }
public DateTime CalibValidDate { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
PressureMeterCfg() { }
public PressureMeterCfg(IComponentFactory factory)
: this()
{
Factory = factory;
Name = "Pr";
ParentName = "CB";
Idx0 = 0;
Protocol = MeretProtocol.Modbus;
RS485Address = 99;
CalibCertificateNr = string.Empty;
CalibDate = TBF.UI.Constants.MinDate;
CalibValidDate = TBF.UI.Constants.MaxDate;
}
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);
}
}
}