tbf/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/TestMethodCfg.cs

72 lines
2.2 KiB
C#

///
/// Copyright (c) 2015-2016 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
///
/// Serialized parameters
///
public int RfidPortNrBoard1;
public int RfidPortNrBoard2;
public int RfidPortNrBoard3;
public int RfidPortNrBoard4;
public int CommTimeout; /// Communication timeout in ms (500 .. 5000)
public int MaxCommRetries; /// Max. number of retries (1 .. 10)
public int NrThreads; /// Numbwr of parallel threads (1, 2 or 4)
/// <summary> Test parameters </summary>
[XmlIgnore]
public iPerlCommunicationParams TestParams;
public override IParamsProvider GetTestParams() { return TestParams; }
public override IParamsProvider CreateTestParams(Test test)
{
iPerlCommunicationParams testParams = new iPerlCommunicationParams(true);
testParams.UpdateTestParams(Name, test);
return testParams;
}
/// Private parameterless constructor invoked by all other (public) constructors
TestMethodCfg()
{
Name = "iPerlCommunication";
ParentName = string.Empty;
RfidPortNrBoard1 = 51;
RfidPortNrBoard1 = 52;
RfidPortNrBoard1 = 53;
RfidPortNrBoard1 = 54;
CommTimeout = 1800; /// ms
MaxCommRetries = 4;
NrThreads = 2; /// 1, 2 or 4 threads
TestParams = new iPerlCommunicationParams(true);
}
public TestMethodCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public string ToString(int i)
{
return string.Format("Name={0}, Brd#1=COM{1}, Brd#2=COM{2}, Brd#3=COM{3}, Brd#4=COM{4}, CommTimeout={5}, MaxRetries={6}, NrThreads={7}",
Name, RfidPortNrBoard1, RfidPortNrBoard2, RfidPortNrBoard3, RfidPortNrBoard4, CommTimeout, MaxCommRetries, NrThreads);
}
}
}