Example #1
0
        private void DoFormatStatusvent()
        {
            int        vOEM;
            byte       Second, Minute, Hour, Day, Month;
            int        Year;
            Boolean    Ack;
            byte       vopenDoor = 0;
            RAcsStatus Event     = new RAcsStatus();
            RTCPStatus Status    = new RTCPStatus();

            Status = (RTCPStatus)ByteToStruct(BufferRX, typeof(RTCPStatus));

            Event.SerialNo   = Encoding.ASCII.GetString(Status.Serial);
            Serial           = Event.SerialNo;
            Event.ID         = Encoding.ASCII.GetString(Status.ID);
            Event.DoorStatus = Status.DoorStatus;
            Event.Ver        = Status.Ver;
            Ver = Event.Ver;

            vOEM           = Status.OEMCODE;
            Second         = Status.Time[5];
            Minute         = Status.Time[4];
            Hour           = Status.Time[3];
            Day            = Status.Time[2];
            Month          = Status.Time[1];
            Year           = Status.Time[0] + 2000;
            Event.Datetime = GetDatetime(Second, Minute, Hour, Day, Month, Year);

            Event.H1      = Status.H1;
            Event.H2      = Status.H2;
            Event.T1      = Status.T1;
            Event.T2      = Status.T2;
            Event.Version = Status.Version.ToString();

            Event.Online = true;
            Ack          = true;
            byte relay = 0;

            OnStatusHandler(Event, ref relay, ref vopenDoor, ref Ack);
            if (Ack)
            {
                AskHeart();
            }
        }
Example #2
0
 public void StatusHandler(XXY_VisitorMJAsst.RAcsStatus Event, ref byte relay, ref byte OpenDoor, ref Boolean Ack)
 {
     OpenDoor = 0;
     Ack      = true;
     SerialNo = Event.SerialNo;
     ID       = Event.ID;
     relay    = Event.Reader;
     {
         TimeSpan ds = DateTime.Now - Event.Datetime;
         if (System.Math.Abs(ds.Seconds) >= 5)
         {
             TcpPackge.SetTime(DateTime.Now);
             SendAndNOReturn();
         }
     }
     if (OnStatusHandler != null)
     {
         OnStatusHandler(Event, Event.SerialNo, Event.Version, Event.ID, Event.Datetime, Event.Reader, Event.Door, Event.DoorStatus, Event.Ver, Event.Online, ref relay, ref OpenDoor, ref Ack);
     }
 }