Skip to content

Commit

Permalink
bugfix: set hftag as default for elatec: v1.4.8535
Browse files Browse the repository at this point in the history
Version 1.4.8535
-----------------------------------------------------------------
Backend related changes
- BugFIX: Set "HFTag" as default Tagtype. Currently i do not switch between different
  Reader Tag Types. LF Tags and Legic storage services are not implemented yet.
  • Loading branch information
c3rebro committed May 15, 2023
1 parent 43ce982 commit b2d3beb
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 26 deletions.
40 changes: 24 additions & 16 deletions RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ public class ElatecNetProvider : ReaderDevice, IDisposable

private readonly TWN4ReaderDevice readerDevice;

private ChipModel hfTag;
private GenericChipModel hfTag;
private GenericChipModel lfTag;
private GenericChipModel legicTag;

private bool _disposed;

#region Constructor
Expand Down Expand Up @@ -73,36 +76,41 @@ public override ERROR ReadChipPublic()
Instance.Connect();
}

hfTag = readerDevice.GetSingleChip(true);

var lfTag = readerDevice.GetSingleChip(false);
var legicTag = readerDevice.GetSingleChip(true, true);
var tmpTag = readerDevice.GetSingleChip(true);
hfTag = new GenericChipModel(tmpTag.UID, (RFiDGear.DataAccessLayer.CARD_TYPE)tmpTag.CardType, tmpTag.SAK, tmpTag.RATS, tmpTag.VersionL4);
tmpTag = readerDevice.GetSingleChip(false);
lfTag = new GenericChipModel(tmpTag.UID, (RFiDGear.DataAccessLayer.CARD_TYPE)tmpTag.CardType);
tmpTag = readerDevice.GetSingleChip(true, true);
legicTag = new GenericChipModel(tmpTag.UID, (RFiDGear.DataAccessLayer.CARD_TYPE)tmpTag.CardType);
readerDevice.GetSingleChip(true);

if (
!(
string.IsNullOrWhiteSpace(hfTag?.ChipIdentifier) &
string.IsNullOrWhiteSpace(lfTag?.ChipIdentifier) &
string.IsNullOrWhiteSpace(legicTag?.ChipIdentifier)
string.IsNullOrWhiteSpace(hfTag?.UID) &
string.IsNullOrWhiteSpace(lfTag?.UID) &
string.IsNullOrWhiteSpace(legicTag?.UID)
)
)
{
try
{
readerDevice.GreenLED(true);
readerDevice.RedLED(false);

GenericChip = new GenericChipModel(hfTag.ChipIdentifier,
GenericChip = new GenericChipModel(hfTag.UID,
(CARD_TYPE)hfTag.CardType,
ByteConverter.GetStringFrom(readerDevice.SAK),
ByteConverter.GetStringFrom(readerDevice.ATS),
ByteConverter.GetStringFrom(readerDevice.L4VERSION)
hfTag.SAK,
hfTag.RATS,
hfTag.VersionL4
);

if (lfTag != null && lfTag?.CardType != ChipType.NOTAG)
if (lfTag != null && lfTag?.CardType != CARD_TYPE.NOTAG)
{
GenericChip.Slave = new GenericChipModel(lfTag.ChipIdentifier, (RFiDGear.DataAccessLayer.CARD_TYPE)lfTag.CardType);
GenericChip.Child = new GenericChipModel(lfTag.UID, (RFiDGear.DataAccessLayer.CARD_TYPE)lfTag.CardType);
}
else if(legicTag != null && legicTag?.CardType != ChipType.NOTAG)
else if(legicTag != null && legicTag?.CardType != CARD_TYPE.NOTAG)
{
GenericChip.Slave = new GenericChipModel(legicTag.ChipIdentifier, (RFiDGear.DataAccessLayer.CARD_TYPE)legicTag.CardType);
GenericChip.Child = new GenericChipModel(legicTag.UID, (RFiDGear.DataAccessLayer.CARD_TYPE)legicTag.CardType);
}
//readerDevice.GetSingleChip(true);

Expand Down
3 changes: 2 additions & 1 deletion RFiDGear/Model/GenericChipModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public GenericChipModel(string uid, CARD_TYPE cardType, string sak, string rats,
public string SAK { get; set; }
public string RATS { get; set; }
public string VersionL4 { get; set; }
public GenericChipModel Slave { get; set; }
public GenericChipModel Child { get; set; }
public GenericChipModel GrandChild { get; set; }
}
}
2 changes: 1 addition & 1 deletion RFiDGear/Model/MifareDesfire/MifareDesfireChipModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public MifareDesfireChipModel(GenericChipModel genericChip)
RATS = genericChip.RATS;
SAK = genericChip.SAK;
L4Version = genericChip.VersionL4;
Slave = genericChip.Slave;
Child = genericChip.Child;
}

public string L4Version { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,12 @@ public RFiDChipParentLayerViewModel(MifareDesfireChipModel _uidModel, Observable
ResourceLoader.GetResource(
string.Format("ENUM.CARD_TYPE.{0}", Enum.GetName(typeof(CARD_TYPE), CardType))));

if (mifareDesfireUidModel.Slave != null)
if (mifareDesfireUidModel.Child != null)
{
ParentNodeHeaderRed +=
String.Format("\nHybridTag: {0}\nUID: {1}",
Enum.GetName(typeof(CARD_TYPE), mifareDesfireUidModel.Slave.CardType),
mifareDesfireUidModel.Slave.UID);
Enum.GetName(typeof(CARD_TYPE), mifareDesfireUidModel.Child.CardType),
mifareDesfireUidModel.Child.UID);
}

Children.Add(
Expand Down
8 changes: 4 additions & 4 deletions RFiDGear/ViewModel/TaskSetupViewModels/CommonTaskViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -911,19 +911,19 @@ private void OnNewWriteReportCommand(ReportReaderWriter _reportReaderWriter)

if (temporaryContent.Contains("%SLAVECHIPTYPE"))
{
if (GenericChip?.Slave != null)
if (GenericChip?.Child != null)
{
temporaryContent = temporaryContent.Replace("%SLAVECHIPTYPE", ResourceLoader.GetResource(
string.Format("ENUM.CARD_TYPE.{0}", Enum.GetName(typeof(CARD_TYPE), GenericChip?.Slave?.CardType))) ?? "");
string.Format("ENUM.CARD_TYPE.{0}", Enum.GetName(typeof(CARD_TYPE), GenericChip?.Child?.CardType))) ?? "");
hasVariable = true;
}
}

if (temporaryContent.Contains("%SLAVEUID"))
{
if (GenericChip?.Slave != null)
if (GenericChip?.Child != null)
{
temporaryContent = temporaryContent.Replace("%SLAVEUID", GenericChip?.Slave?.UID ?? "");
temporaryContent = temporaryContent.Replace("%SLAVEUID", GenericChip?.Child?.UID ?? "");
hasVariable = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ private void OnNewCheckChipIsMultiTecChipCommand()
if (result == ERROR.NoError)
{

if (device.GenericChip.Slave != null)
if (device.GenericChip.Child != null)
{
result = ERROR.NoError;
}
Expand Down

0 comments on commit b2d3beb

Please sign in to comment.