Esempio n. 1
0
        public string Excute()
        {
            string CardNo = string.Empty;

            if (this.Available())
            {
                byte[] buf = SY230NT.CommPakage(string.Format("A{0}F", deviceId));
                comm.Write(buf, 0, buf.Length);
                byte[] rbuf = new byte[255];
                int    cnt  = comm.Read(rbuf, 0, 255);
                if (cnt > 0)
                {
                    byte[] rbuf2 = new byte[cnt];
                    for (int i = 0; i < cnt; i++)
                    {
                        rbuf2[i] = rbuf[i];
                    }
                    string msg = SY230NT.GetPakageData(rbuf2);
                    if (!string.IsNullOrEmpty(msg))
                    {
                        CardNo = msg;
                    }
                }
            }
            return(CardNo);
        }
Esempio n. 2
0
        public string Excute(int controlid)
        {
            string CardNo = string.Empty;

            if (this.Available())
            {
                byte[] buf = SY230NT.CommPakage(string.Format("A{0}F", controlid));
                comm.Write(buf, 0, buf.Length);
                byte[] rbuf = new byte[255];
                int    cnt  = comm.Read(rbuf, 0, 255);
                if (cnt > 0)
                {
                    byte[] rbuf2 = new byte[cnt];
                    for (int i = 0; i < cnt; i++)
                    {
                        rbuf2[i] = rbuf[i];
                    }
                    string msg = SY230NT.GetPakageData(rbuf2);
                    if (!string.IsNullOrEmpty(msg))
                    {
                        StringBuilder sb = new StringBuilder();
                        if (msg.Length == 8)
                        {
                            sb.Append(msg[6]);
                            sb.Append(msg[7]);
                            sb.Append(msg[4]);
                            sb.Append(msg[5]);
                            sb.Append(msg[2]);
                            sb.Append(msg[3]);
                            sb.Append(msg[0]);
                            sb.Append(msg[1]);
                            CardNo = sb.ToString();
                        }
                    }
                }
            }
            return(CardNo);
        }