Exemple #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);
        }
Exemple #2
0
 public bool Kz(int controlid, int door)
 {
     if (Available())
     {
         int count    = DeviceConfigManager.Instance.config.SyrisKZCount;
         int time     = DeviceConfigManager.Instance.config.SyrisKZTime;
         int interval = DeviceConfigManager.Instance.config.SyrisKZInterval;
         if (time < 1)
         {
             time = 0;
         }
         if (time > 60)
         {
             time = 60;
         }
         if (interval < 0)
         {
             interval = 0;
         }
         for (int i = 1; i < count; i++)
         {
             SY230NT.RemoteOpenDoorControl(iHANDLEID, controlid, door, time);
             System.Threading.Thread.Sleep(time * 1000 + interval);
         }
         SY230NT.RemoteOpenDoorControl(iHANDLEID, controlid, door, time);
         return(true);
     }
     return(false);
 }
Exemple #3
0
 public bool KZ(int door)
 {
     if (Available())
     {
         if (door == 1)
         {
             return(SY230NT.RemoteOpenDoorControl(iHANDLEID, controlid, roadbrake1, 3) == 1);
         }
         else
         {
             return(SY230NT.RemoteOpenDoorControl(iHANDLEID, controlid, roadbrake2, 3) == 1);
         }
     }
     return(false);
 }
Exemple #4
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);
        }
Exemple #5
0
        public string Excute(int controlid)
        {
            string CardNo = string.Empty;

            if (this.Available())
            {
                int           ModuleID = 0;
                int           YYYY = 0, MM = 0, DD = 0, hh = 0, nn = 0, ss = 0;
                StringBuilder No     = new StringBuilder(100);
                StringBuilder Status = new StringBuilder(100);
                int           result = SY230NT.GetOneInOut(iHANDLEID, controlid, ref ModuleID, ref YYYY, ref MM, ref DD, ref hh, ref nn, ref ss, No, Status);
                if (result == 1)
                {
                    StringBuilder cardId = new StringBuilder(50);
                    if (No.ToString().Contains("XX"))
                    {
                        try
                        {
                            int n = Convert.ToInt32(No.ToString().Replace("XX", ""));
                            if (SY230NT.GetInvalidCardID(iHANDLEID, controlid, n, cardId) == 1)
                            {
                                CardNo = cardId.ToString();
                                if (CardNo.Length >= 8)
                                {
                                    CardNo = CardNo.Substring(CardNo.Length - 8);
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                SY230NT.DeleteAllInOut(iHANDLEID, controlid);
            }
            return(CardNo);
        }
Exemple #6
0
 public bool CloseDevice()
 {
     return(SY230NT.Close_COMMS(iHANDLEID) == 1);
 }
Exemple #7
0
 public bool OpenDevice()
 {
     iHANDLEID = SY230NT.Open_COMMS(0, port, baudrate.ToString() + ",e,8,1", "", 0, 1000);
     return(iHANDLEID >= 0);
 }