From 2bec9c838d2d688025698de8ec1de401ffd7dd1f Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 11 八月 2020 14:13:55 +0800
Subject: [PATCH] 20200811
---
HDL_ON/DriverLayer/CommonPage.cs | 174 ++++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 144 insertions(+), 30 deletions(-)
diff --git a/HDL_ON/DriverLayer/CommonPage.cs b/HDL_ON/DriverLayer/CommonPage.cs
index c7f1c2e..d12e95e 100644
--- a/HDL_ON/DriverLayer/CommonPage.cs
+++ b/HDL_ON/DriverLayer/CommonPage.cs
@@ -115,6 +115,7 @@
{
}
+ Control.controlLostCount = 0;
switch (command)
{
@@ -124,7 +125,7 @@
{
if (light.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
{
- if ( light.functionType != FunctionType.RGB)
+ if (light.functionType != FunctionType.RGB)
{
light.on_off = receiveBytes[2] == 0 ? "off" : "on";
if (light.on_off == "on")
@@ -189,7 +190,7 @@
if (rgb.functionType == FunctionType.RGB)
{
rgb.on_off = receiveBytes[1] > 0 ? "on" : "off";
- if (receiveBytes[1] >0)
+ if (receiveBytes[1] > 0)
{
rgb.brightness = receiveBytes[1];
rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%";
@@ -211,38 +212,45 @@
case Command.ReadCurtainStutasACK:
foreach (var curtain in DB_ResidenceData.residenceData.functionList.curtains)
{
- if (curtain.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
+ if (curtain.bus_Data.SubnetID == subnetID && curtain.bus_Data.DeviceID == deviceID)
{
- switch(receiveBytes[1])
+ if (receiveBytes[0] == 17)
{
- case 0:
- curtain.on_off = "stop";
- break;
- case 1:
+ if (receiveBytes[1] > 1)
+ {
curtain.on_off = "on";
- curtain.lastState = Language.StringByID(StringId.Open);
- break;
- case 2:
+ }
+ else
+ {
curtain.on_off = "off";
- curtain.lastState = Language.StringByID(StringId.Close);
- break;
- default:
- if (receiveBytes[1] > 1)
- {
+ }
+ curtain.openLevel = receiveBytes[1];
+ curtain.lastState = Language.StringByID(StringId.Open) + curtain.openLevel + "%";
+ }
+ else
+ {
+ if (curtain.bus_Data.LoopID != receiveBytes[0])
+ continue;
+ switch (receiveBytes[1])
+ {
+ case 0:
+ curtain.on_off = "stop";
+ break;
+ case 1:
curtain.on_off = "on";
- }
- else
- {
+ curtain.lastState = Language.StringByID(StringId.Open);
+ break;
+ case 2:
curtain.on_off = "off";
- }
- curtain.openLevel = receiveBytes[1];
- curtain.lastState = Language.StringByID(StringId.Open) + curtain.openLevel + "%";
- break;
+ curtain.lastState = Language.StringByID(StringId.Close);
+ break;
+ }
}
RoomPage.UpdataStates(curtain);
FunctionPage.UpdataStates(curtain);
HomePage.UpdataFunctionStates(curtain);
ClassificationPage.UpdataInfo(curtain);
+ RollingShutterPage.UpdataState(curtain);
switch (curtain.functionType)
{
case FunctionType.Curtain:
@@ -314,11 +322,11 @@
if (fh.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
{
fh.curTempType = receiveBytes[2];
- fh.on_off = receiveBytes[1] % 2 ==0?"off":"on";
+ fh.on_off = receiveBytes[1] % 2 == 0 ? "off" : "on";
fh.curModeIndex = receiveBytes[3];
if (fh.modeTemp.ContainsKey("ordinary"))
{
- fh.modeTemp["ordinary"]= receiveBytes[4];
+ fh.modeTemp["ordinary"] = receiveBytes[4];
}
else
{
@@ -363,9 +371,10 @@
break;
case "timer":
fh.lastState = Language.StringByID(StringId.Auto);
- if(receiveBytes[8]==0)
+ if (receiveBytes[8] == 0)
{
- }else
+ }
+ else
{
}
break;
@@ -427,11 +436,11 @@
if ((int)sensor.functionType % 256 == receiveBytes[1] && sensor.bus_Data.SubnetID == subnetID &&
sensor.bus_Data.DeviceID == deviceID && sensor.bus_Data.LoopID == receiveBytes[2])
{
- //0淇濈暀 1鏃犵鍙�4Byte鏁村舰 2鏈夌鍙�4Byte鏁村舰 3Float褰紙浠B憋級
+ //0淇濈暀 1鏃犵鍙�4Byte鏁村舰 2鏈夌鍙�4Byte鏁村舰 3Float褰紙浠B憋級
switch (receiveBytes[3])
{
case 1:
- sensor.values = (receiveBytes[5]*256 * 256 * 256)+ (receiveBytes[6] * 256 * 256)+ (receiveBytes[7] * 256)+ receiveBytes[8];
+ sensor.values = (receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8];
break;
case 2:
sensor.values = -1 * ((receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8]);
@@ -441,9 +450,114 @@
sensor.values = Math.Round(BitConverter.ToSingle(tempBytes, 0), 1);
break;
}
+ switch (receiveBytes[4])
+ {
+ case 2:
+ if (receiveBytes[1] == 5)//TVOC闇�姹傞櫎浠�100000
+ sensor.values /= 100000;
+ break;
+ }
EnvironmentalSciencePage.LoadEvent_UpdataStatus(sensor);
}
}
+ }
+ break;
+ case Command.InstructionPanelKeyACK:
+ case Command.ReadInstructionPanelKeyACK:
+ byte reACPanel = 0;
+ if (receiveBytes.Length == 2)
+ {
+ reACPanel = 1;
+ }
+ else if (receiveBytes.Length == 3)
+ {
+ reACPanel = receiveBytes[2];
+ }
+ else
+ {
+ break;
+ }
+ foreach (var ac in DB_ResidenceData.residenceData.functionList.aCs)
+ {
+ if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + reACPanel)
+ {
+ switch (receiveBytes[0])
+ {
+ case 3://
+ ac.on_off = receiveBytes[1] == 1 ? "on" : "off";
+ break;
+ case 4:
+ case 7:
+ case 8:
+ case 19:
+ ac.curTemp = receiveBytes[1];
+ break;
+ case 5:
+ ac.curFanIndex = receiveBytes[1];
+ break;
+ case 6:
+ ac.curModeIndex = receiveBytes[1];
+ break;
+
+ }
+ ac.lastState = "";
+ ac.lastState += " " + ac.curTemp + ac.curTempTypeString;
+ RoomPage.UpdataStates(ac);
+ FunctionPage.UpdataStates(ac);
+ HomePage.UpdataFunctionStates(ac);
+ ClassificationPage.UpdataInfo(ac);
+ ACPage.UpdataStates(ac);
+ //else if (common.Type == DeviceType.FoolHeatPanel)
+ {
+ //switch (receiveBytes[0])
+ //{
+ // case 20://
+ // fh.Status = receiveBytes[1];
+ // break;
+ // case 21:
+ // fh.TemperatureType = receiveBytes[1];
+ // if (receiveBytes[1] == 5)
+ // {
+ // if (fh.Timer == 0)//鏃堕棿妯″紡鐨勬椂闂存鏍囧織 (0锛氱櫧澶╋紝1锛氬鏅�) (1byte) //20110112鍔犳椂闂存鏍囧織
+ // Control.ControlBytesSend(Command.ReadInstructionPanelKey, fh.SubnetID, fh.DeviceID, new byte[] { 26, 2, fh.LoopID }, SendCount.Zero);
+ // else
+ // Control.ControlBytesSend(Command.ReadInstructionPanelKey, fh.SubnetID, fh.DeviceID, new byte[] { 27, 3, fh.LoopID }, SendCount.Zero);
+ // }
+ // else
+ // Control.ControlBytesSend(Command.ReadInstructionPanelKey, fh.SubnetID, fh.DeviceID, new byte[] { (byte)(receiveBytes[1] + 24), fh.LoopID }, SendCount.Zero);
+ // break;
+ // case 25:
+ // fh.NormalTemperature = receiveBytes[1];
+ // break;
+ // case 26:
+ // fh.DayTemperature = receiveBytes[1];
+ // break;
+ // case 27:
+ // fh.NightTemperature = receiveBytes[1];
+ // break;
+ // case 28:
+ // fh.AwayTemperature = receiveBytes[1];
+ // break;
+ //}
+ }
+ }
+ }
+ break;
+ case Command.ReadPanleTempACK://1944
+ case Command.PanleBroadcastTemp:
+ foreach (var ac in DB_ResidenceData.residenceData.functionList.aCs)
+ {
+ if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
+ {
+ ac.indoorTemp = receiveBytes[1];
+ FunctionPage.UpdataStates(ac);
+ }
+ //else if (common.Type == DeviceType.FoolHeatPanel)
+ // {
+ // var tempFH22 = common as FoolHeatPanel;
+ // tempFH22.IndoorTemperature = receiveBytes[1];
+ // UserFHPage.UpdateIndoorTemp(tempFH22.CommonLoopID, receiveBytes[1]);
+ // }
}
break;
}
@@ -477,7 +591,7 @@
string tempFileName = nameValueCollection["Command"].Replace("Get", "");
if ("AllFiles" == tempFileName)
{
- byte[] bytes = Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(FileUtils.ReadFiles()));
+ byte[] bytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(FileUtils.ReadFiles()));
outputStream.Write(bytes, 0, bytes.Length);
outputStream.Flush();
}
--
Gitblit v1.8.0