polishing - work now
This commit is contained in:
@@ -7,6 +7,7 @@ using System;
|
||||
using System.Threading;
|
||||
using TBF.Rig.Hart.Common;
|
||||
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
|
||||
using TBF.Rig.Uni.SharedDialogs.SmartMetersCommunication;
|
||||
using static Sensus.iPerl.NfcHandler.MCI_Protocol;
|
||||
|
||||
namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
@@ -26,7 +27,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
try
|
||||
{
|
||||
byte[] pcb = null;
|
||||
int readRetVal = iPerlCommunicationForm.ReadRequestPort(iHead, MessageID.Configuration, Sensus.iPerl.NfcHandler.MCI_Protocol.StructName.Configuration, 16, 5, out pcb);
|
||||
int readRetVal = IPerlCorrections.ReadRequestPort(SmartCommunicationForm.TestMethodCfg, iHead, RegisterReaders.CommonRR.MessageID.Configuration, Sensus.iPerl.NfcHandler.MCI_Protocol.StructName.Configuration, 16, 5, out pcb);
|
||||
if (readRetVal == 0)
|
||||
{
|
||||
return RfidHelper.HexLiteral2Unsigned(RfidHelper.SwapHexcode(BitConverter.ToString(pcb).Replace("-", string.Empty))).ToString();
|
||||
@@ -43,7 +44,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
internal static string SetActiveMode(IperlHead iHead)
|
||||
{
|
||||
byte[] cmd = new byte[1] { (byte)Command.SetActiveMode };
|
||||
if (0 == iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.Command, StructName.Command, 0, 1, cmd))
|
||||
if (0 == IPerlCorrections.WriteRequestPort(SmartCommunicationForm.TestMethodCfg, iHead, RegisterReaders.CommonRR.MessageID.Command, StructName.Command, 0, 1, cmd))
|
||||
{
|
||||
return "OK";
|
||||
}
|
||||
@@ -56,7 +57,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
internal static string SetTestMode(IperlHead iHead)
|
||||
{
|
||||
byte[] cmd = new byte[1] { (byte)Command.SetTestMode };
|
||||
if (0 == iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.Command, StructName.Command, 0, 1, cmd))
|
||||
if (0 == IPerlCorrections.WriteRequestPort(SmartCommunicationForm.TestMethodCfg, iHead, RegisterReaders.CommonRR.MessageID.Command, StructName.Command, 0, 1, cmd))
|
||||
{
|
||||
return "OK";
|
||||
}
|
||||
@@ -71,7 +72,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
try
|
||||
{
|
||||
int retValue = iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.RadioPassthrough, StructName.RadioParams, 0x1898, 1, new byte[] { (byte)3 }); // WakeUpInterval
|
||||
int retValue = IPerlCorrections.WriteRequestPort(SmartCommunicationForm.TestMethodCfg, iHead, RegisterReaders.CommonRR.MessageID.RadioPassthrough, StructName.RadioParams, 0x1898, 1, new byte[] { (byte)3 }); // WakeUpInterval
|
||||
return 0 == retValue ? "OK" : "Error";
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -84,7 +85,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
try
|
||||
{
|
||||
int retValue = iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.RadioPassthrough, StructName.RadioInfo, 0x1804, 1, new byte[] { (byte)1 }); // System Status
|
||||
int retValue = IPerlCorrections.WriteRequestPort(SmartCommunicationForm.TestMethodCfg,iHead, RegisterReaders.CommonRR.MessageID.RadioPassthrough, StructName.RadioInfo, 0x1804, 1, new byte[] { (byte)1 }); // System Status
|
||||
return 0 == retValue ? "OK" : "Error";
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
|
||||
public bool DoTransitions() { return false; }
|
||||
|
||||
public bool SimultWithPrevious { get { return testMethodCfg.TestParams.SimultWithPrevious; } }
|
||||
public bool SimultWithNext { get { return testMethodCfg.TestParams.SimultWithNext; } }
|
||||
public bool SimultWithPrevious { get { return _testMethodCfgIPerl.TestParams.SimultWithPrevious; } }
|
||||
public bool SimultWithNext { get { return _testMethodCfgIPerl.TestParams.SimultWithNext; } }
|
||||
|
||||
#region Configuration Change Handling
|
||||
|
||||
@@ -40,18 +40,18 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
CfgChangeHandler += delegate(object sender, CfgChangeArgs args)
|
||||
{
|
||||
TestMethodCfg tmpCfg = args.Cfg as TestMethodCfg;
|
||||
if (tmpCfg != null && tmpCfg.Name.Equals(Name))
|
||||
TestMethodCfg_IPerl tmpCfgIPerl = args.Cfg as TestMethodCfg_IPerl;
|
||||
if (tmpCfgIPerl != null && tmpCfgIPerl.Name.Equals(Name))
|
||||
{
|
||||
if (args.Command == CfgChangeCmd.CfgChange)
|
||||
{
|
||||
testMethodCfg.CommTimeout = tmpCfg.CommTimeout;
|
||||
testMethodCfg.DelayBetweenRetries = tmpCfg.DelayBetweenRetries;
|
||||
testMethodCfg.MaxCommRetries = tmpCfg.MaxCommRetries;
|
||||
testMethodCfg.IperlCheckErrorsToStop = tmpCfg.IperlCheckErrorsToStop;
|
||||
testMethodCfg.UseWebService = tmpCfg.UseWebService;
|
||||
testMethodCfg.BaseUrl = tmpCfg.BaseUrl;
|
||||
testMethodCfg.RelativeUrl = tmpCfg.RelativeUrl;
|
||||
_testMethodCfgIPerl.CommTimeout = tmpCfgIPerl.CommTimeout;
|
||||
_testMethodCfgIPerl.DelayBetweenRetries = tmpCfgIPerl.DelayBetweenRetries;
|
||||
_testMethodCfgIPerl.MaxCommRetries = tmpCfgIPerl.MaxCommRetries;
|
||||
_testMethodCfgIPerl.IperlCheckErrorsToStop = tmpCfgIPerl.IperlCheckErrorsToStop;
|
||||
_testMethodCfgIPerl.UseWebService = tmpCfgIPerl.UseWebService;
|
||||
_testMethodCfgIPerl.BaseUrl = tmpCfgIPerl.BaseUrl;
|
||||
_testMethodCfgIPerl.RelativeUrl = tmpCfgIPerl.RelativeUrl;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -60,7 +60,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
#endregion Configuration Change Handling
|
||||
|
||||
|
||||
readonly TestMethodCfg testMethodCfg;
|
||||
readonly TestMethodCfg_IPerl _testMethodCfgIPerl;
|
||||
|
||||
public bool[] IperlCommMilestone;
|
||||
IList<IOperation> sequenceConditionOps;
|
||||
@@ -73,7 +73,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
public TestMethod(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
testMethodCfg = cfg as TestMethodCfg;
|
||||
_testMethodCfgIPerl = cfg as TestMethodCfg_IPerl;
|
||||
CreateMilestonesAndConditions();
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
if (DebugLevel == DebugMode.Normal)
|
||||
{
|
||||
return (new iPerlCommunicationSeq()).Execute(test, repetNr, this, testMethodCfg.TestParams);
|
||||
return (new iPerlCommunicationSeq()).Execute(test, repetNr, this, _testMethodCfgIPerl.TestParams);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
using TBF.Rig.RegisterReaders.CommonRR.IPerl;
|
||||
|
||||
namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
@@ -14,13 +15,13 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
TestMethodCfg config;
|
||||
TestMethodCfg_IPerl config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as TestMethodCfg;
|
||||
config = value as TestMethodCfg_IPerl;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
@@ -203,29 +204,72 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
||||
}
|
||||
|
||||
flags |= UpdateDifferent(ref config.CommTimeout, commTimeoutTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.MaxCommRetries, maxCommRetriesTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.DelayBetweenRetries, delayBetweenRetriesTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.NrThreads, nrThreadsTextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.IperlCheckErrorsToStop, iperlCheckErrorsToStopTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
var CommTimeout = config.CommTimeout;;
|
||||
var MaxCommRetries = config.MaxCommRetries;
|
||||
var DelayBetweenRetries = config.DelayBetweenRetries;
|
||||
var NrThreads = config.NrThreads;
|
||||
var IperlCheckErrorsToStop = config.IperlCheckErrorsToStop;
|
||||
var DfltQ2c_15_rl = config.DfltQ2c_15_rl;
|
||||
var DfltQ2c_15_lr = config.DfltQ2c_15_lr;
|
||||
var DfltQ2c_20_rl = config.DfltQ2c_20_rl;
|
||||
var DfltQ2c_20_lr = config.DfltQ2c_20_lr;
|
||||
var DfltQ2c_25_63_rl = config.DfltQ2c_25_63_rl;
|
||||
var DfltQ2c_25_63_lr = config.DfltQ2c_25_63_lr;
|
||||
var DfltQ2c_25_10_rl = config.DfltQ2c_25_10_rl;
|
||||
var DfltQ2c_25_10_lr = config.DfltQ2c_25_10_lr;
|
||||
var DfltQ2c_32_rl = config.DfltQ2c_32_rl;
|
||||
var DfltQ2c_32_lr = config.DfltQ2c_32_lr;
|
||||
var DfltQ2c_40_rl = config.DfltQ2c_40_rl;
|
||||
var DfltQ2c_40_lr = config.DfltQ2c_40_lr;
|
||||
var UseWebService = config.UseWebService;
|
||||
var BaseUrl = config.BaseUrl;
|
||||
var RelativeUrl = config.RelativeUrl;
|
||||
|
||||
flags |= UpdateDifferent(ref config.DfltQ2c_15_rl, textBox15rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.DfltQ2c_15_lr, textBox15lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.DfltQ2c_20_rl, textBox20rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.DfltQ2c_20_lr, textBox20lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.DfltQ2c_25_63_rl, textBox25_63rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.DfltQ2c_25_63_lr, textBox25_63lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.DfltQ2c_25_10_rl, textBox25_10rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.DfltQ2c_25_10_lr, textBox25_10lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.DfltQ2c_32_rl, textBox32rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.DfltQ2c_32_lr, textBox32lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.DfltQ2c_40_rl, textBox40rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.DfltQ2c_40_lr, textBox40lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref CommTimeout, commTimeoutTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref MaxCommRetries, maxCommRetriesTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref DelayBetweenRetries, delayBetweenRetriesTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref NrThreads, nrThreadsTextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref IperlCheckErrorsToStop, iperlCheckErrorsToStopTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
|
||||
flags |= UpdateDifferent(ref config.UseWebService, useWebServiceCheckBox.Checked, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.BaseUrl, baseUrlTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref config.RelativeUrl, relativeUrlTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref DfltQ2c_15_rl, textBox15rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref DfltQ2c_15_lr, textBox15lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref DfltQ2c_20_rl, textBox20rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref DfltQ2c_20_lr, textBox20lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref DfltQ2c_25_63_rl, textBox25_63rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref DfltQ2c_25_63_lr, textBox25_63lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref DfltQ2c_25_10_rl, textBox25_10rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref DfltQ2c_25_10_lr, textBox25_10lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref DfltQ2c_32_rl, textBox32rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref DfltQ2c_32_lr, textBox32lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref DfltQ2c_40_rl, textBox40rl.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref DfltQ2c_40_lr, textBox40lr.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
|
||||
flags |= UpdateDifferent(ref UseWebService, useWebServiceCheckBox.Checked, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref BaseUrl, baseUrlTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
flags |= UpdateDifferent(ref RelativeUrl, relativeUrlTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
|
||||
|
||||
config.CommTimeout = CommTimeout;
|
||||
config.MaxCommRetries = MaxCommRetries;
|
||||
config.DelayBetweenRetries = DelayBetweenRetries;
|
||||
config.NrThreads = NrThreads;
|
||||
config.IperlCheckErrorsToStop = IperlCheckErrorsToStop;
|
||||
config.DfltQ2c_15_rl = DfltQ2c_15_rl;
|
||||
config.DfltQ2c_15_lr = DfltQ2c_15_lr;
|
||||
config.DfltQ2c_20_rl = DfltQ2c_20_rl;
|
||||
config.DfltQ2c_20_lr = DfltQ2c_20_lr;
|
||||
config.DfltQ2c_25_63_rl = DfltQ2c_25_63_rl;
|
||||
config.DfltQ2c_25_63_lr = DfltQ2c_25_63_lr;
|
||||
config.DfltQ2c_25_10_rl = DfltQ2c_25_10_rl;
|
||||
config.DfltQ2c_25_10_lr = DfltQ2c_25_10_lr;
|
||||
config.DfltQ2c_32_rl = DfltQ2c_32_rl;
|
||||
config.DfltQ2c_32_lr = DfltQ2c_32_lr;
|
||||
config.DfltQ2c_40_rl = DfltQ2c_40_rl;
|
||||
config.DfltQ2c_40_lr = DfltQ2c_40_lr;
|
||||
config.UseWebService = UseWebService;
|
||||
config.BaseUrl = BaseUrl;
|
||||
config.RelativeUrl = RelativeUrl;
|
||||
|
||||
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
|
||||
{
|
||||
TestMethod.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
|
||||
|
||||
+36
-44
@@ -8,56 +8,18 @@ using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Rig.RegisterReaders.CommonRR.IPerl;
|
||||
|
||||
namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
public class TestMethodCfg_IPerl : ComponentCfgBase, IiPerlTestMethodCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
|
||||
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(); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int CommTimeout; /// Communication timeout in ms (500 .. 5000)
|
||||
public int DelayBetweenRetries; /// Delay between communication retries in ms (0 .. 5000)
|
||||
public int MaxCommRetries; /// Max. number of retries (1 .. 10)
|
||||
public int WaitTimeAfterFailure; /// Wait time after communication failure in ms
|
||||
public int PassThroughWaitTime; /// Pass Through wait time for radio parameters in ms
|
||||
public int NrThreads; /// Numbwr of parallel threads (1, 2 or 4)
|
||||
public int IperlCheckErrorsToStop;
|
||||
|
||||
///
|
||||
/// NFC S4.5 Combihead params
|
||||
///
|
||||
public int MciTimeoutMs;
|
||||
public int BaudRate;
|
||||
public int DataBits;
|
||||
public Parity ParityBit;
|
||||
public StopBits StopBits;
|
||||
|
||||
public int DfltQ2c_15_rl;
|
||||
public int DfltQ2c_15_lr;
|
||||
public int DfltQ2c_20_rl;
|
||||
public int DfltQ2c_20_lr;
|
||||
public int DfltQ2c_25_63_rl;
|
||||
public int DfltQ2c_25_63_lr;
|
||||
public int DfltQ2c_25_10_rl;
|
||||
public int DfltQ2c_25_10_lr;
|
||||
public int DfltQ2c_32_rl;
|
||||
public int DfltQ2c_32_lr;
|
||||
public int DfltQ2c_40_rl;
|
||||
public int DfltQ2c_40_lr;
|
||||
|
||||
public bool UseWebService;
|
||||
public string BaseUrl;
|
||||
public string RelativeUrl;
|
||||
|
||||
/// <summary> Test parameters </summary>
|
||||
[XmlIgnore]
|
||||
public iPerlCommunicationParams TestParams;
|
||||
//
|
||||
public override IParamsProvider GetRuntimeTestParamsProvider() { return TestParams; }
|
||||
public override IParamsProvider CreateTestParamsProvider() { return new iPerlCommunicationParams(true); }
|
||||
public override IParamsProvider GetUITestParamsProvider(Test test)
|
||||
@@ -66,7 +28,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
}
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
TestMethodCfg()
|
||||
TestMethodCfg_IPerl()
|
||||
{
|
||||
Name = "iPerlCommunication";
|
||||
ParentName = string.Empty;
|
||||
@@ -85,7 +47,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
TestParams = CreateTestParamsProvider() as iPerlCommunicationParams;
|
||||
}
|
||||
|
||||
public TestMethodCfg(IComponentFactory factory)
|
||||
public TestMethodCfg_IPerl(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
@@ -95,5 +57,35 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
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; }
|
||||
public ITestParams TestParams { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -14,11 +14,11 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new TestMethod(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); }
|
||||
public IComponentCfg DefaultConfig() { return new TestMethodCfg_IPerl(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg_IPerl.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+51
-51
@@ -48,9 +48,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
}
|
||||
|
||||
|
||||
public partial class iPerlCommunicationForm : Form, GenericDevices.IHasCompleted
|
||||
public partial class iPerlCommunicationFormTestMethod : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(iPerlCommunicationForm));
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(iPerlCommunicationFormTestMethod));
|
||||
protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData");
|
||||
|
||||
const int Hz2CorrFactorsAddr = 0x1875; /// Used by Reset2HzCorrection(...) and Write2HzCorrection(...)
|
||||
@@ -112,21 +112,21 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
/// <returns>Value returned by readRequestPort(...)</returns>
|
||||
public static int ReadRequestPort(IperlHead iperlHead, MessageID messageID, StructName structName, int offset, int length, out byte[] buffer)
|
||||
{
|
||||
Thread.Sleep(Math.Max(250, cfg.DelayBetweenRetries));
|
||||
Thread.Sleep(Math.Max(250, CfgIPerl.DelayBetweenRetries));
|
||||
if (iperlHead.DebugLevel == DebugMode.FailureDuringOperation) iperlHead.DebugLevel = DebugMode.Normal;
|
||||
|
||||
if (iperlHead.DebugLevel != DebugMode.Normal) // Simulation
|
||||
{
|
||||
return SimulationServices.ReadRequest(cfg, iperlHead, messageID, offset, length, out buffer);
|
||||
return SimulationServices.ReadRequest(CfgIPerl, iperlHead, messageID, offset, length, out buffer);
|
||||
}
|
||||
|
||||
if (iperlHead.CommInterface == CommunicationInterface.NFC) // NFC Interface
|
||||
{
|
||||
return NfcServices.ReadRequest(cfg, iperlHead, structName, offset, length, out buffer);
|
||||
return NfcServices.ReadRequest(CfgIPerl, iperlHead, structName, offset, length, out buffer);
|
||||
}
|
||||
else // RFID Interface
|
||||
{
|
||||
return RfidServices.ReadRequest(cfg, iperlHead, messageID, offset, length, out buffer);
|
||||
return RfidServices.ReadRequest(CfgIPerl, iperlHead, messageID, offset, length, out buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,21 +137,21 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
/// <returns>Value returned by writeRequestPort(...)</returns>
|
||||
public static int WriteRequestPort(IperlHead iperlHead, MessageID messageID, StructName structName, int offset, int length, byte[] buffer)
|
||||
{
|
||||
Thread.Sleep(Math.Max(250, cfg.DelayBetweenRetries));
|
||||
Thread.Sleep(Math.Max(250, CfgIPerl.DelayBetweenRetries));
|
||||
if (iperlHead.DebugLevel == DebugMode.FailureDuringOperation) iperlHead.DebugLevel = DebugMode.Normal;
|
||||
|
||||
if (iperlHead.DebugLevel != DebugMode.Normal) // Simulation
|
||||
{
|
||||
return SimulationServices.WriteRequest(cfg, iperlHead, messageID, offset, length, buffer);
|
||||
return SimulationServices.WriteRequest(CfgIPerl, iperlHead, messageID, offset, length, buffer);
|
||||
}
|
||||
|
||||
if (iperlHead.CommInterface == CommunicationInterface.NFC) // NFC Interface
|
||||
{
|
||||
return NfcServices.WriteRequest(cfg, iperlHead, structName, offset, length, buffer);
|
||||
return NfcServices.WriteRequest(CfgIPerl, iperlHead, structName, offset, length, buffer);
|
||||
}
|
||||
else // RFID Interface
|
||||
{
|
||||
return RfidServices.WriteRequest(cfg, iperlHead, messageID, offset, length, buffer);
|
||||
return RfidServices.WriteRequest(CfgIPerl, iperlHead, messageID, offset, length, buffer);
|
||||
}
|
||||
}
|
||||
#endregion iPerl_Head_RFID_Interface: ReadRequestPort, WriteRequestPort
|
||||
@@ -192,7 +192,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
/// RFID multiplexer PCB / RFID serial port and worker thread related variables
|
||||
///
|
||||
static TestMethod testMethod;
|
||||
public static TestMethodCfg cfg;
|
||||
public static TestMethodCfg_IPerl CfgIPerl;
|
||||
static IList<Config.Entities.Test> tests;
|
||||
static IList<iPerlCommunicationParams> multiTestParams;
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
|
||||
|
||||
/// <summary> Parameterless constructor (without watermeters, threads) </summary>
|
||||
public iPerlCommunicationForm()
|
||||
public iPerlCommunicationFormTestMethod()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
@@ -217,10 +217,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
/// Constructor for checkBox states (active/inactive iPerl head) editing.
|
||||
/// </summary>
|
||||
/// <param name="checkBoxes">Initial check box states</param>
|
||||
public iPerlCommunicationForm(bool isCheckBoxesEditMode)
|
||||
public iPerlCommunicationFormTestMethod(bool isCheckBoxesEditMode)
|
||||
: this()
|
||||
{
|
||||
iPerlCommunicationForm.cfg = new TestMethodCfg(null); // default iPerl Head communication params
|
||||
iPerlCommunicationFormTestMethod.CfgIPerl = new TestMethodCfg_IPerl(null); // default iPerl Head communication params
|
||||
if (isCheckBoxesEditMode)
|
||||
{
|
||||
checkBoxesEditMode = true;
|
||||
@@ -252,7 +252,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
/// Constructor for one iPerlCommunication 'test'
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public iPerlCommunicationForm(TestMethod testMethod, Test test, iPerlCommunicationParams testParams)
|
||||
public iPerlCommunicationFormTestMethod(TestMethod testMethod, Test test, iPerlCommunicationParams testParams)
|
||||
: this(testMethod, new List<Test> { test }, new List<iPerlCommunicationParams> { testParams })
|
||||
{
|
||||
}
|
||||
@@ -261,15 +261,15 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
/// Constructor for multiple iPerlCommunication 'tests'
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public iPerlCommunicationForm(TestMethod testMethod, IList<Test> tests, IList<iPerlCommunicationParams> multiTestParams)
|
||||
public iPerlCommunicationFormTestMethod(TestMethod testMethod, IList<Test> tests, IList<iPerlCommunicationParams> multiTestParams)
|
||||
: this()
|
||||
{
|
||||
checkBoxesEditMode = false;
|
||||
|
||||
iPerlCommunicationForm.testMethod = testMethod;
|
||||
iPerlCommunicationForm.cfg = testMethod.Cfg as TestMethodCfg;
|
||||
iPerlCommunicationForm.tests = tests;
|
||||
iPerlCommunicationForm.multiTestParams = multiTestParams;
|
||||
iPerlCommunicationFormTestMethod.testMethod = testMethod;
|
||||
iPerlCommunicationFormTestMethod.CfgIPerl = testMethod.Cfg as TestMethodCfg_IPerl;
|
||||
iPerlCommunicationFormTestMethod.tests = tests;
|
||||
iPerlCommunicationFormTestMethod.multiTestParams = multiTestParams;
|
||||
|
||||
if (multiTestParams.Count > 0)
|
||||
{
|
||||
@@ -347,13 +347,13 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
|
||||
/// group numbers are >=1, lastGroup == 0 means there is no group
|
||||
lastGroup = 0;
|
||||
foreach (var iPerl in iPerlCommunicationForm.iperlHeads)
|
||||
foreach (var iPerl in iPerlCommunicationFormTestMethod.iperlHeads)
|
||||
{
|
||||
if (iPerl.Group > lastGroup) lastGroup = iPerl.Group;
|
||||
}
|
||||
|
||||
workerThreads = new List<Thread>();
|
||||
for (int i = 0; i < cfg.NrThreads; i++)
|
||||
for (int i = 0; i < CfgIPerl.NrThreads; i++)
|
||||
{
|
||||
Thread thread = new Thread(Worker);
|
||||
thread.CurrentCulture = CultureInfo.CurrentCulture;
|
||||
@@ -362,7 +362,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
}
|
||||
|
||||
muxBrdOrGroup14Nrs = new List<int>();
|
||||
foreach (var iPerl in iPerlCommunicationForm.iperlHeads)
|
||||
foreach (var iPerl in iPerlCommunicationFormTestMethod.iperlHeads)
|
||||
{
|
||||
if (!muxBrdOrGroup14Nrs.Contains(iPerl.MuxBoardNrOrGroup14)) muxBrdOrGroup14Nrs.Add(iPerl.MuxBoardNrOrGroup14);
|
||||
}
|
||||
@@ -671,7 +671,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
#if TURA_SPECIAL
|
||||
int threadIx = threadID; /// Just one thread for TURA_SPECIAL
|
||||
#else
|
||||
for (int threadIx = threadID; threadIx < threadID + 4; threadIx += cfg.NrThreads)
|
||||
for (int threadIx = threadID; threadIx < threadID + 4; threadIx += CfgIPerl.NrThreads)
|
||||
#endif
|
||||
{
|
||||
bool wmFound = false;
|
||||
@@ -924,7 +924,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
}
|
||||
|
||||
/// Delay min. 250 ms
|
||||
Thread.Sleep(Math.Max(250, cfg.DelayBetweenRetries));
|
||||
Thread.Sleep(Math.Max(250, CfgIPerl.DelayBetweenRetries));
|
||||
}
|
||||
|
||||
if (error == CommErr.None && (ihead.ConfigStruct.TestModeConfig != testModeConfig))
|
||||
@@ -939,7 +939,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
}
|
||||
|
||||
/// Delay min. 250 ms
|
||||
Thread.Sleep(Math.Max(250, cfg.DelayBetweenRetries));
|
||||
Thread.Sleep(Math.Max(250, CfgIPerl.DelayBetweenRetries));
|
||||
}
|
||||
|
||||
if (error == CommErr.None)
|
||||
@@ -953,7 +953,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
}
|
||||
|
||||
/// Delay min. 250 ms
|
||||
Thread.Sleep(Math.Max(250, cfg.DelayBetweenRetries));
|
||||
Thread.Sleep(Math.Max(250, CfgIPerl.DelayBetweenRetries));
|
||||
}
|
||||
|
||||
/// Now the meter should be in the Test mode ... verify
|
||||
@@ -1635,28 +1635,28 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
switch (ihead.MeterType)
|
||||
{
|
||||
case MeterType.DN15:
|
||||
q2corrRL = cfg.DfltQ2c_15_rl;
|
||||
q2corrLR = cfg.DfltQ2c_15_lr;
|
||||
q2corrRL = CfgIPerl.DfltQ2c_15_rl;
|
||||
q2corrLR = CfgIPerl.DfltQ2c_15_lr;
|
||||
break;
|
||||
case MeterType.DN20:
|
||||
q2corrRL = cfg.DfltQ2c_20_rl;
|
||||
q2corrLR = cfg.DfltQ2c_20_lr;
|
||||
q2corrRL = CfgIPerl.DfltQ2c_20_rl;
|
||||
q2corrLR = CfgIPerl.DfltQ2c_20_lr;
|
||||
break;
|
||||
case MeterType.DN25:
|
||||
q2corrRL = cfg.DfltQ2c_25_63_rl;
|
||||
q2corrLR = cfg.DfltQ2c_25_63_lr;
|
||||
q2corrRL = CfgIPerl.DfltQ2c_25_63_rl;
|
||||
q2corrLR = CfgIPerl.DfltQ2c_25_63_lr;
|
||||
break;
|
||||
case MeterType.DN25_Q3_10:
|
||||
q2corrRL = cfg.DfltQ2c_25_10_rl;
|
||||
q2corrLR = cfg.DfltQ2c_25_10_lr;
|
||||
q2corrRL = CfgIPerl.DfltQ2c_25_10_rl;
|
||||
q2corrLR = CfgIPerl.DfltQ2c_25_10_lr;
|
||||
break;
|
||||
case MeterType.DN32:
|
||||
q2corrRL = cfg.DfltQ2c_32_rl;
|
||||
q2corrLR = cfg.DfltQ2c_32_lr;
|
||||
q2corrRL = CfgIPerl.DfltQ2c_32_rl;
|
||||
q2corrLR = CfgIPerl.DfltQ2c_32_lr;
|
||||
break;
|
||||
case MeterType.DN40:
|
||||
q2corrRL = cfg.DfltQ2c_40_rl;
|
||||
q2corrLR = cfg.DfltQ2c_40_lr;
|
||||
q2corrRL = CfgIPerl.DfltQ2c_40_rl;
|
||||
q2corrLR = CfgIPerl.DfltQ2c_40_lr;
|
||||
break;
|
||||
default:
|
||||
q2corrRL = 0;
|
||||
@@ -1739,28 +1739,28 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
switch (ihead.MeterType)
|
||||
{
|
||||
case MeterType.DN15:
|
||||
q2corrRL = cfg.DfltQ2c_15_rl;
|
||||
q2corrLR = cfg.DfltQ2c_15_lr;
|
||||
q2corrRL = CfgIPerl.DfltQ2c_15_rl;
|
||||
q2corrLR = CfgIPerl.DfltQ2c_15_lr;
|
||||
break;
|
||||
case MeterType.DN20:
|
||||
q2corrRL = cfg.DfltQ2c_20_rl;
|
||||
q2corrLR = cfg.DfltQ2c_20_lr;
|
||||
q2corrRL = CfgIPerl.DfltQ2c_20_rl;
|
||||
q2corrLR = CfgIPerl.DfltQ2c_20_lr;
|
||||
break;
|
||||
case MeterType.DN25:
|
||||
q2corrRL = cfg.DfltQ2c_25_63_rl;
|
||||
q2corrLR = cfg.DfltQ2c_25_63_lr;
|
||||
q2corrRL = CfgIPerl.DfltQ2c_25_63_rl;
|
||||
q2corrLR = CfgIPerl.DfltQ2c_25_63_lr;
|
||||
break;
|
||||
case MeterType.DN25_Q3_10:
|
||||
q2corrRL = cfg.DfltQ2c_25_10_rl;
|
||||
q2corrLR = cfg.DfltQ2c_25_10_lr;
|
||||
q2corrRL = CfgIPerl.DfltQ2c_25_10_rl;
|
||||
q2corrLR = CfgIPerl.DfltQ2c_25_10_lr;
|
||||
break;
|
||||
case MeterType.DN32:
|
||||
q2corrRL = cfg.DfltQ2c_32_rl;
|
||||
q2corrLR = cfg.DfltQ2c_32_lr;
|
||||
q2corrRL = CfgIPerl.DfltQ2c_32_rl;
|
||||
q2corrLR = CfgIPerl.DfltQ2c_32_lr;
|
||||
break;
|
||||
case MeterType.DN40:
|
||||
q2corrRL = cfg.DfltQ2c_40_rl;
|
||||
q2corrLR = cfg.DfltQ2c_40_lr;
|
||||
q2corrRL = CfgIPerl.DfltQ2c_40_rl;
|
||||
q2corrLR = CfgIPerl.DfltQ2c_40_lr;
|
||||
break;
|
||||
default:
|
||||
q2corrRL = 0;
|
||||
+3
-3
@@ -4,7 +4,7 @@
|
||||
///
|
||||
namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
partial class iPerlCommunicationForm
|
||||
partial class iPerlCommunicationFormTestMethod
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -32,7 +32,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(iPerlCommunicationForm));
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(iPerlCommunicationFormTestMethod));
|
||||
this.wmTextBox2 = new System.Windows.Forms.TextBox();
|
||||
this.wmLabel2 = new System.Windows.Forms.Label();
|
||||
this.wmLabel1 = new System.Windows.Forms.Label();
|
||||
@@ -2585,7 +2585,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "iPerlCommunicationForm";
|
||||
this.Name = "iPerlCommunicationFormTestMethod";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.Text = "iPerl Communication";
|
||||
this.TopMost = true;
|
||||
@@ -10,17 +10,19 @@ using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Uni.SharedDialogs.SmartMetersCommunication;
|
||||
|
||||
namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
public class iPerlCommunicationParams : TestParamsBase, IParamsProvider, ITestParams
|
||||
public class iPerlCommunicationParams : TestParamsBase, ITestParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(iPerlCommunicationParams) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public string Activity; /// Communication activity
|
||||
public bool SimultWithPrevious;
|
||||
public bool SimultWithNext;
|
||||
|
||||
public string Activity { get; set; } /// Communication activity
|
||||
public bool SimultWithPrevious { get; set; }
|
||||
public bool SimultWithNext { get; set; }
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
@@ -44,54 +46,54 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
if (i == 0)
|
||||
{
|
||||
var retVal = new List<string>();
|
||||
retVal.Add(iPerlCommunicationForm.ReadConfigurationStr);
|
||||
retVal.Add(string.Format("{0} A0", iPerlCommunicationForm.SetTestModeStr));
|
||||
retVal.Add(string.Format("{0} A4", iPerlCommunicationForm.SetTestModeStr));
|
||||
retVal.Add(iPerlCommunicationForm.ReadCalibrationStr);
|
||||
retVal.Add(iPerlCommunicationForm.ReadCalibrationV4Str);
|
||||
retVal.Add(iPerlCommunicationForm.NormalizeCalibrationFactorStr);
|
||||
retVal.Add(iPerlCommunicationForm.NormalizeCalibrationV4FactorsStr);
|
||||
retVal.Add(iPerlCommunicationForm.GetDefaultQ2CorrectionsStr);
|
||||
retVal.Add(iPerlCommunicationForm.ReadQ2CorrectionStr);
|
||||
retVal.Add(iPerlCommunicationForm.ResetQ2CorrectionStr);
|
||||
retVal.Add(iPerlCommunicationForm.WriteDefaultQ2CorrectionsStr);
|
||||
retVal.Add(iPerlCommunicationForm.InitOrReadQ2CorrectionsStr);
|
||||
retVal.Add(iPerlCommunicationForm.WriteCalibrationFactorStr);
|
||||
retVal.Add(iPerlCommunicationForm.WriteCalibrationV4FactorsStr);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionStr);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionAltStr);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionGreeceStr);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionRLStr);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionLRStr);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionIncl05Str);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionAltIncl05Str);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionPlusIncl05Str);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionPlusAltIncl05Str);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionGreeceIncl05Str);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionRLIncl05Str);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionLRIncl05Str);
|
||||
retVal.Add(iPerlCommunicationSeq.Q2correctedFromCmd + "Qx");
|
||||
retVal.Add(iPerlCommunicationSeq.StrictQ2ErrorCheckStr + "Qx");
|
||||
retVal.Add(iPerlCommunicationSeq.Q2correctionCheckCmd);
|
||||
retVal.Add(iPerlCommunicationSeq.IperlCheckCmd);
|
||||
retVal.Add(iPerlCommunicationForm.UpdateBothQ2FactorsTestRLOnlyStr);
|
||||
retVal.Add(iPerlCommunicationForm.UpdateBothQ2FactorsTestLROnlyStr);
|
||||
retVal.Add(iPerlCommunicationForm.UpdateQ2CorrectionsStr);
|
||||
retVal.Add(iPerlCommunicationForm.ConditnlUpdateQ2CorrectionsStr);
|
||||
retVal.Add(iPerlCommunicationForm.ConditnlUpdateQ2CorrRLStr);
|
||||
retVal.Add(iPerlCommunicationForm.ConditnlUpdateQ2CorrLRStr);
|
||||
retVal.Add(iPerlCommunicationConstants.ReadConfigurationStr);
|
||||
retVal.Add(string.Format("{0} A0", iPerlCommunicationConstants.SetTestModeStr));
|
||||
retVal.Add(string.Format("{0} A4", iPerlCommunicationConstants.SetTestModeStr));
|
||||
retVal.Add(iPerlCommunicationConstants.ReadCalibrationStr);
|
||||
retVal.Add(iPerlCommunicationConstants.ReadCalibrationV4Str);
|
||||
retVal.Add(iPerlCommunicationConstants.NormalizeCalibrationFactorStr);
|
||||
retVal.Add(iPerlCommunicationConstants.NormalizeCalibrationV4FactorsStr);
|
||||
retVal.Add(iPerlCommunicationConstants.GetDefaultQ2CorrectionsStr);
|
||||
retVal.Add(iPerlCommunicationConstants.ReadQ2CorrectionStr);
|
||||
retVal.Add(iPerlCommunicationConstants.ResetQ2CorrectionStr);
|
||||
retVal.Add(iPerlCommunicationConstants.WriteDefaultQ2CorrectionsStr);
|
||||
retVal.Add(iPerlCommunicationConstants.InitOrReadQ2CorrectionsStr);
|
||||
retVal.Add(iPerlCommunicationConstants.WriteCalibrationFactorStr);
|
||||
retVal.Add(iPerlCommunicationConstants.WriteCalibrationV4FactorsStr);
|
||||
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionStr);
|
||||
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionAltStr);
|
||||
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionGreeceStr);
|
||||
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionRLStr);
|
||||
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionLRStr);
|
||||
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionIncl05Str);
|
||||
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionAltIncl05Str);
|
||||
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionPlusIncl05Str);
|
||||
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionPlusAltIncl05Str);
|
||||
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionGreeceIncl05Str);
|
||||
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionRLIncl05Str);
|
||||
retVal.Add(iPerlCommunicationConstants.WriteQ2CorrectionLRIncl05Str);
|
||||
retVal.Add(iPerlCommunicationConstants.Q2correctedFromCmd + "Qx");
|
||||
retVal.Add(iPerlCommunicationConstants.StrictQ2ErrorCheckStr + "Qx");
|
||||
retVal.Add(iPerlCommunicationConstants.Q2correctionCheckCmd);
|
||||
retVal.Add(iPerlCommunicationConstants.IperlCheckCmd);
|
||||
retVal.Add(iPerlCommunicationConstants.UpdateBothQ2FactorsTestRLOnlyStr);
|
||||
retVal.Add(iPerlCommunicationConstants.UpdateBothQ2FactorsTestLROnlyStr);
|
||||
retVal.Add(iPerlCommunicationConstants.UpdateQ2CorrectionsStr);
|
||||
retVal.Add(iPerlCommunicationConstants.ConditnlUpdateQ2CorrectionsStr);
|
||||
retVal.Add(iPerlCommunicationConstants.ConditnlUpdateQ2CorrRLStr);
|
||||
retVal.Add(iPerlCommunicationConstants.ConditnlUpdateQ2CorrLRStr);
|
||||
retVal.Add("Q2 corrected from Q2adj");
|
||||
retVal.Add("Q2 correction check Q2bc Q2ac");
|
||||
retVal.Add(iPerlCommunicationForm.SetActiveModeStr);
|
||||
retVal.Add(iPerlCommunicationConstants.SetActiveModeStr);
|
||||
retVal.Add("---");
|
||||
retVal.Add(iPerlCommunicationForm.Reset2HzCorrectionStr);
|
||||
retVal.Add(iPerlCommunicationForm.Write2HzCorrectionStr);
|
||||
retVal.Add(iPerlCommunicationForm.DewaReworkRLStr);
|
||||
retVal.Add(iPerlCommunicationForm.DewaReworkLRStr);
|
||||
retVal.Add(iPerlCommunicationForm.StartTestingSealedMetersStr);
|
||||
retVal.Add(iPerlCommunicationForm.EndTestingSealedMetersStr);
|
||||
retVal.Add(string.Format("{0} if enabled", iPerlCommunicationForm.ReadConfigurationStr));
|
||||
retVal.Add(string.Format("{0} 80", iPerlCommunicationForm.SetTestModeStr));
|
||||
retVal.Add(iPerlCommunicationConstants.Reset2HzCorrectionStr);
|
||||
retVal.Add(iPerlCommunicationConstants.Write2HzCorrectionStr);
|
||||
retVal.Add(iPerlCommunicationConstants.DewaReworkRLStr);
|
||||
retVal.Add(iPerlCommunicationConstants.DewaReworkLRStr);
|
||||
retVal.Add(iPerlCommunicationConstants.StartTestingSealedMetersStr);
|
||||
retVal.Add(iPerlCommunicationConstants.EndTestingSealedMetersStr);
|
||||
retVal.Add(string.Format("{0} if enabled", iPerlCommunicationConstants.ReadConfigurationStr));
|
||||
retVal.Add(string.Format("{0} 80", iPerlCommunicationConstants.SetTestModeStr));
|
||||
retVal.Add("iPerl_check prevWorkStep direction q2factors");
|
||||
for (ConditionID id = ConditionID.A; id < ConditionID.Count; id++)
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ using TBF.Resources;
|
||||
using TBF.UiBridge;
|
||||
using Results;
|
||||
using Results.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
|
||||
|
||||
namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
@@ -34,7 +35,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
///
|
||||
void OpenIPerlCommForm(iPerlCommunicationSeq myRef, TestMethod method, Test test, iPerlCommunicationParams testParams)
|
||||
{
|
||||
myRef.modelessDlg = new iPerlCommunicationForm(method, test, testParams);
|
||||
myRef.modelessDlg = new iPerlCommunicationFormTestMethod(method, test, testParams);
|
||||
myRef.modelessDlg.Show();
|
||||
}
|
||||
|
||||
@@ -56,9 +57,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
/// Event.OpArgumentError . Target flow is out of range
|
||||
/// Event.Error . . . . . . Unspecified error
|
||||
/// </returns>
|
||||
public IList<Event> Execute(Test test, int repetitionNr, TestMethod method, iPerlCommunicationParams testParams)
|
||||
public IList<Event> Execute(Test test, int repetitionNr, TestMethod method, ITestParams testParams)
|
||||
{
|
||||
TestMethodCfg cfg = method.Cfg as TestMethodCfg;
|
||||
TestMethodCfg_IPerl cfgIPerl = method.Cfg as TestMethodCfg_IPerl;
|
||||
|
||||
IList<Event> e; /// Events from currently running operations
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
@@ -67,7 +68,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
string cmd;
|
||||
if (testParams.Activity.ToLower().Equals(cmd = iPerlCommunicationForm.GetDefaultQ2CorrectionsStr.ToLower()))
|
||||
if (testParams.Activity.ToLower().Equals(cmd = iPerlCommunicationFormTestMethod.GetDefaultQ2CorrectionsStr.ToLower()))
|
||||
{
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.JustStarted));
|
||||
@@ -86,9 +87,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
}*/
|
||||
#endif
|
||||
|
||||
if (cfg.UseWebService)
|
||||
if (cfgIPerl.UseWebService)
|
||||
{
|
||||
IsQ2PreCorrectionCalculated = GetQ2PreCorrectionsOrBackups(cfg, wmType, out CalculatedQ2PreCorrectionLR, out CalculatedQ2PreCorrectionRL);
|
||||
IsQ2PreCorrectionCalculated = GetQ2PreCorrectionsOrBackups(cfgIPerl, wmType, out CalculatedQ2PreCorrectionLR, out CalculatedQ2PreCorrectionRL);
|
||||
}
|
||||
|
||||
/// Generate test results
|
||||
@@ -105,7 +106,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
if (mtr.TestRslt == tstRslt)
|
||||
{
|
||||
mtr.Passed = !cfg.UseWebService || IsQ2PreCorrectionCalculated;
|
||||
mtr.Passed = !cfgIPerl.UseWebService || IsQ2PreCorrectionCalculated;
|
||||
mtr.TestDone = true;
|
||||
break;
|
||||
}
|
||||
@@ -270,7 +271,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, tstRslt));
|
||||
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
|
||||
|
||||
if (wrongMetersCount >= cfg.IperlCheckErrorsToStop)
|
||||
if (wrongMetersCount >= cfgIPerl.IperlCheckErrorsToStop)
|
||||
{
|
||||
State.Create("iPerlCommunicationSeq : Show check result")
|
||||
.AddOperation(new Operations.LargeMessageBoxOp(message))
|
||||
@@ -408,12 +409,12 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
/// <summary>
|
||||
/// Read default Q2 correction factors from a REST service (= Web service).
|
||||
/// </summary>
|
||||
/// <param name="cfg">iPerlCommunication component configuration</param>
|
||||
/// <param name="cfgIPerl">iPerlCommunication component configuration</param>
|
||||
/// <param name="wmType">Water meter type (WZ Typ)</param>
|
||||
/// <param name="q2PreCorrectionLR">Default Q2 correction LR</param>
|
||||
/// <param name="q2PreCorrectionRL">Default Q2 correction RL</param>
|
||||
/// <returns>true when successful</returns>
|
||||
static bool ReadCorrectionsFromWebService(TestMethodCfg cfg, int wmType, out int q2PreCorrectionLR, out int q2PreCorrectionRL)
|
||||
static bool ReadCorrectionsFromWebService(TestMethodCfg_IPerl cfgIPerl, int wmType, out int q2PreCorrectionLR, out int q2PreCorrectionRL)
|
||||
{
|
||||
if (wmType == 0)
|
||||
{
|
||||
@@ -425,9 +426,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
|
||||
try
|
||||
{
|
||||
GetQ2PreCorrectionClient client = new GetQ2PreCorrectionClient(cfg.BaseUrl);
|
||||
GetQ2PreCorrectionClient client = new GetQ2PreCorrectionClient(cfgIPerl.BaseUrl);
|
||||
client.GetToken("ReadUser", "sensus", "https://deluh1web03.world.fluidtechnology.net/SensusCore/api/v1/Locations/1/Login2").Wait();
|
||||
Q2PreCorrection response = client.GetQ2Correction(string.Format(cfg.RelativeUrl, wmType)).Result;
|
||||
Q2PreCorrection response = client.GetQ2Correction(string.Format(cfgIPerl.RelativeUrl, wmType)).Result;
|
||||
if (response != null && response.AreDataCalculated)
|
||||
{
|
||||
q2PreCorrectionLR = response.CorrLR;
|
||||
@@ -455,15 +456,15 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
/// <summary>
|
||||
/// Obtain Q2 correction factors from a REST service or from local settings (stored backup values)
|
||||
/// </summary>
|
||||
/// <param name="cfg">iPerlCommunication component configuration</param>
|
||||
/// <param name="cfgIPerl">iPerlCommunication component configuration</param>
|
||||
/// <param name="wmType">Water meter type (WZ Typ)</param>
|
||||
/// <param name="q2PreCorrectionLR">Default Q2 correction LR</param>
|
||||
/// <param name="q2PreCorrectionRL">Default Q2 correction RL</param>
|
||||
/// <returns>true when successful</returns>
|
||||
public static bool GetQ2PreCorrectionsOrBackups(TestMethodCfg cfg, int wmType, out int q2PreCorrectionLR, out int q2PreCorrectionRL)
|
||||
public static bool GetQ2PreCorrectionsOrBackups(TestMethodCfg_IPerl cfgIPerl, int wmType, out int q2PreCorrectionLR, out int q2PreCorrectionRL)
|
||||
{
|
||||
/// Get Q2 pre-correction values from REST service
|
||||
bool restOK = ReadCorrectionsFromWebService(cfg, wmType, out q2PreCorrectionLR, out q2PreCorrectionRL);
|
||||
bool restOK = ReadCorrectionsFromWebService(cfgIPerl, wmType, out q2PreCorrectionLR, out q2PreCorrectionRL);
|
||||
|
||||
/// Store / load Q2 pre-correction values
|
||||
Point storedValue;
|
||||
|
||||
@@ -17,13 +17,14 @@ using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq; // This line is correct and does not need to be changed.
|
||||
using System.Windows;
|
||||
using TBF.Rig.Uni.SharedDialogs.SmartMetersCommunication.common;
|
||||
|
||||
namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
{
|
||||
/// <summary>
|
||||
/// This component = instance of this class is a placeholder for a combined main watermeter
|
||||
/// </summary>
|
||||
public class IperlHead : ComponentBase, IDevice,IRegReaderDatastream, ISessionDataMngmnt, IOperation
|
||||
public class IperlHead : ComponentBase, IDevice,IRegReaderDatastream, ISessionDataMngmnt, IOperation, IntIPerlReader
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(IperlHead));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
@@ -42,7 +43,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
|
||||
readonly IperlHeadCfg iperlHeadCfg;
|
||||
|
||||
RegisterReaders.CommonRR.CommunicationInterface IntIPerlReader.CommInterface => _commInterface;
|
||||
|
||||
public int RfidComPortNr { get { return iperlHeadCfg.RfidComPortNr; } }
|
||||
public bool CommFailed { get; set; }
|
||||
public int OptoComPortNr { get { return iperlHeadCfg.OptoComPortNr; } }
|
||||
public int MuxBoardNrOrGroup14 { get { return iperlHeadCfg.MuxBoardNr; } }
|
||||
public int Group { get { return iperlHeadCfg.Group; } }
|
||||
@@ -87,7 +91,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
}
|
||||
|
||||
public bool Disabled;
|
||||
public bool CommFailed;
|
||||
public int ResultCode;
|
||||
|
||||
|
||||
@@ -930,6 +933,11 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
dataStreamState = DataStreamState.ProcessAndSave;
|
||||
}
|
||||
|
||||
public void SetCommunicationInterface(RegisterReaders.CommonRR.CommunicationInterface commInterface)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when processing and saving datastream data is in progress
|
||||
/// </summary>
|
||||
@@ -938,6 +946,11 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
return dataStreamState == DataStreamState.ProcessAndSave;
|
||||
}
|
||||
|
||||
void IntIPerlReader.SetRfidInterface()
|
||||
{
|
||||
SetRfidInterface();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop processing and saving datastream data
|
||||
/// </summary>
|
||||
@@ -953,8 +966,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
bool synchronized;
|
||||
bool synchronized2;
|
||||
string partOfTelegram;
|
||||
private RegisterReaders.CommonRR.CommunicationInterface _commInterface;
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Reads opto-datastream via serial port. Invoked from RunDeviceBefore()
|
||||
///
|
||||
/// Telegram description:
|
||||
@@ -1063,6 +1077,11 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
}
|
||||
}
|
||||
|
||||
void IntIPerlReader.ResetNfcInterface(bool? nfc_on)
|
||||
{
|
||||
ResetNfcInterface(nfc_on);
|
||||
}
|
||||
|
||||
public string ReadOptoData()
|
||||
{
|
||||
if (optoSerialPort is null) return "";
|
||||
@@ -1080,6 +1099,11 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
return received;
|
||||
}
|
||||
|
||||
void IntIPerlReader.SetNfcInterface()
|
||||
{
|
||||
SetNfcInterface();
|
||||
}
|
||||
|
||||
|
||||
void OptoTelegramReceived(int currentIx, bool async, Int64 volumeRawExt, Int64 timestampRawExt)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Threading;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Windows.Forms;
|
||||
using TBF.Rig.Sequences;
|
||||
using TBF.Rig.Uni.SharedDialogs.SmartMetersCommunication;
|
||||
|
||||
namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
{
|
||||
@@ -21,7 +22,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
InitializeComponent();
|
||||
if (config == null) return;
|
||||
|
||||
iPerlCommunicationForm.cfg = new TestMethodCfg(null); // default values for iPerlCommunication
|
||||
SmartCommunicationForm.TestMethodCfg = new TestMethodCfg_IPerl(null); // default values for iPerlCommunication
|
||||
|
||||
foreach(var head in ProcessData.IperlHeads)
|
||||
{
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
internal class NfcServices
|
||||
{
|
||||
protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData");
|
||||
internal static int ReadRequest(TestMethodCfg cfg, IperlHead iperlHead, MCI_Protocol.StructName structName, int offset, int length, out byte[] buffer)
|
||||
internal static int ReadRequest(TestMethodCfg_IPerl cfgIPerl, IperlHead iperlHead, MCI_Protocol.StructName structName, int offset, int length, out byte[] buffer)
|
||||
{
|
||||
for (int i = 0; i < cfg.MaxCommRetries; i++)
|
||||
for (int i = 0; i < cfgIPerl.MaxCommRetries; i++)
|
||||
{
|
||||
|
||||
NfcDataHandler _nfcDataHandler = new NfcDataHandler();
|
||||
@@ -26,9 +26,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
try
|
||||
{
|
||||
rfidDataLogger.Info($"NFC COM{iperlHead.RfidComPortNr} ReadRequest : {structName}, {offset}, {length}");
|
||||
OpenConnection(_nfcDataHandler, cfg, iperlHead);
|
||||
OpenConnection(_nfcDataHandler, cfgIPerl, iperlHead);
|
||||
|
||||
buffer = MciRead(_nfcDataHandler, cfg, structName, (ushort)offset, length);
|
||||
buffer = MciRead(_nfcDataHandler, cfgIPerl, structName, (ushort)offset, length);
|
||||
_nfcDataHandler.RFProtocolOFF(); // turn off rf antenna due to possible interference
|
||||
|
||||
CloseComPort(_nfcDataHandler);
|
||||
@@ -44,7 +44,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
}
|
||||
catch (RfidValidationException)
|
||||
{
|
||||
Thread.Sleep(cfg.WaitTimeAfterFailure);
|
||||
Thread.Sleep(cfgIPerl.WaitTimeAfterFailure);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -57,7 +57,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
return 3;
|
||||
}
|
||||
|
||||
internal static int WriteRequest(TestMethodCfg cfg, IperlHead iperlHead, MCI_Protocol.StructName structName, int offset, int length, byte[] buffer)
|
||||
internal static int WriteRequest(TestMethodCfg_IPerl cfgIPerl, IperlHead iperlHead, MCI_Protocol.StructName structName, int offset, int length, byte[] buffer)
|
||||
{
|
||||
NfcDataHandler _nfcDataHandler = new NfcDataHandler();
|
||||
MessageEventHandlers(_nfcDataHandler);
|
||||
@@ -68,9 +68,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
try
|
||||
{
|
||||
rfidDataLogger.Info($"NFC COM{iperlHead.RfidComPortNr} WriteRequest : {structName}, {offset}, {length}, {ByteArrayToHexString(buffer)}");
|
||||
OpenConnection(_nfcDataHandler, cfg, iperlHead);
|
||||
OpenConnection(_nfcDataHandler, cfgIPerl, iperlHead);
|
||||
|
||||
MciWrite(_nfcDataHandler, cfg, structName, (ushort)offset, length, buffer);
|
||||
MciWrite(_nfcDataHandler, cfgIPerl, structName, (ushort)offset, length, buffer);
|
||||
_nfcDataHandler.RFProtocolOFF(); // turn off rf antenna due to possible interference
|
||||
|
||||
CloseComPort(_nfcDataHandler);
|
||||
@@ -83,14 +83,14 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
}
|
||||
}
|
||||
|
||||
private static void OpenConnection(NfcDataHandler nfcDataHandler, TestMethodCfg cfg, IperlHead iperlHead)
|
||||
private static void OpenConnection(NfcDataHandler nfcDataHandler, TestMethodCfg_IPerl cfgIPerl, IperlHead iperlHead)
|
||||
{
|
||||
string comPort = $"COM{iperlHead.RfidComPortNr}";
|
||||
int retryCount = 0 ;
|
||||
Open:
|
||||
nfcDataHandler.Close();
|
||||
Thread.Sleep(100);
|
||||
if (nfcDataHandler.OpenConnection(comPort, cfg.BaudRate, cfg.DataBits, cfg.ParityBit, cfg.StopBits))
|
||||
if (nfcDataHandler.OpenConnection(comPort, cfgIPerl.BaudRate, cfgIPerl.DataBits, cfgIPerl.ParityBit, cfgIPerl.StopBits))
|
||||
{
|
||||
rfidDataLogger.Info($"NFC COM{iperlHead.RfidComPortNr} Port Open");
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
if (!nfcDataHandler.ConnectDevice())
|
||||
{
|
||||
rfidDataLogger.Error($"NFC COM{iperlHead.RfidComPortNr} Error connect device.");
|
||||
for (int i = 0; i < cfg.MaxCommRetries; i++)
|
||||
for (int i = 0; i < cfgIPerl.MaxCommRetries; i++)
|
||||
{
|
||||
if (nfcDataHandler.Echo()) break;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
{
|
||||
retryCount++;
|
||||
rfidDataLogger.Error($"NFC COM{iperlHead.RfidComPortNr} Error connect reader. Reconnect comport {retryCount}");
|
||||
if (retryCount < cfg.MaxCommRetries)
|
||||
if (retryCount < cfgIPerl.MaxCommRetries)
|
||||
{
|
||||
nfcDataHandler.Close();
|
||||
iperlHead.ResetNfcInterface(); // reset NFC head via optoport - switch to RFID and back to NFC interface
|
||||
@@ -127,7 +127,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
nfcDataHandler.Close();
|
||||
}
|
||||
|
||||
private static byte[] MciRead(NfcDataHandler nfcDataHandler, TestMethodCfg cfg, StructName structName, ushort offset, int length)
|
||||
private static byte[] MciRead(NfcDataHandler nfcDataHandler, TestMethodCfg_IPerl cfgIPerl, StructName structName, ushort offset, int length)
|
||||
{
|
||||
bool isReadValues = false;
|
||||
int retryCount = 0;
|
||||
@@ -153,14 +153,14 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
{
|
||||
rfidDataLogger.Info($"MCI Error: Unidentified");
|
||||
retryCount++;
|
||||
if (retryCount < cfg.MaxCommRetries)
|
||||
if (retryCount < cfgIPerl.MaxCommRetries)
|
||||
goto Read;
|
||||
}
|
||||
else
|
||||
{
|
||||
rfidDataLogger.Info("Last error message: " + nfcDataHandler.LastErrorMessage);
|
||||
retryCount++;
|
||||
if (retryCount < cfg.MaxCommRetries)
|
||||
if (retryCount < cfgIPerl.MaxCommRetries)
|
||||
goto Read;
|
||||
}
|
||||
}
|
||||
@@ -168,13 +168,13 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
{
|
||||
rfidDataLogger.Error("MciRead Last error message: " + ex.Message);
|
||||
retryCount++;
|
||||
if (retryCount < cfg.MaxCommRetries)
|
||||
if (retryCount < cfgIPerl.MaxCommRetries)
|
||||
goto Read;
|
||||
}
|
||||
return new byte[length];
|
||||
}
|
||||
|
||||
private static void MciWrite(NfcDataHandler nfcDataHandler, TestMethodCfg cfg, MCI_Protocol.StructName structName, ushort offset, int length, byte[] payload)
|
||||
private static void MciWrite(NfcDataHandler nfcDataHandler, TestMethodCfg_IPerl cfgIPerl, MCI_Protocol.StructName structName, ushort offset, int length, byte[] payload)
|
||||
{
|
||||
int retryCount = 0;
|
||||
Write:
|
||||
@@ -199,7 +199,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
{
|
||||
rfidDataLogger.Error("MciWrite error message: " + ex.Message);
|
||||
retryCount++;
|
||||
if (retryCount < cfg.MaxCommRetries)
|
||||
if (retryCount < cfgIPerl.MaxCommRetries)
|
||||
goto Write;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,24 +5,25 @@ using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using TBF.Rig.Uni.SharedDialogs.SmartMetersCommunication;
|
||||
|
||||
namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
{
|
||||
internal class RfidServices
|
||||
{
|
||||
protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData");
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(iPerlCommunicationForm));
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(SmartCommunicationForm));
|
||||
|
||||
internal static int ReadRequest(TestMethodCfg cfg, IperlHead iperlHead, MessageID messageID, int offset, int length, out byte[] buffer)
|
||||
internal static int ReadRequest(TestMethodCfg_IPerl cfgIPerl, IperlHead iperlHead, MessageID messageID, int offset, int length, out byte[] buffer)
|
||||
{
|
||||
for (int i = 0; i < cfg.MaxCommRetries; i++)
|
||||
for (int i = 0; i < cfgIPerl.MaxCommRetries; i++)
|
||||
{
|
||||
rfidDataLogger.Error($"{iperlHead.CommInterface} Start {i} reading: COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},{offset}, {length}... timeout {cfg.CommTimeout})");
|
||||
rfidDataLogger.Error($"{iperlHead.CommInterface} Start {i} reading: COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},{offset}, {length}... timeout {cfgIPerl.CommTimeout})");
|
||||
using (RfidLogic writer = new RfidLogic($"COM{iperlHead.RfidComPortNr}"))
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] response = writer.ReadRequest((byte)messageID, offset, length, cfg.CommTimeout);
|
||||
byte[] response = writer.ReadRequest((byte)messageID, offset, length, cfgIPerl.CommTimeout);
|
||||
string hexString = RfidHelper.ConvertByteArrayToHexString(response);
|
||||
string swapHexString = RfidHelper.SwapHexcode(hexString);
|
||||
string decString = RfidHelper.HexLiteral2Unsigned(RfidHelper.SwapHexcode(hexString)).ToString();
|
||||
@@ -56,42 +57,42 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
if (/*RfidHelper.IsPassThrough(messageID)*/ messageID == MessageID.ASICRegisterReadTest || messageID == MessageID.RadioPassthrough)
|
||||
{
|
||||
rfidDataLogger.Info($"COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...) {(i > 0 ? "<- Error: Invalid Pass-Through data." : "<- Info: Wait for Pass-Through data.")}");
|
||||
Thread.Sleep(cfg.PassThroughWaitTime);
|
||||
Thread.Sleep(cfgIPerl.PassThroughWaitTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
Thread.Sleep(cfg.WaitTimeAfterFailure);
|
||||
Thread.Sleep(cfgIPerl.WaitTimeAfterFailure);
|
||||
}
|
||||
}
|
||||
catch (RfidValidationException)
|
||||
{
|
||||
Thread.Sleep(cfg.WaitTimeAfterFailure);
|
||||
Thread.Sleep(cfgIPerl.WaitTimeAfterFailure);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...) {ex.Message}");
|
||||
Thread.Sleep(cfg.WaitTimeAfterFailure);
|
||||
Thread.Sleep(cfgIPerl.WaitTimeAfterFailure);
|
||||
}
|
||||
}
|
||||
}
|
||||
rfidDataLogger.Error($"{iperlHead.CommInterface} reading failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...)");
|
||||
log.Error($"{iperlHead.CommInterface} reading failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...)");
|
||||
rfidDataLogger.Error($"{iperlHead.CommInterface} reading failed after {cfgIPerl.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...)");
|
||||
log.Error($"{iperlHead.CommInterface} reading failed after {cfgIPerl.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...)");
|
||||
buffer = new byte[length];
|
||||
return 3;
|
||||
}
|
||||
|
||||
internal static int WriteRequest(TestMethodCfg cfg, IperlHead iperlHead, MessageID messageID, int offset, int length, byte[] buffer)
|
||||
internal static int WriteRequest(TestMethodCfg_IPerl cfgIPerl, IperlHead iperlHead, MessageID messageID, int offset, int length, byte[] buffer)
|
||||
{
|
||||
RfidLogic writer = new RfidLogic($"COM{iperlHead.RfidComPortNr}");
|
||||
string payload = RfidHelper.ConvertByteArrayToHexString(buffer);
|
||||
|
||||
for (var i = 0; i < cfg.MaxCommRetries; i++)
|
||||
for (var i = 0; i < cfgIPerl.MaxCommRetries; i++)
|
||||
{
|
||||
rfidDataLogger.Error($"{iperlHead.CommInterface} Start {i} writting: COM{iperlHead.RfidComPortNr}: WriteRequest ({messageID},{offset}, {length}, {payload}... timeout {cfg.CommTimeout})");
|
||||
rfidDataLogger.Error($"{iperlHead.CommInterface} Start {i} writting: COM{iperlHead.RfidComPortNr}: WriteRequest ({messageID},{offset}, {length}, {payload}... timeout {cfgIPerl.CommTimeout})");
|
||||
try
|
||||
{
|
||||
if (writer.ClosePort()) writer.OpenPort();
|
||||
writer.WriteRequest((byte)messageID, offset, length, buffer, cfg.CommTimeout, false);
|
||||
writer.WriteRequest((byte)messageID, offset, length, buffer, cfgIPerl.CommTimeout, false);
|
||||
writer.ClosePort();
|
||||
rfidDataLogger.InfoFormat($"{iperlHead.Name}({iperlHead.SerialNr},COM{iperlHead.RfidComPortNr}): WriteRequestPort({messageID}, {offset}, {length}, {payload})");
|
||||
return 0;
|
||||
@@ -105,7 +106,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
else
|
||||
{
|
||||
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: Error: {ex.Message}");
|
||||
Thread.Sleep(cfg.WaitTimeAfterFailure);
|
||||
Thread.Sleep(cfgIPerl.WaitTimeAfterFailure);
|
||||
if (i > 1)
|
||||
{
|
||||
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: Reopen the com port.");
|
||||
@@ -115,8 +116,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
}
|
||||
}
|
||||
writer.ClosePort();
|
||||
rfidDataLogger.Error($"RFID writing failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: WriteRequestPort ({messageID},...) {System.Text.Encoding.UTF8.GetString(buffer)}");
|
||||
log.Error($"RFID writing failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: WriteRequestPort ({messageID},...) {System.Text.Encoding.UTF8.GetString(buffer)}");
|
||||
rfidDataLogger.Error($"RFID writing failed after {cfgIPerl.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: WriteRequestPort ({messageID},...) {System.Text.Encoding.UTF8.GetString(buffer)}");
|
||||
log.Error($"RFID writing failed after {cfgIPerl.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: WriteRequestPort ({messageID},...) {System.Text.Encoding.UTF8.GetString(buffer)}");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
{
|
||||
const int Q2CorrFactorsAddr = 0x1878;
|
||||
|
||||
internal static int ReadRequest(TestMethodCfg cfg, IperlHead iperlHead, MessageID messageID, int offset, int length, out byte[] buffer)
|
||||
internal static int ReadRequest(TestMethodCfg_IPerl cfgIPerl, IperlHead iperlHead, MessageID messageID, int offset, int length, out byte[] buffer)
|
||||
{
|
||||
byte[] configurationBuffer = new byte[ConfigStruct.Length] { 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
byte[] calibrationBuffer = new byte[CalibrationStructV4.Length] { 3, 0, 150, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 0, 0, 150, 10 };
|
||||
@@ -34,7 +34,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
return iperlHead.Name.Equals("iPerl13") ? 2 : 0; /// Simulates an error on position 13
|
||||
}
|
||||
|
||||
internal static int WriteRequest(TestMethodCfg cfg, IperlHead iperlHead, MessageID messageID, int offset, int length, byte[] buffer)
|
||||
internal static int WriteRequest(TestMethodCfg_IPerl cfgIPerl, IperlHead iperlHead, MessageID messageID, int offset, int length, byte[] buffer)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user