A – Registration and execution - Register GenesisCommunication Factory in the component list. - Separate the Genesis form and sequence from iPerl communication. B – Communication activities - Restore initialization, connection, PCB reading, password and login. - Include grouped login, mode switching and disconnection. - Support processing up to 10 slots. C1 – Input calibration factors - Read three factors from Water meters / Text1–Text3. - Validate integer values in the range 1–65535. - Preserve the default of 15625 when all three fields are empty. D – Q3 calibration - Connect the Prepare Q3 → measurement → Write Q3 workflow. - Add channel processing to FlyingStart and FlyingStartMassCollection. - Reset previous measurement data and validate calculated factors. - Mark factors as stored only after StoreCalibration succeeds. E – Results and database - Store calibration factors separately for each meter and channel. - Add result entities, mappings and Q3 data. - Extend DB.cs / EnsureSchema to create and update the schema. - Preserve compatibility with the existing binary format. Validation: - Debug build and 18 tests passed. - Simulated communication runs follow the same activity sequence. - The complete Q3 workflow has not yet been verified on hardware. Known limitation: - An inherited mismatch in simulated responses and error propagation can produce an incorrect OK result; this change does not fix it.
98 lines
3.4 KiB
C#
98 lines
3.4 KiB
C#
///
|
|
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
|
|
///
|
|
|
|
using System.Collections.Generic;
|
|
using System.IO.Ports;
|
|
using System.Xml.Serialization;
|
|
using Common;
|
|
using Config.Entities;
|
|
using TBF.Rig.Generic;
|
|
using TBF.Rig.RegisterReaders.CommonRR.IPerl;
|
|
using TBF.Rig.TestMethods.iPerlCommunication;
|
|
|
|
|
|
namespace TBF.Rig.TestMethods.GenesisCommunication
|
|
{
|
|
[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<Config.Entities.Component> 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 = "SmartCommunicationGenesis";
|
|
ParentName = string.Empty;
|
|
CommTimeout = 1800; /// ms
|
|
MaxCommRetries = 4;
|
|
WaitTimeAfterFailure = 2200;
|
|
PassThroughWaitTime = 1500;
|
|
NrThreads = 10; /// 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; }
|
|
}
|
|
}
|