コード例 #1
0
 private static void DisplayInfo(NfcTarget target)
 {
     Console.WriteLine("Target info : {0}", target);
     Console.WriteLine("TasteMifareMini: {0}", target.TasteMifareMini());
     Console.WriteLine("TasteMifareClassic1k: {0}", target.TasteMifareClassic1k());
     Console.WriteLine("TasteMifareClassic4k: {0}", target.TasteMifareClassic4k());
 }
コード例 #2
0
 internal FreefareTag(IntPtr ptr, bool dispose, NfcDevice device, NfcTarget target)
 {
     this.m_ptr     = ptr;
     this.m_dispose = dispose;
     this.m_device  = device;
     this.m_target  = target;
 }
コード例 #3
0
        internal NTAG21xTag(IntPtr ptr, bool dispose, NfcDevice device, NfcTarget target) : base(ptr, dispose, device, target)
        {
            int code = NativeMethods.ntag21x_get_info(ptr);

            if (code < 0)
            {
                throw new FreefareException(string.Format("Can't read tag info. ret={0} lastError={1}", code, this.LastError()));
            }
        }
コード例 #4
0
        public static bool TasteMifareMini(this NfcTarget target)
        {
            NfcModulation      nm  = target.ReadModulation();
            nfc_iso14443a_info nai = target.ReadInfo <nfc_iso14443a_info>();

            return(nm.ModulationType == NfcModulationType.ISO14443A && (
                       nai.btSak == 0x09
                       ));
        }
コード例 #5
0
 public NfcEmulatedTag InitEmulatedTag(NfcTarget target)
 {
     //int rxLength;
     //IntPtr rx;
     //int msTimeout;
     //NfcError ret = NativeMethods.target_init(this.m_ptr, target, rx, rxLength, msTimeout);
     //NfcException.Raise(ret);
     //return new NfcEmulatedTag(rx, rxLength);
     throw new NotImplementedException();
 }
コード例 #6
0
 internal MifareClassicTag(IntPtr ptr, bool dispose, NfcDevice device, NfcTarget target) : base(ptr, dispose, device, target)
 {
 }
コード例 #7
0
 internal GenericTag(IntPtr ptr, bool dispose, NfcDevice device, NfcTarget target) : base(ptr, dispose, device, target)
 {
 }
コード例 #8
0
        internal static FreefareTag Build(IntPtr ptrTag, bool dispose, NfcDevice device, NfcTarget target)
        {
            TagType type = NativeMethods.freefare_get_tag_type(ptrTag);

            Console.WriteLine("  type={0}", type);

            FreefareTag tag;

            switch (type)
            {
            case TagType.NTAG_21x:
                tag = new NTAG21xTag(ptrTag, dispose, device, target);
                Console.WriteLine("  subtype={0}", ((NTAG21xTag)tag).SubType);
                break;

            case TagType.MIFARE_CLASSIC_1K:
                tag = new MifareClassic1kTag(ptrTag, dispose, device, target);
                break;

            case TagType.MIFARE_CLASSIC_4K:
                tag = new MifareClassic4kTag(ptrTag, dispose, device, target);
                break;

            //TODO other tag types
            default:
                tag = new GenericTag(ptrTag, dispose, device, target);
                break;
            }
            return(tag);
        }