Beispiel #1
0
        public bool AddOrModifyAuthority(Controller controller, string hexCardNum, DateTime startTime, DateTime endTime, Dictionary <int, int> doorNumAuthorities, int password = 0)
        {
            WGPacket packet = new WGPacket(0x50);

            packet.SetDevSn(controller.sn);
            // hexCardNum = DataHelper.ToWGAccessCardNo(hexCardNum);
            packet.SetCardNum(hexCardNum);
            packet.SetAuthoriTimeTime(startTime, endTime);
            if (controller.doorType == ControllerDoorType.Elevator)
            {
                packet.SetAuthoriElevator(doorNumAuthorities);
            }
            else
            {
                packet.SetAuthoriDoors(doorNumAuthorities);
            }

            packet.SetAuthoriPassword(password);

            DoSend(packet, controller.ip, controller.port);
            List <WGPacket> packets = WGRecievePacketAddClose(1);

            if (packets.Count == 1)
            {
                return(packets[0].data[0] == 1);
            }
            return(false);
        }