From cda2410f9c29f2fadc16e9de38ccae95b75a89dd Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 09 六月 2021 10:51:13 +0800
Subject: [PATCH] 1

---
 HDL_ON/Entity/Function/TV.cs |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/HDL_ON/Entity/Function/TV.cs b/HDL_ON/Entity/Function/TV.cs
index 01166b3..8dde74a 100644
--- a/HDL_ON/Entity/Function/TV.cs
+++ b/HDL_ON/Entity/Function/TV.cs
@@ -1,10 +1,29 @@
 锘縰sing System;
+using HDL_ON.DriverLayer;
+
 namespace HDL_ON.Entity
 {
-    public class TV : Function
+    public class TV 
     {
         public TV()
         {
         }
+
+        public void ControlTV(InfraredCode_TV iCode,Function function)
+        {
+            int RandKey = new Random().Next(0, 255);
+            var textByte = (byte)iCode;
+            new Control_Udp().ControlBytesSend(Command.InfraredControl, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 1, function.bus.LoopId, textByte, 0, 0, (byte)RandKey }, 0);
+        }
+        public void ControlTV(int number,Function function)
+        {
+            int RandKey = new Random().Next(0, 255);
+            var textByte = (byte)(number + 7);
+            if (number == 0)
+            {
+                textByte = 18;
+            }
+            new Control_Udp().ControlBytesSend(Command.InfraredControl, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 1, function.bus.LoopId, textByte, 0, 0, (byte)RandKey }, 0);
+        }
     }
 }

--
Gitblit v1.8.0