Пример #1
0
        public static DeviceInfo ToModel(byte[] deviceData)
        {
            var deviceService = new DeviceInfo();

            deviceService.AntiPassbackEnabled = (deviceData[3] == 1);

            deviceService.Services.Add(DoorOpenBehaviorServiceMapper.BuildUnlockOpenService(deviceData[27]));
            deviceService.Services.Add(DuressServiceMapper.BuildService(deviceData));
            deviceService.Services.Add(MultiPersionLockServiceMapper.BuildService(deviceData));
            deviceService.Services.Add(DoorLinkageServiceMapper.BuildService(deviceData));

            var doors = DoorInfoMapper.BuildService(deviceData);

            doors.ForEach(d => deviceService.Services.Add(d));

            return(deviceService);
        }
Пример #2
0
        public static List <DoorInfo> BuildService(byte[] deviceData)
        {
            var doors = new List <DoorInfo>();

            var masterDoor = new DoorInfo();

            masterDoor.Name      = "门一";
            masterDoor.DoorIndex = 1;
            masterDoor.DoorType  = DoorType.Master;
            //masterDoor.ElectricalAppliances = 0;
            //masterDoor.CheckOutAction = CheckOutOptions.Button;
            //masterDoor.AlertType = 0;
            //masterDoor.Remark = "";

            masterDoor.Services.Add(DoorOpenBehaviorServiceMapper.BuildDelayOpenService(deviceData[16]));
            masterDoor.Services.Add(DoorOpenBehaviorServiceMapper.BuildOverTimeOpenService(deviceData[18]));
            masterDoor.Services.Add(DoorOpenBehaviorServiceMapper.BuildIllegalOpenService(deviceData[19]));
            masterDoor.Services.Add(DoorOpenBehaviorServiceMapper.BuildUnlockOpenService(deviceData[27]));
            masterDoor.Services.Add(DuressServiceMapper.BuildService(deviceData));

            doors.Add(masterDoor);

            var slaveDoor = new DoorInfo();

            slaveDoor.Name      = "门二";
            slaveDoor.DoorIndex = 2;
            slaveDoor.DoorType  = DoorType.Slave;
            //slaveDoor.ElectricalAppliances = 0;
            //slaveDoor.CheckOutAction = CheckOutOptions.Button;
            //slaveDoor.AlertType = 0;
            //slaveDoor.Remark = "";

            slaveDoor.Services.Add(DoorOpenBehaviorServiceMapper.BuildDelayOpenService(deviceData[20]));
            slaveDoor.Services.Add(DoorOpenBehaviorServiceMapper.BuildOverTimeOpenService(deviceData[22]));
            slaveDoor.Services.Add(DoorOpenBehaviorServiceMapper.BuildIllegalOpenService(deviceData[23]));
            slaveDoor.Services.Add(DoorOpenBehaviorServiceMapper.BuildUnlockOpenService(deviceData[28]));
            slaveDoor.Services.Add(DuressServiceMapper.BuildService(deviceData));
            doors.Add(slaveDoor);

            return(doors);
        }