From b69d7735274b8d0f741da8a6bb8b8e1347477a5a Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 19 三月 2020 17:14:16 +0800
Subject: [PATCH] 20200319
---
HDL_ON/DAL/Net/CommonPage.cs | 53 ++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 42 insertions(+), 11 deletions(-)
diff --git a/HDL_ON/DAL/Net/CommonPage.cs b/HDL_ON/DAL/Net/CommonPage.cs
index fb27540..3ef5e1b 100644
--- a/HDL_ON/DAL/Net/CommonPage.cs
+++ b/HDL_ON/DAL/Net/CommonPage.cs
@@ -109,34 +109,65 @@
if (function.functionCategory == FunctionType.Light)
{
var light = function as Light;
- if (receiveBytes[2] == 0 && light.state == 0)
- {
- break;
- }
- if (receiveBytes[2] == 100 && light.state == 1)
+ if (receiveBytes[2] == 0 && light.on_off == 0)
{
break;
}
if (function.functionType == "Relay")
{
var relay = function as Light;
- relay.state = receiveBytes[2] == 0 ? 0 : 1;
+ relay.on_off = receiveBytes[2] == 0 ? 0 : 1;
HomePage.UpdataLightView(relay);
}
- else if (function.functionType == "brightness")
+ else if (function.functionType == "Dimmer")
{
var dimmer = function as Light;
- dimmer.state = receiveBytes[2] == 0 ? 0 : 1;
- dimmer.dicPropert["brightness"] = receiveBytes[1];
- //dimmer.brightness = receiveBytes[1];
- if (receiveBytes[2] > 0)
+ dimmer.on_off = receiveBytes[2] == 0 ? 0 : 1;
+ if (dimmer.on_off == 1)
+ {
+ dimmer.brightness = receiveBytes[2];
dimmer.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[2] + "%";
+ }
HomePage.UpdataLightView(dimmer);
+ RoomPage.UpdataStates(dimmer);
+ FunctionPage.UpdataStates(dimmer);
+ DimmerPage.UpdataStates(dimmer);
}
}
}
}
break;
+ case Command.SetLogicLoopColorACK:
+ foreach (var function in DB_ResidenceData.residenceData.functionList.lights)
+ {
+ if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
+ {
+ if (function.functionType == "RGB")
+ {
+ var light = function as Light;
+ if (receiveBytes[2] == 0 && light.on_off == 0)
+ {
+ break;
+ }
+ var rgb = function as Light;
+ rgb.on_off = receiveBytes[1] == 0 ? 0 : 1;
+ if (rgb.on_off == 1)
+ {
+ rgb.brightness = receiveBytes[1];
+ rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%";
+ }
+ rgb.redColor = receiveBytes[6];
+ rgb.greenColor = receiveBytes[7];
+ rgb.blueColor = receiveBytes[8];
+
+ HomePage.UpdataLightView(rgb);
+ RoomPage.UpdataStates(rgb);
+ FunctionPage.UpdataStates(rgb);
+ RGBPage.UpdataStates(rgb);
+ }
+ }
+ }
+ break;
}
}
catch (Exception ex)
--
Gitblit v1.8.0