/// /// Copyright (c) 2015-2021 Sensus Slovensko a.s. /// using System.Collections.Generic; using System.IO.Ports; using System.Threading; using System.Xml.Serialization; using Common; using Config.Entities; using TBF.Rig.Generic; using TBF.Rig.RegisterReaders.CommonRR.IPerl; using TBF.Rig.TestMethods.SmartMeterFlyingStartMassCollection; namespace TBF.Rig.TestMethods.iPerlCommunication { [XmlRoot("TestMethodCfg")] // Add this attribute to match the XML root public class TestMethodCfg : ComponentCfgBase, IiPerlTestMethodCfg { public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0]; public override XmlSerializer GetSerializer() { return Serializer; } public IComponentCfgCtrl GetControl(IList cmpntEntities) { return new TestMethodCfgCtrl(); } // public override IParamsProvider GetRuntimeTestParamsProvider() { return TestParams; } public override IParamsProvider CreateTestParamsProvider() { return new iPerlCommunicationParams(true); } public override IParamsProvider GetUITestParamsProvider(Test test) { return (test.Method == Name) ? base.GetUITestParamsProvider(test) : null; } /// Private parameterless constructor invoked by all other (public) constructors TestMethodCfg() { Name = "SmartCommunication"; ParentName = string.Empty; CommTimeout = 1800; /// ms MaxCommRetries = 4; WaitTimeAfterFailure = 2200; PassThroughWaitTime = 1500; NrThreads = 2; /// 1, 2 or 4 threads IperlCheckErrorsToStop = 10; MciTimeoutMs = 4000; // ms, NFC interface BaudRate = 57600; // NFC Interface DataBits = 8; // NFC Interface ParityBit = Parity.None; // NFC Interface StopBits = StopBits.Two; // NFC Interface TestParams = CreateTestParamsProvider() as iPerlCommunicationParams; } public TestMethodCfg(IComponentFactory factory) : this() { this.Factory = factory; } public string ToString(int i) { return string.Format("Name={0}, CommTimeout={1}, MaxRetries={2}, NrThreads={3}", Name, CommTimeout, MaxCommRetries, NrThreads); } public int DelayBetweenRetries { get; set; } public int MaxCommRetries { get; set; } public int WaitTimeAfterFailure { get; set; } public int PassThroughWaitTime { get; set; } public int NrThreads { get; set; } public int CommTimeout { get; set; } public int IperlCheckErrorsToStop { get; set; } public int MciTimeoutMs { get; set; } public int BaudRate { get; set; } public int DataBits { get; set; } public Parity ParityBit { get; set; } public StopBits StopBits { get; set; } public int DfltQ2c_15_rl { get; set; } public int DfltQ2c_15_lr { get; set; } public int DfltQ2c_20_rl { get; set; } public int DfltQ2c_20_lr { get; set; } public int DfltQ2c_25_63_rl { get; set; } public int DfltQ2c_25_63_lr { get; set; } public int DfltQ2c_25_10_rl { get; set; } public int DfltQ2c_25_10_lr { get; set; } public int DfltQ2c_32_rl { get; set; } public int DfltQ2c_32_lr { get; set; } public int DfltQ2c_40_rl { get; set; } public int DfltQ2c_40_lr { get; set; } public bool UseWebService { get; set; } public string BaseUrl { get; set; } public string RelativeUrl { get; set; } ///Remember to Ignore in XmlSerializer !! [XmlIgnore] public ITestParams TestParams { get; set; } } }