Ejemplo n.º 1
0
 /// <summary>
 /// 根据门获得门序号
 /// </summary>
 /// <param name="door"></param>
 /// <returns></returns>
 internal static byte toDoorIndex(Door door)
 {
     return 1;
 }
Ejemplo n.º 2
0
 public void SetDoor(Door door)
 {
     log.Info("TCPControl set door: DoorNum= " + door.DoorNum + ",OpenTime=" + door.OpenTime + ",CloseOutTime=" + (ushort)door.CloseOutTime + ",DoorAlerm2Long" + door.DoorAlerm2Long + ",door.AlarmMast= " + door.AlarmMast + " .AlarmTime=" + door.AlarmTime + ",PassBack= " + door.PassBack + ",MCardsOpen= " + (byte)door.MCardsOpen + "," + (byte)door.MCardsOpenInOut);
     bool result = connector.SetDoor(
                 (byte)door.DoorNum,
                 (ushort)door.OpenTime,
                 (ushort)door.CloseOutTime,
                 door.DoorAlerm2Long,
                 (ushort)door.AlarmMast,
                 (ushort)door.AlarmTime,
                 door.PassBack,
                 (byte)door.MCardsOpen,
                 (byte)door.MCardsOpenInOut
           );
     if (!result)
     {
         log.Info("TCPControl set door: Fail..." + connector.TCPLastError);
     }
 }
Ejemplo n.º 3
0
        public void SetDoorTime(Door door,DoorTime doorTime)
        {
            byte week = 0;
            if(doorTime.Holiday)
            {
                week |= 0x80;
            }
            if(doorTime.Sunday)
            {
                week |= 0x40;
            }
            if(doorTime.Saturday)
            {
                week |= 0x20;

            }
            if(doorTime.Friday)
            {
                week |= 0x10;
            }
            if(doorTime.Thursday)
            {
                week |= 0x08;
            }
            if(doorTime.Wednesday)
            {
                week |= 0x04;
            }
            if(doorTime.Tuesday)
            {
                week |= 0x02;
            }
            if(doorTime.Monday)
            {
                week |= 0x01;
            }
            log.Info("TCPControl AddTimeZone: door.DoorNum= " + door.DoorNum + ",doorTime.DoorTimeNum=" + doorTime.DoorTimeNum + ",doorTime.DoorTimeNum=" + doorTime.DoorTimeNum + ",doorTime.StartTime" + doorTime.StartTime + ",doorTime.EndTime= " + doorTime.EndTime + ",week=" + week);
            bool result = connector.AddTimeZone(
                (ushort)door.DoorNum,
                (byte)doorTime.DoorTimeNum,
                doorTime.StartTime,
               doorTime.EndTime,
                week,
                true,
                (byte)1,
                DateTime.Now,
                0);

            if (result)
            {
                log.Info("TCPControl AddTimeZone:Success...");
            }
            else
            {
                log.Info("TCPControl AddTimeZone: Fail...");
            }
        }
Ejemplo n.º 4
0
 public void Operate(OperateDeviceCmdEnum cmdCode, Door door)
 {
     bool result = true;
     switch (cmdCode)
     {
         case OperateDeviceCmdEnum.OPEN_DOOR:
             log.Info("Device operate command : open door.  Door number=" + door.DoorNum+" controlID="+control.ControlID);
             result = connector.Opendoor((byte)door.DoorNum);
             break;
         case OperateDeviceCmdEnum.CLOSE_DOOR:
             log.Info("Device operate command : close door.  Door number=" + door.DoorNum + " controlID="+control.ControlID);
             result = connector.Closedoor((byte)door.DoorNum);
             break;
         case OperateDeviceCmdEnum.LOCK_DOOR:
             log.Info("Device operate command : lock door.  Door number=" + door.DoorNum + " controlID=" + control.ControlID);
             result = connector.LockDoor((byte)door.DoorNum, true);
             break;
         case OperateDeviceCmdEnum.UNLOCK_DOOR:
             log.Info("Device operate command : unlock door.  Door number=" + door.DoorNum + " controlID=" + control.ControlID);
             result = connector.LockDoor((byte)door.DoorNum, false);
             break;
         case OperateDeviceCmdEnum.SET_FIRE:
             log.Info("Device operate command : set fire alarm.  controlID=" + control.ControlID);
             result = connector.SetFire(false, false);
             break;
         case OperateDeviceCmdEnum.CACEL_FIRE:
             log.Info("Device operate command : cancel fire alarm.  controlID=" + control.ControlID);
             result = connector.SetFire(true, false);
             break;
         case OperateDeviceCmdEnum.SET_ALARM:
             log.Info("Device operate command : set alarm.  controlID=" + control.ControlID);
             result = connector.SetAlarm(false, false);
             break;
         case OperateDeviceCmdEnum.CACEL_ALARM:
             log.Info("Device operate command : cancel fire alarm.  controlID=" + control.ControlID);
             result = connector.SetAlarm(true, false);
             break;
     }
 }