From fefffbc9451499013b7af2a15fac0ccc3b394364 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 15 四月 2024 16:31:25 +0800
Subject: [PATCH] 去掉Siri先
---
HDL_ON/DAL/DriverLayer/Control_Udp.cs | 182 +++++++++++++++++++++++++++++++++++++++------
1 files changed, 156 insertions(+), 26 deletions(-)
diff --git a/HDL_ON/DAL/DriverLayer/Control_Udp.cs b/HDL_ON/DAL/DriverLayer/Control_Udp.cs
index e6eba3b..7fd1e36 100644
--- a/HDL_ON/DAL/DriverLayer/Control_Udp.cs
+++ b/HDL_ON/DAL/DriverLayer/Control_Udp.cs
@@ -262,12 +262,17 @@
break;
}
break;
+ case FunctionAttributeKey.SetTemp:
+ ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] {
+ modeKey, Convert.ToByte(attr.value), f.localFunction.bus.LoopId });
+ break;
}
ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 3, onoff, f.localFunction.bus.LoopId });
ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 6, mode, f.localFunction.bus.LoopId });
ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 5, fan, f.localFunction.bus.LoopId });
ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { modeKey, modeKey, f.localFunction.bus.LoopId });
- }
+
+ }
break;
case SPK.LightSwitch:
case SPK.LightDimming:
@@ -297,7 +302,8 @@
break;
case SPK.LightRGB:
break;
- case SPK.HvacFloorHeat:case SPK.FloorHeatStandard:
+ case SPK.HvacFloorHeat:
+ case SPK.FloorHeatStandard:
if (f.status.Find((obj)=>obj.key ==FunctionAttributeKey.Mode) == null)
{
foreach (var dic in f.status)
@@ -386,6 +392,27 @@
break;
}
}
+ break;
+ case SPK.OtherCommon://2024-02-01 15:19:28 鍒氬姞鐨勶紝涓嶅彂甯冿紝瀹㈡湇閬囧埌鐨勯棶棰�
+ //foreach (var attr in f.status)
+ //{
+ // if (attr.key == FunctionAttributeKey.OnOff)
+ // {
+ // byte onOffValue = 0;
+ // switch (attr.value)
+ // {
+ // case "on":
+ // onOffValue = 0;
+ // break;
+ // case "off":
+ // onOffValue = 255;
+ // break;
+ // }
+ // ControlBytesSend(Command.SetCommonSwitch, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID,
+ // new byte[] { f.localFunction.bus.LoopId, onOffValue });
+ // break;
+ // }
+ //}
break;
}
}
@@ -547,54 +574,157 @@
}
else
{
- ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { 17, Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Percent)) });
+ if (commandDictionary.ContainsKey(FunctionAttributeKey.Percent))
+ {
+ ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { (byte)(((int)function.bus.LoopId) + 16), Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Percent)) });
+ }
+ else
+ {
+
+ byte tempCurtainState = 0;
+ if (function.trait_on_off.curValue.ToString() == "stop")
+ {
+ tempCurtainState = 0;
+ }
+ else if (function.trait_on_off.curValue.ToString() == "on")
+ {
+ tempCurtainState = 1;
+ }
+ else
+ {
+ tempCurtainState = 2;
+ }
+ ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { function.bus.LoopId, tempCurtainState });
+ }
}
break;
case SPK.AcStandard:
case SPK.HvacAC:
var ac = new AC();
+
+ byte onoff = 0;
+ onoff = function.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0;
+ byte mode = 0;
+ mode = ac.GetModeIndex(function);
+ byte fan = 0;
+ fan = ac.GetFanIndex(function);
+ byte sanfan = 0;
+ byte temp = 16;
+ temp = Convert.ToByte(function.GetAttrState(FunctionAttributeKey.SetTemp));
foreach (var dic in commandDictionary)
{
switch (dic.Key)
{
case FunctionAttributeKey.OnOff:
- ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 3, function.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, function.bus.LoopId });
+ onoff = dic.Value == "on" ? (byte)1 : (byte)0;
+ //ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID,
+ // new byte[] { 3, onoff, function.bus.LoopId });
break;
case "mode":
- ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 6, ac.GetModeIndex(function), function.bus.LoopId });
- break;
- case "fan":
- ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 5, ac.GetFanIndex(function), function.bus.LoopId });
- break;
- case FunctionAttributeKey.SetTemp:
- byte modeKey = 4;
- switch (ac.GetModeIndex(function))
+ switch (dic.Value)
{
- case 3:
- modeKey = 8;
+ case "auto":
+ mode = 3;
break;
- case 0:
- modeKey = 4;
+ case "cool":
+ mode = 0;
break;
- case 1:
- modeKey = 7;
+ case "heat":
+ mode = 1;
break;
- case 4:
- modeKey = 19;
+ case "dry":
+ mode = 4;
break;
- case 2:
- modeKey = 2;
+ case "fan":
+ mode = 2;
+ break;
+ default:
+ mode = 0;
break;
}
- ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] {
- modeKey, Convert.ToByte(function.GetAttrState(FunctionAttributeKey.SetTemp)), function.bus.LoopId });
+ //ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID,
+ // new byte[] { 6, mode, function.bus.LoopId });
+ break;
+ case "fan":
+ switch (dic.Value)
+ {
+ case "high":
+ fan = 1;
+ break;
+ case "medium":
+ fan = 2;
+ break;
+ case "low":
+ fan = 3;
+ break;
+ case "auto":
+ fan = 0;
+ break;
+ default:
+ fan = 0;
+ break;
+ }
+ //ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID,
+ // new byte[] { 5, fan, function.bus.LoopId });
+ break;
+ case FunctionAttributeKey.SetTemp:
+ try
+ {
+ temp = Convert.ToByte(dic.Value);
+ }
+ catch
+ {
+ temp = 16;
+ }
+ //byte modeKey = 4;
+ //switch (ac.GetModeIndex(function))
+ //{
+ // case 3:
+ // modeKey = 8;
+ // break;
+ // case 0:
+ // modeKey = 4;
+ // break;
+ // case 1:
+ // modeKey = 7;
+ // break;
+ // case 4:
+ // modeKey = 19;
+ // break;
+ // case 2:
+ // modeKey = 2;
+ // break;
+ //}
+
+ //ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] {
+ // modeKey, temp, function.bus.LoopId });
+ break;
+ case FunctionAttributeKey.Swing:
+ //sanfan
break;
default:
MainPage.Log($"鍔熻兘鏈敮鎸� : {dic.Key}");
break;
}
}
+ /// 璁剧疆绌鸿皟妯″潡鍛戒护
+ /// 1绌鸿皟鍙�(1-128)
+ ///2娓╁害妯″紡(鎽勬皬Celsius:0锛屽崕姘廎ahrenheit:1)
+ ///3鐜娓╁害 (鎽勬皬0-40锛屽崕姘�32-99)
+ ///4鍒跺喎鎺у埗娓╁害(鎽勬皬0-30锛屽崕姘�32-86)
+ ///5鍒剁儹鎺у埗娓╁害(鎽勬皬0-30锛屽崕姘�32-86)
+ ///6鑷姩鎺у埗娓╁害(鎽勬皬0-30锛屽崕姘�32-86)
+ ///7闄ゆ箍鎺у埗娓╁害(鎽勬皬0-30锛屽崕姘�32-86)
+ ///8妞掔饥鍋堝浣裤伔楂? 楂�4bit妯″紡(0 鍒跺喎锛�1鍒剁儹锛�2閫氶) 浣�4bit椋庨��(0 鑷姩锛�1楂橀?椋庯紝3浣庨)
+ ///9绌鸿皟寮�鍏� (1寮�0鍏�)
+ ///10璁剧疆妯″紡 0 鍒跺喎1鍒剁儹锛�2閫氶锛�3鑷姩锛�4闄ゆ箍
+ ///11璁剧疆椋庨�� 0 鑷姩锛�1楂橀2涓锛�3浣庨
+ ///12宸ヤ綔妯℃帶鍒舵俯鑲氭幃鎽勬皬0-30锛屽崕姘�32-86)
+ ///13鎵妯″紡锛氶珮4bit(瀹為檯鎵鐘舵�侊細0涓嶆壂椋庯紝1鎵)锛屼綆4bit(璁剧疆鎵妯″紡锛�0涓嶆壂椋庯紝1鎵)
+ ControlBytesSend(Command.SetACMode, function.bus.SubnetID, function.bus.DeviceID, new byte[] { function.bus.LoopId,
+ 0,0,0,0,0,0,0,onoff,mode,fan,temp,sanfan});
+
break;
case SPK.HvacFloorHeat:case SPK.FloorHeatStandard:
var fhTemp = new FloorHeating();
@@ -656,8 +786,8 @@
var dicTempString = "";
commandDictionary.TryGetValue("set_temp", out dicTempString);
var dicTemp = Convert.ToByte(dicTempString);
- var mode = function.GetAttrState(FunctionAttributeKey.Mode);
- switch (mode)
+ var mode22 = function.GetAttrState(FunctionAttributeKey.Mode);
+ switch (mode22)
{
case "day":
function.Fh_Mode_Temp["day"] = dicTemp;
--
Gitblit v1.8.0