libRfid1.dll removed

This commit is contained in:
Jan Augustin
2023-04-14 09:29:56 +02:00
parent c8a5640ddc
commit fe4531ad4c
5 changed files with 441 additions and 932 deletions
@@ -0,0 +1,97 @@
using Sensus.iPerl.RfidCom.Helper;
using Sensus.iPerl.RfidCom.Services;
using Sensus.iPerl.RfidCom.Structures;
using System;
using System.Threading;
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
namespace TBF.Rig.TestMethods.iPerlCommunication
{
internal class OpticalHeadTest
{
internal static string OpenSealing(IperlHead iHead)
{
if (RfidCommands.OpenSealing($"COM{iHead.RfidComPortNr}")) return "OK";
return "Error Open Sealing";
}
internal static string ReadRequest_PCB(IperlHead iHead)
{
try
{
byte[] pcb = null;
int readRetVal = iPerlCommunicationForm.ReadRequestPort(iHead, MessageID.Configuration, 16, 5, out pcb);
if (readRetVal == 0)
{
return RfidHelper.HexLiteral2Unsigned(RfidHelper.SwapHexcode(BitConverter.ToString(pcb).Replace("-", string.Empty))).ToString();
}
return "Error";
}
catch (Exception ex)
{
return (ex.Message.ToString());
}
}
internal static string SetActiveMode(IperlHead iHead)
{
return RfidCommands.SetActiveMode($"COM{iHead.RfidComPortNr}") ? "OK" : "Error Set Active Mode";
}
internal static string SetTestMode(IperlHead iHead)
{
return RfidCommands.SetTestMode($"COM{iHead.RfidComPortNr}") ? "OK" : "Error Set Test Mode";
}
internal static string TurnOffRadio(IperlHead iHead)
{
try
{
string payload = "03";
RfidCommunicationService rfidCommunicationService = new RfidCommunicationService { ComPort = $"COM{iHead.RfidComPortNr}", WaitTimeAfterFailure = 2200, PassThroughWaitTime = 1500, MaxRetries = 3, TimeOut = 5000 };
rfidCommunicationService.RfidWrite(Params.u8_WakeUpInterval, payload);
return rfidCommunicationService.RfidRead(Params.u8_WakeUpInterval).ToString() == payload? "OK" : "Error";
}
catch (Exception ex)
{
return (ex.Message.ToString());
}
}
internal static string SetProductionMode(IperlHead iHead)
{
try
{
string payload = "01"; // 1 set the µC to the production mode, radio should not start
RfidCommunicationService rfidCommunicationService = new RfidCommunicationService { ComPort = $"COM{iHead.RfidComPortNr}", WaitTimeAfterFailure = 2200, PassThroughWaitTime = 1500, MaxRetries = 3, TimeOut = 5000 };
rfidCommunicationService.RfidWrite(SystemInfo.u8_system_state, payload);
Thread.Sleep(1000); // must be for pass thru params
return rfidCommunicationService.RfidRead(SystemInfo.u8_system_state).ToString() == payload ? "OK" : "Error";
}
catch (Exception ex)
{
return (ex.Message.ToString());
}
}
internal static string WriteRequestPort_u8_Customer_Text(IperlHead iHead)
{
string custText = "FF0123456789ABCDEF"; // Sample text to test write function
try
{
byte[] cmd = RfidHelper.HexStringToByteArray(custText);
if (0 == iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.RadioPassthrough, 0x1899, 9, cmd))
{
RfidCommunicationService rfidCommunicationService = new RfidCommunicationService { ComPort = $"COM{iHead.RfidComPortNr}", WaitTimeAfterFailure = 2200, PassThroughWaitTime = 1500, MaxRetries = 3, TimeOut = 5000 };
//rfidCommunicationService.RfidWrite(Params.u8_Customer_Text, custText);
return rfidCommunicationService.RfidRead(Params.u8_Customer_Text).ToString();
}
}
catch (Exception ex)
{
return (ex.Message.ToString());
}
return $"Error COM{iHead.RfidComPortNr}";
}
}
}
@@ -22,6 +22,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
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;
@@ -59,7 +61,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
ParentName = string.Empty;
CommTimeout = 1800; /// ms
MaxCommRetries = 4;
NrThreads = 2; /// 1, 2 or 4 threads
WaitTimeAfterFailure = 2200;
PassThroughWaitTime = 1500;
NrThreads = 2; /// 1, 2 or 4 threads
IperlCheckErrorsToStop = 10;
TestParams = CreateTestParamsProvider() as iPerlCommunicationParams;
File diff suppressed because it is too large Load Diff