work backup

- Register Reader Poseidon works
- Smart Form - wrong functionality
- refactoring
This commit is contained in:
2025-11-06 14:11:13 +01:00
parent 320cddb177
commit f1e6e94450
97 changed files with 7988 additions and 2561 deletions
@@ -8,6 +8,7 @@ using System.Threading;
using TBF.Rig.Hart.Common;
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
using TBF.Rig.Uni.SharedDialogs.SmartMetersCommunication;
using TBF.Rig.Uni.SharedDialogs.SmartMetersCommunication.implementations;
using static Sensus.iPerl.NfcHandler.MCI_Protocol;
namespace TBF.Rig.TestMethods.iPerlCommunication
@@ -120,7 +120,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
return SimulationServices.ReadRequest(CfgIPerl, iperlHead, messageID, offset, length, out buffer);
}
if (iperlHead.CommInterface == CommunicationInterface.NFC) // NFC Interface
if (iperlHead.CommInterface == CommunicationInterface.NFC.ToDescription()) // NFC Interface
{
return NfcServices.ReadRequest(CfgIPerl, iperlHead, structName, offset, length, out buffer);
}
@@ -145,7 +145,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
return SimulationServices.WriteRequest(CfgIPerl, iperlHead, messageID, offset, length, buffer);
}
if (iperlHead.CommInterface == CommunicationInterface.NFC) // NFC Interface
if (iperlHead.CommInterface == CommunicationInterface.NFC.ToDescription()) // NFC Interface
{
return NfcServices.WriteRequest(CfgIPerl, iperlHead, structName, offset, length, buffer);
}
@@ -2271,11 +2271,11 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
List<iPerlDataWrite> dataToBeWritten = new List<iPerlDataWrite>
{
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC? 33:0x19A1, new byte[] { (byte)0xA5 }, "Open Sealing"), // ?????
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC? 5:0x1985, new byte[] { arrow }, "Arrow"),
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC? 28:0x199C, new byte[5], "Clear S/N"),
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC.ToDescription()? 33:0x19A1, new byte[] { (byte)0xA5 }, "Open Sealing"), // ?????
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC.ToDescription()? 5:0x1985, new byte[] { arrow }, "Arrow"),
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC.ToDescription()? 28:0x199C, new byte[5], "Clear S/N"),
new iPerlDataWrite(MessageID.Configuration, StructName.Configuration, 0x0015, new byte[] { (byte)0xA0 }, "Test mode config = A0"),
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC? 14:0x198E, new byte[] { (byte)(2510 & 0xFF), (byte)((2510 >> 8) & 0xFF) }, "Receipt mean current")
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC.ToDescription()? 14:0x198E, new byte[] { (byte)(2510 & 0xFF), (byte)((2510 >> 8) & 0xFF) }, "Receipt mean current")
};
// check meter status: 1-Idle, 2-Active, 3-Test, 4-End Of Life
@@ -2363,7 +2363,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
iPerlDataWrite[] dataToBeWritten = new iPerlDataWrite[]
{
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC? 33:0x19A1, new byte[] { (byte)0xA5 }, "Open Sealing"), /// 0x5A=sealed, 0xA5=unsealed ??????
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC.ToDescription()? 33:0x19A1, new byte[] { (byte)0xA5 }, "Open Sealing"), /// 0x5A=sealed, 0xA5=unsealed ??????
new iPerlDataWrite(MessageID.RadioPassthrough, StructName.RadioInfo, 0x1804, new byte[] { (byte)1 }, "System Status"),
new iPerlDataWrite(MessageID.Command, StructName.Command, 0x0000, new byte[] { (byte)Command.SetActiveMode }, "Set active mode"),
new iPerlDataWrite(MessageID.Configuration, StructName.Configuration, 0x0015, new byte[] { testModeConfig }, string.Format("Test mode config = {0:X2}", testModeConfig)),
@@ -2426,7 +2426,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
new iPerlDataWrite(MessageID.Command, StructName.Command, 0x0000, new byte[] { (byte)Command.SetActiveMode }, "Set active mode"),
new iPerlDataWrite(MessageID.Configuration, StructName.Configuration, 0x0015, new byte[] { testModeConfig }, string.Format("Test mode config = {0:X2}", testModeConfig)),
new iPerlDataWrite(MessageID.RadioPassthrough, StructName.RadioInfo, 0x1804, new byte[] { (byte)0 }, "System Status"),
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC? 33:0x19A1, new byte[] { (byte)0x5A }, "Close Sealing") /// 0x5A=sealed, 0xA5=unsealed ??????
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC.ToDescription()? 33:0x19A1, new byte[] { (byte)0x5A }, "Close Sealing") /// 0x5A=sealed, 0xA5=unsealed ??????
};
int successfyllyWrittenFlags = 0; /// Ones in this word represent communication failures, LSB represents the first step
@@ -3,6 +3,7 @@
///
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
@@ -107,7 +108,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
public enum CommunicationInterface
{
RFID,
NFC
[Description("RFID")]RFID,
[Description("NFC")]NFC
}
}
@@ -24,7 +24,7 @@ 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, IntIPerlReader
public class IperlHead : ComponentBase, IDevice,IRegReaderDatastream, ISessionDataMngmnt, IOperation, ISmartReader
{
private static readonly ILog log = LogManager.GetLogger(typeof(IperlHead));
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
@@ -42,16 +42,16 @@ 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 bool Disabled { get; set; }
public int OptoComPortNr { get { return iperlHeadCfg.OptoComPortNr; } }
public int MuxBoardNrOrGroup14 { get { return iperlHeadCfg.MuxBoardNr; } }
public int Group { get { return iperlHeadCfg.Group; } }
public iPerlHead.MeterType MeterType { get { return iperlHeadCfg.MeterType; } }
public CommunicationInterface CommInterface { get { return iperlHeadCfg.CommunicationInterface; } }
public string CommInterface { get { return iperlHeadCfg.CommunicationInterface.ToDescription(); } }
public int Position
{
@@ -89,8 +89,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
simulatedPcbNr = value;
}
}
public bool Disabled;
public int ResultCode;
@@ -933,9 +932,16 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
dataStreamState = DataStreamState.ProcessAndSave;
}
public void SetCommunicationInterface(string commInterface)
{
CommunicationInterface com = (CommunicationInterface)Enum.Parse(typeof(CommunicationInterface), commInterface);
SetCommunicationInterface(com);
}
public void SetCommunicationInterface(RegisterReaders.CommonRR.CommunicationInterface commInterface)
{
throw new NotImplementedException();
CommunicationInterface com = (CommunicationInterface)Enum.Parse(typeof(CommunicationInterface), commInterface.ToDescription());
SetCommunicationInterface(com);
}
/// <summary>
@@ -946,7 +952,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
return dataStreamState == DataStreamState.ProcessAndSave;
}
void IntIPerlReader.SetRfidInterface()
void ISmartReader.SetRfidInterface()
{
SetRfidInterface();
}
@@ -967,6 +973,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
bool synchronized2;
string partOfTelegram;
private RegisterReaders.CommonRR.CommunicationInterface _commInterface;
private string _commInterface1;
/// <summary>
/// Reads opto-datastream via serial port. Invoked from RunDeviceBefore()
@@ -1077,7 +1084,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
}
}
void IntIPerlReader.ResetNfcInterface(bool? nfc_on)
void ISmartReader.ResetNfcInterface(bool? nfc_on)
{
ResetNfcInterface(nfc_on);
}
@@ -1099,7 +1106,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
return received;
}
void IntIPerlReader.SetNfcInterface()
void ISmartReader.SetNfcInterface()
{
SetNfcInterface();
}