wei
2020-12-01 8983da138cb92e35b0bbeaece1cf1c454a5a79d4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using HDL_ON.DriverLayer;
 
namespace HDL_ON.Entity
{
    public class TV : Function
    {
        public TV()
        {
            trait_on_off.curValue = "off";
        }
 
        public void ControlTV(InfraredCode_TV iCode)
        {
            int RandKey = new Random().Next(0, 255);
            var textByte = (byte)iCode;
            Control.Ins.myUdp.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.Ins.myUdp.ControlBytesSend(Command.InfraredControl, bus_Data.SubnetID, bus_Data.DeviceID, new byte[] { 1, bus_Data.loopId, textByte, 0, 0, (byte)RandKey }, 0);
        }
    }
}