diff --git a/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs b/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs index 2bac191..eb4172d 100644 --- a/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs +++ b/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs @@ -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 @@ -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); diff --git a/RFiDGear/Model/GenericChipModel.cs b/RFiDGear/Model/GenericChipModel.cs index e118b5e..698b0a4 100644 --- a/RFiDGear/Model/GenericChipModel.cs +++ b/RFiDGear/Model/GenericChipModel.cs @@ -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; } } } \ No newline at end of file diff --git a/RFiDGear/Model/MifareDesfire/MifareDesfireChipModel.cs b/RFiDGear/Model/MifareDesfire/MifareDesfireChipModel.cs index e0ec061..1b558e1 100644 --- a/RFiDGear/Model/MifareDesfire/MifareDesfireChipModel.cs +++ b/RFiDGear/Model/MifareDesfire/MifareDesfireChipModel.cs @@ -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; } diff --git a/RFiDGear/ViewModel/HirarchicalDataTemplateViewModels/RFiDChipParentLayerViewModel.cs b/RFiDGear/ViewModel/HirarchicalDataTemplateViewModels/RFiDChipParentLayerViewModel.cs index f32b2ef..d0640c8 100644 --- a/RFiDGear/ViewModel/HirarchicalDataTemplateViewModels/RFiDChipParentLayerViewModel.cs +++ b/RFiDGear/ViewModel/HirarchicalDataTemplateViewModels/RFiDChipParentLayerViewModel.cs @@ -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( diff --git a/RFiDGear/ViewModel/TaskSetupViewModels/CommonTaskViewModel.cs b/RFiDGear/ViewModel/TaskSetupViewModels/CommonTaskViewModel.cs index 616eb56..4f52194 100644 --- a/RFiDGear/ViewModel/TaskSetupViewModels/CommonTaskViewModel.cs +++ b/RFiDGear/ViewModel/TaskSetupViewModels/CommonTaskViewModel.cs @@ -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; } } diff --git a/RFiDGear/ViewModel/TaskSetupViewModels/GenericChipTaskViewModel.cs b/RFiDGear/ViewModel/TaskSetupViewModels/GenericChipTaskViewModel.cs index 948184c..ba2c781 100644 --- a/RFiDGear/ViewModel/TaskSetupViewModels/GenericChipTaskViewModel.cs +++ b/RFiDGear/ViewModel/TaskSetupViewModels/GenericChipTaskViewModel.cs @@ -444,7 +444,7 @@ private void OnNewCheckChipIsMultiTecChipCommand() if (result == ERROR.NoError) { - if (device.GenericChip.Slave != null) + if (device.GenericChip.Child != null) { result = ERROR.NoError; }