陈嘉乐
2020-10-13 611786df5108dca0bdcff03834cc285cba4b8e61
HDL_ON/Entity/Function/TV.cs
@@ -5,6 +5,24 @@
    {
        public TV()
        {
            on_off = "off";
        }
        public void ControlTV(InfraredCode_TV iCode)
        {
            int RandKey = new Random().Next(0, 255);
            var textByte = (byte)iCode;
            Control.ControlBytesSend(Command.InfraredControl, bus_Data.SubnetID, bus_Data.DeviceID, new byte[] { 1, bus_Data.LoopID, textByte, 0, 0, (byte)RandKey }, 0);
        }
        public void ControlTV(int number)
        {
            int RandKey = new Random().Next(0, 255);
            var textByte = (byte)(number + 7);
            if (number == 0)
            {
                textByte = 18;
            }
            Control.ControlBytesSend(Command.InfraredControl, bus_Data.SubnetID, bus_Data.DeviceID, new byte[] { 1, bus_Data.LoopID, textByte, 0, 0, (byte)RandKey },0);
        }
    }
}