コード例 #1
0
        /// <summary>
        /// 认证
        /// </summary>
        private bool Authentication()
        {
            if (!SP.IsOpen)
            {
                return(false);
            }
            SP.DiscardInBuffer();
            CardMsgSend data = new CardMsgSend((byte)CardMsgType.Authentication, new byte[] { 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff });

            SP.Write(data.GetMsg(), 0, data.GetMsg().Length);
            string msg = string.Empty;

            return(ReadMsgFromSP(CardMsgType.Authentication, ref msg));
        }
コード例 #2
0
        /// <summary>
        /// 读取块数据
        /// </summary>
        private bool ReadBlockData(ref string str)
        {
            if (!SP.IsOpen)
            {
                return(false);
            }
            SP.DiscardInBuffer();
            CardMsgSend data = new CardMsgSend((byte)CardMsgType.ReadBlockData, new byte[] { 0X01 });

            SP.Write(data.GetMsg(), 0, data.GetMsg().Length);
            string msg = string.Empty;

            return(ReadMsgFromSP(CardMsgType.ReadBlockData, ref str));
        }
コード例 #3
0
        /// <summary>
        /// 获取卡号
        /// </summary>
        private bool GetCardNum()
        {
            if (!SP.IsOpen)
            {
                return(false);
            }
            SP.DiscardInBuffer();
            CardMsgSend data = new CardMsgSend((byte)CardMsgType.GetCardNum, new byte[] { 0x0 });

            SP.Write(data.GetMsg(), 0, data.GetMsg().Length);
            string msg = string.Empty;

            return(ReadMsgFromSP(CardMsgType.GetCardNum, ref msg));
        }