diff --git a/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs b/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs
index f7b6d7f..2bac191 100644
--- a/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs
+++ b/RFiDGear/DataAccessLayer/Remote/FromIO/ElatecNetProvider.cs
@@ -24,7 +24,7 @@ public class ElatecNetProvider : ReaderDevice, IDisposable
private readonly TWN4ReaderDevice readerDevice;
- private ChipModel card;
+ private ChipModel hfTag;
private bool _disposed;
#region Constructor
@@ -73,26 +73,38 @@ public override ERROR ReadChipPublic()
Instance.Connect();
}
- card = readerDevice.GetSingleChip(true);
+ hfTag = readerDevice.GetSingleChip(true);
- if (!string.IsNullOrWhiteSpace(card?.ChipIdentifier))
+ var lfTag = readerDevice.GetSingleChip(false);
+ var legicTag = readerDevice.GetSingleChip(true, true);
+
+ if (
+ !(
+ string.IsNullOrWhiteSpace(hfTag?.ChipIdentifier) &
+ string.IsNullOrWhiteSpace(lfTag?.ChipIdentifier) &
+ string.IsNullOrWhiteSpace(legicTag?.ChipIdentifier)
+ )
+ )
{
try
{
- GenericChip = new GenericChipModel(card.ChipIdentifier,
- (CARD_TYPE)card.CardType,
+
+ GenericChip = new GenericChipModel(hfTag.ChipIdentifier,
+ (CARD_TYPE)hfTag.CardType,
ByteConverter.GetStringFrom(readerDevice.SAK),
ByteConverter.GetStringFrom(readerDevice.ATS),
ByteConverter.GetStringFrom(readerDevice.L4VERSION)
);
- var lfTag = readerDevice.GetSingleChip(false);
-
if (lfTag != null && lfTag?.CardType != ChipType.NOTAG)
{
GenericChip.Slave = new GenericChipModel(lfTag.ChipIdentifier, (RFiDGear.DataAccessLayer.CARD_TYPE)lfTag.CardType);
}
- readerDevice.GetSingleChip(true);
+ else if(legicTag != null && legicTag?.CardType != ChipType.NOTAG)
+ {
+ GenericChip.Slave = new GenericChipModel(legicTag.ChipIdentifier, (RFiDGear.DataAccessLayer.CARD_TYPE)legicTag.CardType);
+ }
+ //readerDevice.GetSingleChip(true);
return ERROR.NoError;
}
@@ -148,8 +160,13 @@ public override ERROR Connect()
#region MifareClassic
public override ERROR WriteMifareClassicSingleBlock(int _blockNumber, string _aKey, string _bKey, byte[] buffer)
{
- return WriteMifareClassicSingleSector(
- CustomConverter.GetSectorNumberFromChipBasedDataBlockNumber(_blockNumber), _aKey, _bKey, buffer);
+ if (!readerDevice.MifareClassicLogin(_aKey, 0, (byte)CustomConverter.GetSectorNumberFromChipBasedDataBlockNumber(_blockNumber))) // No Access Allowed, try bKey
+ {
+ readerDevice.MifareClassicLogin(_bKey, 1, (byte)CustomConverter.GetSectorNumberFromChipBasedDataBlockNumber(_blockNumber));
+
+ } // Login
+
+ return readerDevice.MifareClassicWriteBlock(buffer, (byte)_blockNumber) == true ? ERROR.NoError : ERROR.AuthenticationError;
}
public override ERROR ReadMifareClassicSingleSector(int sectorNumber, string aKey, string bKey)
@@ -418,10 +435,20 @@ public override ERROR ChangeMifareDesfireApplicationKey(string _applicationMaste
1,
(byte)(int)Enum.Parse(typeof(Elatec.NET.DESFireKeyType), Enum.GetName(typeof(RFiDGear.DataAccessLayer.DESFireKeyType), _keyTypeTarget))))
{
+ if (readerDevice.DesfireAuthenticate(_applicationMasterKeyTarget, (byte)_keyNumberTarget, (byte)(int)Enum.Parse(typeof(Elatec.NET.DESFireKeyType), Enum.GetName(typeof(RFiDGear.DataAccessLayer.DESFireKeyType), _keyTypeTarget)), 1))
+ {
+ readerDevice.DesfireChangeKeySettings((byte)keySettings, 0, (byte)(int)Enum.Parse(typeof(Elatec.NET.DESFireKeyType), Enum.GetName(typeof(RFiDGear.DataAccessLayer.DESFireKeyType), _keyTypeTarget)));
+ }
+
return ERROR.NoError;
}
else
{
+ if (readerDevice.DesfireAuthenticate(_applicationMasterKeyTarget, (byte)_keyNumberTarget, (byte)(int)Enum.Parse(typeof(Elatec.NET.DESFireKeyType), Enum.GetName(typeof(RFiDGear.DataAccessLayer.DESFireKeyType), _keyTypeTarget)), 1))
+ {
+ readerDevice.DesfireChangeKeySettings((byte)keySettings, 0, (byte)(int)Enum.Parse(typeof(Elatec.NET.DESFireKeyType), Enum.GetName(typeof(RFiDGear.DataAccessLayer.DESFireKeyType), _keyTypeTarget)));
+ }
+
return ERROR.AuthenticationError;
}
}
diff --git a/RFiDGear/Properties/AssemblyInfo.cs b/RFiDGear/Properties/AssemblyInfo.cs
index 9ba5fc4..320fc63 100644
--- a/RFiDGear/Properties/AssemblyInfo.cs
+++ b/RFiDGear/Properties/AssemblyInfo.cs
@@ -25,6 +25,6 @@
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
-[assembly: AssemblyVersion("1.3.*")]
+[assembly: AssemblyVersion("1.4.*")]
[assembly: Guid("a34bc413-e349-4fd1-8b90-2eb95a333436")]
[assembly: NeutralResourcesLanguage("")]
diff --git a/RFiDGear/ViewModel/MainWindowViewModel.cs b/RFiDGear/ViewModel/MainWindowViewModel.cs
index fd74aea..a8b696a 100644
--- a/RFiDGear/ViewModel/MainWindowViewModel.cs
+++ b/RFiDGear/ViewModel/MainWindowViewModel.cs
@@ -90,12 +90,6 @@ public class MainWindowViewModel : ObservableObject
#region Events / Delegates
- ///
- /// will raise notifier to inform user about available updates
- ///
- ///
- ///
- public delegate void updateReady(object sender, EventArgs e);
#endregion
#region Constructors
@@ -1158,12 +1152,12 @@ private void OnNewWriteToChipOnceCommand()
treeViewParentNodes.First(x => x.IsSelected).IsSelected = false;
}
- //only run if theres a card on the reader and its uid was previously added
+ //only run if theres a hfTag on the reader and its uid was previously added
if (
!string.IsNullOrWhiteSpace(GenericChip.UID) &&
treeViewParentNodes.Any(x => x.UID == GenericChip.UID))
{
- //select current parentnode (card) on reader
+ //select current parentnode (hfTag) on reader
treeViewParentNodes.First(x => x.UID == GenericChip.UID).IsSelected = true;
treeViewParentNodes.First(x => x.IsSelected).IsBeingProgrammed = true;
}
diff --git a/RFiDGear/ViewModel/TaskSetupViewModels/MifareDesfireSetupViewModel.cs b/RFiDGear/ViewModel/TaskSetupViewModels/MifareDesfireSetupViewModel.cs
index 728eef2..57c1b5c 100644
--- a/RFiDGear/ViewModel/TaskSetupViewModels/MifareDesfireSetupViewModel.cs
+++ b/RFiDGear/ViewModel/TaskSetupViewModels/MifareDesfireSetupViewModel.cs
@@ -2637,7 +2637,7 @@ private void OnNewChangeMasterCardKeyCommand()
0,
SelectedDesfireMasterKeyEncryptionTypeCurrent,
DesfireMasterKeyTarget,
- selectedDesfireAppKeyNumberTargetAsInt,
+ 0,
0,
SelectedDesfireMasterKeyEncryptionTypeTarget, 0, 0, keySettings, keyVersionCurrentAsInt);