Smart meters support MainWnd dialog (must be finished - mouse right click), test supports Poseidon RegisterReader
Refactor `ISmartReader` and related classes to support `SmartHeadsUni`. Remove redundant `IperlHeadsUni` references and introduce `SmartMeterFlyingStartMassCollection` functionality. Enhance regex-based head position extraction.
This commit is contained in:
@@ -9,11 +9,12 @@ using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Rig.Sequences;
|
||||
using TBF.Rig.Uni.SharedDialogs.SmartMetersCommunication;
|
||||
using TBF.UiBridge;
|
||||
|
||||
namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
public class TestMethod : ComponentBase, ISimultTestMethod, ISequenceCondition, ISessionDataMngmnt
|
||||
public class TestMethod : SmartComponentBase, ISimultTestMethod, ISequenceCondition, ISessionDataMngmnt
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
|
||||
protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData");
|
||||
@@ -164,5 +165,15 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
message = "Device capabilities check not implemented.";
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void MeterCommMilestone(int iItem, bool bValue)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool IsMeterCommMilestone(int iItem)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ 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
|
||||
{
|
||||
@@ -31,7 +32,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
TestMethodCfg_IPerl()
|
||||
{
|
||||
Name = "iPerlCommunication";
|
||||
Name = "SmartCommunication";
|
||||
ParentName = string.Empty;
|
||||
CommTimeout = 1800; /// ms
|
||||
MaxCommRetries = 4;
|
||||
|
||||
@@ -14,6 +14,7 @@ using Sensus.iPerl.NfcHandler;
|
||||
using NHibernate;
|
||||
using Renci.SshNet;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq; // This line is correct and does not need to be changed.
|
||||
using System.Windows;
|
||||
@@ -53,13 +54,38 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
public iPerlHead.MeterType MeterType { get { return iperlHeadCfg.MeterType; } }
|
||||
public string CommInterface { get { return iperlHeadCfg.CommunicationInterface.ToDescription(); } }
|
||||
|
||||
|
||||
static int? ExtractPreferredNumber(string input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input))
|
||||
return null;
|
||||
|
||||
// Match all sequences of digits
|
||||
var matches = Regex.Matches(input, @"\d+");
|
||||
if (matches.Count == 0)
|
||||
return null;
|
||||
|
||||
// Prefer the last one if there are multiple
|
||||
string selected = matches[matches.Count - 1].Value; // last element
|
||||
return int.Parse(selected);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// this is a hack to get the position from the name
|
||||
/// name must consist only with digit describing order of the meter
|
||||
/// </summary>
|
||||
public int Position
|
||||
{
|
||||
get
|
||||
{
|
||||
int firstDigitPos = Name.IndexOfAny(new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' });
|
||||
int position;
|
||||
return (firstDigitPos < 0) ? 0 : (int.TryParse(Name.Substring(firstDigitPos), out position) ? position : 0);
|
||||
//BUMI this is a hack to get the position from the name
|
||||
// but it is not working for all cases !!!!!
|
||||
// - what stupid prediction (what index should be used?? see: 'S4iPerl1' or ...)
|
||||
|
||||
int? extractPreferredNumber = ExtractPreferredNumber(Name);
|
||||
if (extractPreferredNumber.HasValue)
|
||||
return extractPreferredNumber.Value;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
public RegisterReaderType RegisterReaderType { get { return RegisterReaderType.DataStream; } }
|
||||
|
||||
Reference in New Issue
Block a user