コード例 #1
0
        public override bool Select(out string msg)
        {
            bool res = true;
            int  st  = 0;

            byte[] cardUid = new byte[10];
            if (!string.IsNullOrEmpty(CardId))
            {
                msg = "CardID is empty";
                return(false);
            }
            ReaderDllMethod.HexToBin(CardId, cardUid, CardId.Length);
            byte [] cardsak = new byte[1];
            st = ReaderDllMethod.mwSelect(handle, cardUid, CardId.Length, out cardsak[0]); //请求卡TYPE A 类型卡片
            if (st < 0)
            {
                msg = st.ToString() + "*" + ReaderDllMethod.getErrMsg(st);
                res = false;
            }
            else
            {
                msg = st.ToString() + "*" + ReaderDllMethod.getErrMsg(st);
                StringBuilder cardStr = new StringBuilder();
                ReaderDllMethod.BinToHex(cardsak, cardStr, st);
                CardSak = cardStr.ToString();
                DevBeep(1, 1, 2);
            }
            return(res);
        }
コード例 #2
0
        public override byte[] HexToBin(string hex)
        {
            byte[] bin = new byte[hex.Length / 2];
            ReaderDllMethod.HexToBin(hex, bin, hex.Length);

            return(bin);
        }
コード例 #3
0
        public override bool Anticoll(out string msg)
        {
            bool res = true;
            int  st  = 0;

            byte[] cardUid = new byte[10];
            if (!string.IsNullOrEmpty(CardId))
            {
                msg = "CardID is empty";
                return(false);
            }
            ReaderDllMethod.HexToBin(CardId, cardUid, CardId.Length);
            st = ReaderDllMethod.mwAnticoll(handle, cardUid); //请求卡TYPE A 类型卡片
            if (st < 0)
            {
                msg = st.ToString() + "*" + ReaderDllMethod.getErrMsg(st);
                res = false;
            }
            else
            {
                msg = st.ToString() + "*" + ReaderDllMethod.getErrMsg(st);
                DevBeep(1, 1, 2);
            }
            return(res);
        }