private bool isMIFARETag(Tag tag) { bool returnVar = false; ArrayList arr = new ArrayList(); arr.AddRange(tag.GetTechList()); if (arr.Contains("android.nfc.tech.NfcA")) { NfcA nfc_A = NfcA.Get(tag); byte[] atqa = nfc_A.GetAtqa(); int Sak = int.Parse(nfc_A.Sak.ToString()); switch (atqa[1]) { case 0x00: if (atqa[0] == 0x44 || atqa[0] == 0x42 || atqa[0] == 0x02 || atqa[0] == 0x04) { if (Sak == 0x20) { returnVar = true; detectedTag = "MIFARE_PLUS_SL3"; } else if (Sak == 0x10) { returnVar = true; detectedTag = "MIFARE_PLUS_SL2"; } } break; case 0x03: if (atqa[0] == 0x44 || atqa[0] == 0x4) { returnVar = true; detectedTag = "MIFARE_DESFIRE"; } break; default: break; } } return(returnVar); }
public static string GetManufacturer(Tag tag) { string mifareInfo = ""; string[] techtags = tag.GetTechList(); foreach (string s in techtags) { if (s.ToLower().IndexOf("mifareultralight") != -1) { return("MifareUltralight"); } else if (s.ToLower().IndexOf("mifareclassic") != -1) { mifareInfo = "Mifare Classic"; MifareClassic mifareClassicTag = MifareClassic.Get(tag); //Get MIFARE CLASSIC tag if (mifareClassicTag != null) { if (mifareClassicTag.Type == MifareClassic.TypePlus) { mifareInfo = "Mifare Plus"; } else if (mifareClassicTag.Type == MifareClassic.TypePro) { mifareInfo = "Mifare Pro"; } } return(mifareInfo); } else if (s.ToLower().IndexOf("nfca") != -1) { NfcA nfc_A = NfcA.Get(tag); if (nfc_A != null) { byte[] atqa = nfc_A.GetAtqa(); if (atqa.Length >= 2) { Int32.TryParse(nfc_A.Sak.ToString(), out int Sak); switch (atqa[1]) { case 0x00: if (atqa[0] == 0x44 || atqa[0] == 0x42 || atqa[0] == 0x02 || atqa[0] == 0x04) { if (Sak == 0x20) { mifareInfo = "Mifare Plus SL3"; } else if (Sak == 0x10) { mifareInfo = "Mifare Plus SL2"; } else if (Sak == 0x00) { mifareInfo = "Mifare EM"; } } break; case 0x03: if (atqa[0] == 0x44 || atqa[0] == 0x4) { mifareInfo = "Mifare Desfire"; } break; default: break; } } } } else if (IsFelicaTag(tag)) { mifareInfo = "Felica"; } } return(mifareInfo); }