tbf/TBF/Rig/TestMethods/iPerlCommunication/TestMethodCfg_IPerl.cs

97 lines
3.5 KiB
C#
Raw Normal View History

///
/// 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;
2021-03-05 13:47:21 +00:00
using TBF.Rig.Generic;
2025-10-18 07:59:07 +00:00
using TBF.Rig.RegisterReaders.CommonRR.IPerl;
using TBF.Rig.TestMethods.SmartMeterFlyingStartMassCollection;
2021-03-05 13:47:21 +00:00
namespace TBF.Rig.TestMethods.iPerlCommunication
{
2025-10-27 10:49:42 +00:00
[XmlRoot("TestMethodCfg")] // Add this attribute to match the XML root
2025-10-18 07:59:07 +00:00
public class TestMethodCfg_IPerl : ComponentCfgBase, IiPerlTestMethodCfg
{
2025-10-18 07:59:07 +00:00
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg_IPerl) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new TestMethodCfgCtrl(); }
2025-10-18 07:59:07 +00:00
//
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
2025-10-18 07:59:07 +00:00
TestMethodCfg_IPerl()
{
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;
}
2025-10-18 07:59:07 +00:00
public TestMethodCfg_IPerl(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);
}
2025-10-18 07:59:07 +00:00
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]
2025-10-18 07:59:07 +00:00
public ITestParams TestParams { get; set; }
}
}