| | |
| | | { |
| | | ddd += bb + ","; |
| | | } |
| | | MainPage.Log(ddd); |
| | | MainPage.Log($"bus命令:"+ ((int)command) + " : 数据:" + ddd); |
| | | #endif |
| | | //处理是否要重发数据 |
| | | ManagerReceive(subnetID, deviceID, command, usefulBytes); |
| | |
| | | { |
| | | case Command.SetSingleLightACK: |
| | | var queryList = new List<Function>(); |
| | | queryList.AddRange(FunctionList.List.electricals); |
| | | queryList.AddRange(FunctionList.List.lights); |
| | | queryList.AddRange(FunctionList.List.GetElectricals()); |
| | | queryList.AddRange(FunctionList.List.GetLightList()); |
| | | foreach (var updataObj in queryList) |
| | | { |
| | | if (updataObj.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | |
| | | switch (updataObj.spk) |
| | | { |
| | | case SPK.ElectricFan: |
| | | (updataObj as Fan).openLevel = receiveBytes[2]; |
| | | updataObj.SetAttrState(FunctionAttributeKey.OpenLevel, receiveBytes[2].ToString()); |
| | | updataObj.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2]; |
| | | break; |
| | | case SPK.LightDimming: |
| | | (updataObj as Light).brightness = receiveBytes[2]; |
| | | updataObj.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[2].ToString()); |
| | | updataObj.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[2] + "%"; |
| | | break; |
| | | } |
| | |
| | | switch (updataObj.spk) |
| | | { |
| | | case SPK.LightSwitch: |
| | | RelayPage.UpdataState(updataObj as Light); |
| | | RelayPage.UpdataState(updataObj); |
| | | break; |
| | | case SPK.LightDimming: |
| | | DimmerPage.UpdataStates(updataObj as Light); |
| | | DimmerPage.UpdataStates(updataObj); |
| | | break; |
| | | case SPK.ElectricFan: |
| | | FanPage.UpdataState(updataObj as Fan); |
| | | FanPage.UpdataState(updataObj); |
| | | break; |
| | | } |
| | | break; |
| | |
| | | case Command.ReadLightAllLoopBrightnessACK: |
| | | for (int i = 0; i < receiveBytes[0]; i++) |
| | | { |
| | | var light = FunctionList.List.lights.Find((obj) => obj.bus.SubnetID == subnetID && obj.bus.DeviceID == deviceID && obj.bus.LoopId == (i + 1)); |
| | | var light = FunctionList.List.GetLightList().Find((obj) => obj.bus.SubnetID == subnetID && obj.bus.DeviceID == deviceID && obj.bus.LoopId == (i + 1)); |
| | | if (light != null) |
| | | { |
| | | if (light.spk != SPK.LightRGB) |
| | |
| | | light.trait_on_off.curValue = receiveBytes[light.bus.LoopId] == 0 ? "off" : "on"; |
| | | if (light.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | light.brightness = receiveBytes[2]; |
| | | light.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[2].ToString()); |
| | | light.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[2] + "%"; |
| | | } |
| | | HomePage.UpdataFunctionStates(light); |
| | |
| | | } |
| | | else |
| | | { |
| | | var e = FunctionList.List.electricals.Find((obj) => obj.bus.SubnetID == subnetID && obj.bus.DeviceID == deviceID && obj.bus.LoopId == i); |
| | | if (e != null) |
| | | var function = FunctionList.List.GetElectricals().Find((obj) => obj.bus.SubnetID == subnetID && obj.bus.DeviceID == deviceID && obj.bus.LoopId == i); |
| | | if (function != null) |
| | | { |
| | | var fan = e as Fan; |
| | | fan.trait_on_off.curValue = receiveBytes[2] == 0 ? "off" : "on"; |
| | | if (fan.trait_on_off.curValue.ToString() == "on") |
| | | function.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[2] == 0 ? "off" : "on"); |
| | | if (function.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | | fan.openLevel = receiveBytes[2]; |
| | | fan.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2]; |
| | | function.SetAttrState(FunctionAttributeKey.OpenLevel, receiveBytes[2].ToString()); |
| | | function.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2]; |
| | | } |
| | | HomePage.UpdataFunctionStates(fan); |
| | | RoomPage.UpdataStates(fan); |
| | | FunctionPage.UpdataStates(fan); |
| | | ClassificationPage.UpdataInfo(fan); |
| | | switch (fan.spk) |
| | | HomePage.UpdataFunctionStates(function); |
| | | RoomPage.UpdataStates(function); |
| | | FunctionPage.UpdataStates(function); |
| | | ClassificationPage.UpdataInfo(function); |
| | | switch (function.spk) |
| | | { |
| | | case SPK.ElectricFan: |
| | | FanPage.UpdataState(fan); |
| | | FanPage.UpdataState(function); |
| | | break; |
| | | case SPK.ElectricSocket: |
| | | |
| | | SocketPage.UpdataState(function); |
| | | break; |
| | | } |
| | | } |
| | |
| | | break; |
| | | case Command.SetLogicLoopColorACK: |
| | | case Command.ReadLogicLoopColorACK: |
| | | foreach (var rgb in FunctionList.List.lights) |
| | | foreach (var rgb in FunctionList.List.GetLightList()) |
| | | { |
| | | if (rgb.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | |
| | | rgb.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off"; |
| | | if (receiveBytes[1] > 0) |
| | | { |
| | | rgb.brightness = receiveBytes[1]; |
| | | rgb.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString()); |
| | | rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%"; |
| | | } |
| | | rgb.SetRGBcolor(new byte[] { receiveBytes[6], receiveBytes[7], receiveBytes[8] }); |
| | | new Light().SetRGBcolor(new byte[] { receiveBytes[6], receiveBytes[7], receiveBytes[8] }, rgb); |
| | | |
| | | HomePage.UpdataFunctionStates(rgb); |
| | | RoomPage.UpdataStates(rgb); |
| | |
| | | break; |
| | | case Command.SetCurtainModelStutasACK: |
| | | case Command.ReadCurtainStutasACK: |
| | | foreach (var curtain in FunctionList.List.curtains) |
| | | foreach (var curtain in FunctionList.List.GetCurtainList()) |
| | | { |
| | | if (curtain.bus.SubnetID == subnetID && curtain.bus.DeviceID == deviceID) |
| | | { |
| | |
| | | { |
| | | curtain.trait_on_off.curValue = "off"; |
| | | } |
| | | curtain.percent = receiveBytes[1]; |
| | | curtain.lastState = Language.StringByID(StringId.Open) + curtain.percent + "%"; |
| | | curtain.SetAttrState(FunctionAttributeKey.Percent, receiveBytes[1].ToString()); |
| | | curtain.lastState = Language.StringByID(StringId.Open) + curtain.GetAttrState(FunctionAttributeKey.Percent) + "%"; |
| | | } |
| | | else |
| | | { |
| | |
| | | break; |
| | | case Command.SetACModeACK: |
| | | case Command.ReadACModeACK: |
| | | foreach (var ac in FunctionList.List.aCs) |
| | | foreach (var function in FunctionList.List.GetAcList()) |
| | | { |
| | | if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | var acFunction = new AC(); |
| | | if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | ac.curTempType = receiveBytes[1]; |
| | | ac.trait_IndoorTemp.curValue = receiveBytes[2].ToString(); |
| | | ac.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off"; |
| | | ac.curModeIndex = receiveBytes[9]; |
| | | ac.curFanIndex = receiveBytes[10]; |
| | | ac.trait_temp.curValue = receiveBytes[11].ToString(); |
| | | ac.lastState = ""; |
| | | switch (ac.trait_mode.curValue.ToString()) |
| | | function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[1].ToString()); |
| | | function.SetAttrState(FunctionAttributeKey.RoomTemp, receiveBytes[2].ToString()); |
| | | function.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off"; |
| | | acFunction.SetMode(receiveBytes[9],function); |
| | | acFunction.SetFan(receiveBytes[10],function); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[11].ToString()); |
| | | function.lastState = ""; |
| | | switch (function.GetAttrState(FunctionAttributeKey.Mode)) |
| | | { |
| | | case "cool": |
| | | ac.lastState = Language.StringByID(StringId.Cool); |
| | | function.lastState = Language.StringByID(StringId.Cool); |
| | | break; |
| | | case "heat": |
| | | ac.lastState = Language.StringByID(StringId.Heat); |
| | | function.lastState = Language.StringByID(StringId.Heat); |
| | | break; |
| | | case "dry": |
| | | ac.lastState = Language.StringByID(StringId.Dry); |
| | | function.lastState = Language.StringByID(StringId.Dry); |
| | | break; |
| | | case "auto": |
| | | ac.lastState = Language.StringByID(StringId.Auto); |
| | | function.lastState = Language.StringByID(StringId.Auto); |
| | | break; |
| | | case "fan": |
| | | ac.lastState = Language.StringByID(StringId.AirSupply); |
| | | function.lastState = Language.StringByID(StringId.AirSupply); |
| | | break; |
| | | } |
| | | switch (ac.trait_fan.curValue.ToString()) |
| | | switch (function.GetAttrState(FunctionAttributeKey.FanSpeed)) |
| | | { |
| | | case "high": |
| | | ac.lastState += " " + Language.StringByID(StringId.HighWindSpeed); |
| | | function.lastState += " " + Language.StringByID(StringId.HighWindSpeed); |
| | | break; |
| | | case "medium": |
| | | ac.lastState += " " + Language.StringByID(StringId.MiddleWindSpeed); |
| | | function.lastState += " " + Language.StringByID(StringId.MiddleWindSpeed); |
| | | break; |
| | | case "low": |
| | | ac.lastState += " " + Language.StringByID(StringId.LowWindSpeed); |
| | | function.lastState += " " + Language.StringByID(StringId.LowWindSpeed); |
| | | break; |
| | | case "auto": |
| | | ac.lastState += " " + Language.StringByID(StringId.Auto); |
| | | function.lastState += " " + Language.StringByID(StringId.Auto); |
| | | break; |
| | | } |
| | | ac.lastState += " " + ac.trait_temp.curValue + ac.tempUnitString; |
| | | RoomPage.UpdataStates(ac); |
| | | FunctionPage.UpdataStates(ac); |
| | | HomePage.UpdataFunctionStates(ac); |
| | | ClassificationPage.UpdataInfo(ac); |
| | | ACPage.UpdataStates(ac); |
| | | function.lastState += " " + function.GetAttrState(FunctionAttributeKey.SetTemp) + acFunction.GetTempUnitString(function); |
| | | RoomPage.UpdataStates(function); |
| | | FunctionPage.UpdataStates(function); |
| | | HomePage.UpdataFunctionStates(function); |
| | | ClassificationPage.UpdataInfo(function); |
| | | ACPage.UpdataStates(function); |
| | | } |
| | | } |
| | | break; |
| | | case Command.ReadFloorHeatACK: |
| | | case Command.SetFloorHeatACK: |
| | | foreach (var fh in FunctionList.List.floorHeatings) |
| | | foreach (var function in FunctionList.List.GetFloorHeatingList()) |
| | | { |
| | | if (fh.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | fh.curTempType = receiveBytes[2]; |
| | | fh.trait_on_off.curValue = receiveBytes[1] % 2 == 0 ? "off" : "on"; |
| | | fh.curModeIndex = receiveBytes[3]; |
| | | if (fh.modeTemp.ContainsKey("normal")) |
| | | { |
| | | fh.modeTemp["normal"] = receiveBytes[4]; |
| | | } |
| | | else |
| | | { |
| | | fh.modeTemp.Add("normal", receiveBytes[4]); |
| | | } |
| | | if (fh.modeTemp.ContainsKey("day")) |
| | | { |
| | | fh.modeTemp["day"] = receiveBytes[5]; |
| | | } |
| | | else |
| | | { |
| | | fh.modeTemp.Add("day", receiveBytes[5]); |
| | | } |
| | | if (fh.modeTemp.ContainsKey("night")) |
| | | { |
| | | fh.modeTemp["night"] = receiveBytes[6]; |
| | | } |
| | | else |
| | | { |
| | | fh.modeTemp.Add("night", receiveBytes[6]); |
| | | } |
| | | if (fh.modeTemp.ContainsKey("away")) |
| | | { |
| | | fh.modeTemp["away"] = receiveBytes[7]; |
| | | } |
| | | else |
| | | { |
| | | fh.modeTemp.Add("away", receiveBytes[7]); |
| | | } |
| | | function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[2]); |
| | | function.trait_on_off.curValue = receiveBytes[1] % 2 == 0 ? "off" : "on"; |
| | | new FloorHeating().SetModeIndex(receiveBytes[3],function); |
| | | |
| | | switch (fh.trait_mode.curValue) |
| | | if (function.Fh_Mode_Temp.ContainsKey("normal")) |
| | | { |
| | | case "normal": |
| | | fh.lastState = Language.StringByID(StringId.Normal); |
| | | fh.trait_temp.curValue = receiveBytes[4].ToString(); |
| | | break; |
| | | case "day": |
| | | fh.lastState = Language.StringByID(StringId.Day); |
| | | fh.trait_temp.curValue = receiveBytes[5].ToString(); |
| | | break; |
| | | case "night": |
| | | fh.lastState = Language.StringByID(StringId.Night); |
| | | fh.trait_temp.curValue = receiveBytes[6].ToString(); |
| | | break; |
| | | case "timer": |
| | | fh.lastState = Language.StringByID(StringId.Auto); |
| | | if (receiveBytes[8] == 0) |
| | | { |
| | | fh.timeFlag = 0; |
| | | fh.trait_temp.curValue = receiveBytes[5].ToString(); |
| | | } |
| | | else |
| | | { |
| | | fh.timeFlag = 1; |
| | | fh.trait_temp.curValue = receiveBytes[6].ToString(); |
| | | } |
| | | break; |
| | | case "away": |
| | | fh.trait_temp.curValue = receiveBytes[7].ToString(); |
| | | fh.lastState = Language.StringByID(StringId.Away); |
| | | break; |
| | | function.Fh_Mode_Temp["normal"] = receiveBytes[4]; |
| | | } |
| | | else |
| | | { |
| | | function.Fh_Mode_Temp.Add("normal", receiveBytes[4]); |
| | | } |
| | | if (function.Fh_Mode_Temp.ContainsKey("day")) |
| | | { |
| | | function.Fh_Mode_Temp["day"] = receiveBytes[5]; |
| | | } |
| | | else |
| | | { |
| | | function.Fh_Mode_Temp.Add("day", receiveBytes[5]); |
| | | } |
| | | if (function.Fh_Mode_Temp.ContainsKey("night")) |
| | | { |
| | | function.Fh_Mode_Temp["night"] = receiveBytes[6]; |
| | | } |
| | | else |
| | | { |
| | | function.Fh_Mode_Temp.Add("night", receiveBytes[6]); |
| | | } |
| | | if (function.Fh_Mode_Temp.ContainsKey("away")) |
| | | { |
| | | function.Fh_Mode_Temp["away"] = receiveBytes[7]; |
| | | } |
| | | else |
| | | { |
| | | function.Fh_Mode_Temp.Add("away", receiveBytes[7]); |
| | | } |
| | | if (function.GetAttribute(FunctionAttributeKey.Mode) == null) |
| | | { |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[4].ToString()); |
| | | } |
| | | else |
| | | { |
| | | switch (function.GetAttrState(FunctionAttributeKey.Mode)) |
| | | { |
| | | case "normal": |
| | | function.lastState = Language.StringByID(StringId.Normal); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[4].ToString()); |
| | | break; |
| | | case "day": |
| | | function.lastState = Language.StringByID(StringId.Day); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[5].ToString()); |
| | | break; |
| | | case "night": |
| | | function.lastState = Language.StringByID(StringId.Night); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[6].ToString()); |
| | | break; |
| | | case "timer": |
| | | function.lastState = Language.StringByID(StringId.Auto); |
| | | if (receiveBytes[8] == 0) |
| | | { |
| | | function.SetAttrState(FunctionAttributeKey.TimeFlag, 0); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[5].ToString()); |
| | | } |
| | | else |
| | | { |
| | | function.SetAttrState(FunctionAttributeKey.TimeFlag, 1); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[6].ToString()); |
| | | } |
| | | break; |
| | | case "away": |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[7].ToString()); |
| | | function.lastState = Language.StringByID(StringId.Away); |
| | | break; |
| | | } |
| | | } |
| | | var indoorTemp = 0; |
| | | if (receiveBytes[9] > 128) |
| | | { |
| | | indoorTemp = 1 - (receiveBytes[9] - 128); |
| | | }else |
| | | { |
| | | indoorTemp = receiveBytes[9]; |
| | | } |
| | | function.SetAttrState(FunctionAttributeKey.RoomTemp, indoorTemp); |
| | | |
| | | fh.trait_IndoorTemp.curValue = receiveBytes[9] > 128 ? (1 - (receiveBytes[9] - 128)) : receiveBytes[9]; |
| | | |
| | | fh.lastState += " " + fh.trait_temp.curValue + fh.tempUnitString; |
| | | RoomPage.UpdataStates(fh); |
| | | FunctionPage.UpdataStates(fh); |
| | | HomePage.UpdataFunctionStates(fh); |
| | | ClassificationPage.UpdataInfo(fh); |
| | | FloorHeatingPage.UpdataStates(fh); |
| | | if (function.GetAttribute(FunctionAttributeKey.Mode) == null) |
| | | { |
| | | function.lastState = ""; |
| | | } |
| | | else |
| | | { |
| | | function.lastState += " " + function.GetAttrState(FunctionAttributeKey.Mode) + new FloorHeating().GetTempUnitString(function); |
| | | } |
| | | RoomPage.UpdataStates(function); |
| | | FunctionPage.UpdataStates(function); |
| | | HomePage.UpdataFunctionStates(function); |
| | | ClassificationPage.UpdataInfo(function); |
| | | FloorHeatingPage.UpdataStates(function); |
| | | } |
| | | } |
| | | break; |
| | | case Command.ReadDeviceLoopInfoACK: |
| | | //FunctionType dt = (FunctionType)(11 * 256 + receiveBytes[1]); |
| | | string tag = receiveBytes[1] + "_" + subnetID + "_" + deviceID + "_" + receiveBytes[2]; |
| | | foreach (var sensor in FunctionList.List.sensorsEnvironmentalScience) |
| | | foreach (var sensor in FunctionList.List.GetEnvirSensorsList()) |
| | | { |
| | | byte sensorType = 0; |
| | | switch (sensor.spk) |
| | |
| | | { |
| | | case SPK.SensorTemperature: |
| | | byte[] tempBytes = new byte[] { receiveBytes[24], receiveBytes[25], receiveBytes[26], receiveBytes[27] }; |
| | | sensor.values = Math.Round(BitConverter.ToSingle(tempBytes, 0), 1); |
| | | sensor.SetAttrState(FunctionAttributeKey.Value,Math.Round(BitConverter.ToSingle(tempBytes, 0), 1).ToString()); |
| | | break; |
| | | case SPK.SensorHumidity: |
| | | sensor.values = Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 10; |
| | | sensor.SetAttrState(FunctionAttributeKey.Value, (Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 10).ToString()); |
| | | break; |
| | | case SPK.SensorTVOC: |
| | | sensor.values = Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 100; |
| | | sensor.SetAttrState(FunctionAttributeKey.Value, (Convert.ToDouble(receiveBytes[24] * 256 + receiveBytes[25]) / 100).ToString()); |
| | | break; |
| | | case SPK.SensorPm25: |
| | | sensor.values = Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]); |
| | | sensor.SetAttrState(FunctionAttributeKey.Value,Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]).ToString()); |
| | | break; |
| | | case SPK.SensorCO2: |
| | | sensor.values = Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]); |
| | | sensor.SetAttrState(FunctionAttributeKey.Value, Convert.ToInt32(receiveBytes[24] * 256 + receiveBytes[25]).ToString()); |
| | | break; |
| | | } |
| | | EnvironmentalSciencePage.LoadEvent_UpdataStatus(sensor); |
| | | EnvironmentalPage.LoadEvent_UpdataStatus(sensor); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Command.New_Analog_Quantity_BROADCAST: |
| | | string tag1 = receiveBytes[1] + "_" + subnetID + "_" + deviceID + "_" + receiveBytes[2]; |
| | | foreach (var sensor in FunctionList.List.sensorsEnvironmentalScience) |
| | | foreach (var sensor in FunctionList.List.GetEnvirSensorsList()) |
| | | { |
| | | byte sensorType = 0; |
| | | switch (sensor.spk) |
| | |
| | | switch (receiveBytes[3]) |
| | | { |
| | | case 1: |
| | | sensor.values = (receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8]; |
| | | sensor.SetAttrState(FunctionAttributeKey.Value,( (receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8]).ToString()); |
| | | break; |
| | | case 2: |
| | | sensor.values = -1 * ((receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8]); |
| | | sensor.SetAttrState(FunctionAttributeKey.Value,( -1 * ((receiveBytes[5] * 256 * 256 * 256) + (receiveBytes[6] * 256 * 256) + (receiveBytes[7] * 256) + receiveBytes[8])).ToString()); |
| | | break; |
| | | case 3: |
| | | byte[] tempBytes = new byte[] { receiveBytes[5], receiveBytes[6], receiveBytes[7], receiveBytes[8] }; |
| | | sensor.values = Math.Round(BitConverter.ToSingle(tempBytes, 0), 1); |
| | | sensor.SetAttrState(FunctionAttributeKey.Value,( Math.Round(BitConverter.ToSingle(tempBytes, 0), 1)).ToString()); |
| | | break; |
| | | } |
| | | switch (receiveBytes[4]) |
| | | { |
| | | case 2: |
| | | if (receiveBytes[1] == 5)//TVOC需求除以100000 |
| | | sensor.values /= 100000; |
| | | { |
| | | var value = Convert.ToInt32(sensor.GetAttrState(FunctionAttributeKey.Value)); |
| | | sensor.SetAttrState(FunctionAttributeKey.Value, (value /= 100000).ToString()); |
| | | } |
| | | break; |
| | | } |
| | | EnvironmentalSciencePage.LoadEvent_UpdataStatus(sensor); |
| | | EnvironmentalPage.LoadEvent_UpdataStatus(sensor); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | break; |
| | | } |
| | | foreach (var ac in FunctionList.List.aCs) |
| | | foreach (var function in FunctionList.List.GetAcList()) |
| | | { |
| | | if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + reACPanel) |
| | | var acFunction = new AC(); |
| | | if (function.GetBusId() == subnetID + "_" + deviceID + "_" + reACPanel) |
| | | { |
| | | switch (receiveBytes[0]) |
| | | { |
| | | case 3:// |
| | | ac.trait_on_off.curValue = receiveBytes[1] == 1 ? "on" : "off"; |
| | | function.trait_on_off.curValue = receiveBytes[1] == 1 ? "on" : "off"; |
| | | break; |
| | | case 4: |
| | | case 7: |
| | | case 8: |
| | | case 19: |
| | | ac.trait_temp.curValue = receiveBytes[1].ToString(); |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[1].ToString()); |
| | | break; |
| | | case 5: |
| | | ac.curFanIndex = receiveBytes[1]; |
| | | acFunction.SetFan ( receiveBytes[1],function); |
| | | break; |
| | | case 6: |
| | | ac.curModeIndex = receiveBytes[1]; |
| | | acFunction.SetMode ( receiveBytes[1],function); |
| | | break; |
| | | |
| | | } |
| | | ac.lastState = ""; |
| | | ac.lastState += " " + ac.trait_temp.curValue + ac.tempUnitString; |
| | | RoomPage.UpdataStates(ac); |
| | | FunctionPage.UpdataStates(ac); |
| | | HomePage.UpdataFunctionStates(ac); |
| | | ClassificationPage.UpdataInfo(ac); |
| | | ACPage.UpdataStates(ac); |
| | | function.lastState = ""; |
| | | function.lastState += " " + function.GetAttrState(FunctionAttributeKey.SetTemp) + acFunction.GetTempUnitString(function); |
| | | RoomPage.UpdataStates(function); |
| | | FunctionPage.UpdataStates(function); |
| | | HomePage.UpdataFunctionStates(function); |
| | | ClassificationPage.UpdataInfo(function); |
| | | ACPage.UpdataStates(function); |
| | | } |
| | | } |
| | | break; |
| | | case Command.ReadPanleTempACK://1944 |
| | | case Command.PanleBroadcastTemp: |
| | | foreach (var ac in FunctionList.List.aCs) |
| | | foreach (var ac in FunctionList.List.GetAcList()) |
| | | { |
| | | if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | ac.trait_IndoorTemp.curValue = receiveBytes[1].ToString(); |
| | | ac.SetAttrState(FunctionAttributeKey.RoomTemp, receiveBytes[1].ToString()); |
| | | FunctionPage.UpdataStates(ac); |
| | | } |
| | | } |
| | |
| | | Control.Ins.IsSearchLocalGatewaySuccessful = true; |
| | | Control.Ins.GatewayOnline_Local = true; |
| | | DAL.Mqtt.MqttClient.DisConnectRemote();//断开mqtt |
| | | } |
| | | break; |
| | | case Command.FreshAirControlACK_JinMao: |
| | | case Command.FreshAirReadACK_JinMao: |
| | | var airFresh = FunctionList.List.GetAirFreshList().Find((obj) => obj.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]); |
| | | if (airFresh != null) |
| | | { |
| | | /// 3 开关 0-关机,1-开机 |
| | | /// 4 运行模式 1-通风,2-加湿 humidification/fan |
| | | /// 5 节能舒适选择 1-舒适,2-节能 true/false |
| | | /// 6 风速档位 0-自动,1-1档,2-2档,3-3档 level_1/level_2/level_3/auto |
| | | /// 7 湿度设定 % |
| | | /// 8 室内温度值 ℃ |
| | | /// 9 室内湿度值 ℃ |
| | | /// 10 过滤网剩余 % |
| | | /// 11 过滤网使用超时 1 超时 0 无 true/false |
| | | airFresh.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[2] == 0 ? "off" : "on"); |
| | | airFresh.SetAttrState(FunctionAttributeKey.Mode, receiveBytes[3] == 1 ? "fan" : "humidification"); |
| | | airFresh.SetAttrState(FunctionAttributeKey.Energy, receiveBytes[4] == 1 ? "false" : "true"); |
| | | switch (receiveBytes[5]) |
| | | { |
| | | case 0: |
| | | airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "auto"); |
| | | break; |
| | | case 1: |
| | | airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "level_1"); |
| | | break; |
| | | case 2: |
| | | airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "level_2"); |
| | | break; |
| | | case 3: |
| | | airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "level_3"); |
| | | break; |
| | | } |
| | | airFresh.SetAttrState(FunctionAttributeKey.Humidity, receiveBytes[6].ToString()); |
| | | airFresh.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[7].ToString()); |
| | | airFresh.SetAttrState(FunctionAttributeKey.IndoorHumidity, receiveBytes[8].ToString()); |
| | | airFresh.SetAttrState(FunctionAttributeKey.FilterRemain, receiveBytes[9].ToString()); |
| | | airFresh.SetAttrState(FunctionAttributeKey.FilterTimeout, receiveBytes[10] == 1 ? "true" : "false"); |
| | | //设备状态推送 |
| | | Stan.HdlFormLogic.Current.DeviceStatuPush(airFresh, true); |
| | | } |
| | | break; |
| | | } |
| | |
| | | switch (command) |
| | | { |
| | | case Command.SetSingleLightACK: |
| | | case Command.FreshAirReadACK: |
| | | case Command.FreshAirControlACK: |
| | | case Command.FreshAirReadACK_JinMao: |
| | | case Command.FreshAirControlACK_JinMao: |
| | | receiveFlag += string.Format("{0}", usefulBytes[0]); |
| | | break; |
| | | case Command.SetLogicLoopColorACK: |