Ejemplo n.º 1
0
        public bool SetControllerTime(Controller controller, DateTime dateTime)
        {
            WGPacket packet = new WGPacket(0x30);

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

            if (packets.Count == 1)
            {
                DateTime dt = packets[0].ToDateTime();
                return(dt.Year == dateTime.Year &&
                       dt.Month == dateTime.Month &&
                       dt.Day == dateTime.Day &&
                       dt.Hour == dateTime.Hour &&
                       dt.Minute == dateTime.Minute &&
                       dt.Second == dateTime.Second);
            }
            return(false);
        }