From 1a4b95a7ebef71838bd3eda2c22056bbf0db65ec Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 10 一月 2020 16:39:54 +0800 Subject: [PATCH] 2019阶段备份 --- HDL_ON/DAL/Net/CommonPage.cs | 2603 ----------------------------------------------------------- 1 files changed, 1 insertions(+), 2,602 deletions(-) diff --git a/HDL_ON/DAL/Net/CommonPage.cs b/HDL_ON/DAL/Net/CommonPage.cs index 6667cb7..d248b8a 100644 --- a/HDL_ON/DAL/Net/CommonPage.cs +++ b/HDL_ON/DAL/Net/CommonPage.cs @@ -1,6 +1,7 @@ 锘縰sing System; using System.Text; using HDL_ON.DAL.Net; +using HDL_ON.Entity.Enumerative; using Shared; using Shared.Net; @@ -95,2567 +96,6 @@ static void Packet_ReceiveEvent (byte subnetID, byte deviceID, Command command, byte [] usefullBytes, string revGatewayIP) { - //try { - // List<byte> ButtonBkeyModelList = new List<byte> (); - // switch (command) { - // case Command.ReadAnalogACK: - // if (UserConfig.Instance.IsSetHomePageSensor) { - // DeviceType deviceType2 = (DeviceType)(usefullBytes [0] * 256 + usefullBytes [1]); - // switch (deviceType2) { - // case DeviceType.SensorPM25: - // if(UserConfig.Instance.pm25.SubnetID == subnetID&& UserConfig.Instance.pm25.DeviceID == deviceID && UserConfig.Instance.pm25.LoopID == usefullBytes[2]) { - // switch(usefullBytes [3]) { - // case 1://鏃犵鍙锋暣褰� - // UserConfig.Instance.pm25.values = usefullBytes [5] * 256 * 256 * 256 + usefullBytes [6] * 256 * 256 + usefullBytes [7] * 256 + usefullBytes [8]; - // break; - // case 2://鏈夌鍙锋暣褰� - // if (usefullBytes [5] > 128) { - // UserConfig.Instance.pm25.values = (1 - (usefullBytes [5] - 128) * 256 * 256 * 256 + usefullBytes [6] * 256 * 256 + usefullBytes [7] * 256 + usefullBytes [8]); - // } else { - // UserConfig.Instance.pm25.values = usefullBytes [5] * 256 * 256 * 256 + usefullBytes [6] * 256 * 256 + usefullBytes [7] * 256 + usefullBytes [8]; - // } - // break; - // case 3://Float - // UserConfig.Instance.pm25.values = (double) floatChange (usefullBytes [5], usefullBytes [6], usefullBytes [7], usefullBytes [8]); - // break; - // } - // } - // break; - // case DeviceType.SensorTemperature: - // if (UserConfig.Instance.temp.SubnetID == subnetID && UserConfig.Instance.temp.DeviceID == deviceID && UserConfig.Instance.temp.LoopID == usefullBytes [2]) { - // switch (usefullBytes [3]) { - // case 1://鏃犵鍙锋暣褰� - // UserConfig.Instance.temp.values = usefullBytes [5] * 256 * 256 * 256 + usefullBytes [6] * 256 * 256 + usefullBytes [7] * 256 + usefullBytes [8]; - // break; - // case 2://鏈夌鍙锋暣褰� - // if (usefullBytes [5] > 128) { - // UserConfig.Instance.temp.values = (1 - (usefullBytes [5] - 128) * 256 * 256 * 256 + usefullBytes [6] * 256 * 256 + usefullBytes [7] * 256 + usefullBytes [8]); - // } else { - // UserConfig.Instance.temp.values = usefullBytes [5] * 256 * 256 * 256 + usefullBytes [6] * 256 * 256 + usefullBytes [7] * 256 + usefullBytes [8]; - // } - // break; - // case 3://Float - // UserConfig.Instance.temp.values = (double)floatChange (usefullBytes [8], usefullBytes [7], usefullBytes [6], usefullBytes [5]); - // break; - // } - // } - // break; - // case DeviceType.SensorCO2: - // if (UserConfig.Instance.co2.SubnetID == subnetID && UserConfig.Instance.co2.DeviceID == deviceID && UserConfig.Instance.co2.LoopID == usefullBytes [2]) { - // switch (usefullBytes [3]) { - // case 1://鏃犵鍙锋暣褰� - // UserConfig.Instance.co2.values = usefullBytes [5] * 256 * 256 * 256 + usefullBytes [6] * 256 * 256 + usefullBytes [7] * 256 + usefullBytes [8]; - // break; - // case 2://鏈夌鍙锋暣褰� - // if (usefullBytes [5] > 128) { - // UserConfig.Instance.co2.values = (1 - (usefullBytes [5] - 128) * 256 * 256 * 256 + usefullBytes [6] * 256 * 256 + usefullBytes [7] * 256 + usefullBytes [8]); - // } else { - // UserConfig.Instance.co2.values = usefullBytes [5] * 256 * 256 * 256 + usefullBytes [6] * 256 * 256 + usefullBytes [7] * 256 + usefullBytes [8]; - // } - // break; - // case 3://Float - // UserConfig.Instance.co2.values = (double)floatChange (usefullBytes [8], usefullBytes [7], usefullBytes [6], usefullBytes [5]); - // break; - // } - // } - // break; - // case DeviceType.SensorHumidity: - // if (UserConfig.Instance.humidity.SubnetID == subnetID && UserConfig.Instance.humidity.DeviceID == deviceID && UserConfig.Instance.humidity.LoopID == usefullBytes [2]) { - // switch (usefullBytes [3]) { - // case 1://鏃犵鍙锋暣褰� - // UserConfig.Instance.humidity.values = usefullBytes [5] * 256 * 256 * 256 + usefullBytes [6] * 256 * 256 + usefullBytes [7] * 256 + usefullBytes [8]; - // break; - // case 2://鏈夌鍙锋暣褰� - // if (usefullBytes [5] > 128) { - // UserConfig.Instance.humidity.values = (1 - (usefullBytes [5] - 128) * 256 * 256 * 256 + usefullBytes [6] * 256 * 256 + usefullBytes [7] * 256 + usefullBytes [8]); - // } else { - // UserConfig.Instance.humidity.values = usefullBytes [5] * 256 * 256 * 256 + usefullBytes [6] * 256 * 256 + usefullBytes [7] * 256 + usefullBytes [8]; - // } - // break; - // case 3://Float - // UserConfig.Instance.humidity.values = (double)floatChange (usefullBytes [8], usefullBytes [7], usefullBytes [6], usefullBytes [5]); - // break; - // } - // } - // break; - // case DeviceType.SensorTVOC: - // if (UserConfig.Instance.tvoc.SubnetID == subnetID && UserConfig.Instance.tvoc.DeviceID == deviceID && UserConfig.Instance.tvoc.LoopID == usefullBytes [2]) { - // switch (usefullBytes [3]) { - // case 1://鏃犵鍙锋暣褰� - // UserConfig.Instance.tvoc.values = usefullBytes [5] * 256 * 256 * 256 + usefullBytes [6] * 256 * 256 + usefullBytes [7] * 256 + usefullBytes [8]; - // break; - // case 2://鏈夌鍙锋暣褰� - // if (usefullBytes [5] > 128) { - // UserConfig.Instance.tvoc.values = (1 - (usefullBytes [5] - 128) * 256 * 256 * 256 + usefullBytes [6] * 256 * 256 + usefullBytes [7] * 256 + usefullBytes [8]); - // } else { - // UserConfig.Instance.tvoc.values = usefullBytes [5] * 256 * 256 * 256 + usefullBytes [6] * 256 * 256 + usefullBytes [7] * 256 + usefullBytes [8]; - // } - // break; - // case 3://Float - // UserConfig.Instance.tvoc.values = (double)floatChange (usefullBytes [8], usefullBytes [7], usefullBytes [6], usefullBytes [5]); - // break; - // } - // } - // break; - // } - // } - // break; - // case Command.ReadThermostatExtensionACK: - // case Command.SetThermostatExtensionACK: - // foreach (var room in Room.Lists) { - // var commons = room.DeviceList.FindAll ((obj) => obj.SubnetID == subnetID && obj.DeviceID == deviceID && obj.Type == DeviceType.Thermostat); - // if (commons != null && commons.Count>0) { - // foreach (var common in commons) { - // var cac = common as Thermostat; - // if (cac.ExtensionID == usefullBytes [0]) { - // // 1 閫氶亾鍙� 1-255 - // // 2 娓╂帶鍣ㄥ紑/鍏虫満 0-鍏虫満锛�1-寮�鏈� - // // 3 妯℃嫙閲忔縺娲讳綅 浠庝綆浣嶅紑濮� 濡俠it0瀵瑰簲娓╂帶鍣ㄧ幆澧冩俯搴﹀�� - // // 4-7 娓╂帶鍣ㄧ幆澧冩俯搴﹀�� 娴偣鍨嬫暟鎹� 鈩� IEEE 754娴偣鏁� - // // 8-11 娓╂帶鍣ㄨ缃俯搴﹀�� 娴偣鍨嬫暟鎹� 鈩� IEEE 754娴偣鏁� - // // 12-15 娓╂帶鍣ㄧ幆澧冩箍搴﹀�� 娴偣鍨嬫暟鎹� % IEEE 754娴偣鏁� - // // 16-19 娓╂帶鍣ㄨ缃箍搴﹀�� 娴偣鍨嬫暟鎹� % IEEE 754娴偣鏁� - // cac.Power = usefullBytes [1]; - // cac.AnalogActivationByte = usefullBytes [2]; - // cac.Indoor_Temperature_Values1 = usefullBytes [3]; - // cac.Indoor_Temperature_Values2 = usefullBytes [4]; - // cac.Indoor_Temperature_Values3 = usefullBytes [5]; - // cac.Indoor_Temperature_Values4 = usefullBytes [6]; - // cac.Setting_Temperature_Values1 = usefullBytes [7]; - // cac.Setting_Temperature_Values2 = usefullBytes [8]; - // cac.Setting_Temperature_Values3 = usefullBytes [9]; - // cac.Setting_Temperature_Values4 = usefullBytes [10]; - // cac.Indoor_Humidity_Values1 = usefullBytes [11]; - // cac.Indoor_Humidity_Values2 = usefullBytes [12]; - // cac.Indoor_Humidity_Values3 = usefullBytes [13]; - // cac.Indoor_Humidity_Values4 = usefullBytes [14]; - // cac.Setting_Humidity_Values1 = usefullBytes [15]; - // cac.Setting_Humidity_Values2 = usefullBytes [16]; - // cac.Setting_Humidity_Values3 = usefullBytes [17]; - // cac.Setting_Humidity_Values4 = usefullBytes [18]; - - // MainPage.WriteLog ("ReadThermostatExtensionACK : 222"); - // UserRoom.UpdateThermostatExtensionTempAndHumidityValues (cac); - // MainPage.WriteLog ("ReadThermostatExtensionACK : 333"); - // ThermostatExtensionPage.UpdateStatus (cac); - // MainPage.WriteLog ("ReadThermostatExtensionACK : 444"); - // ThermostatHostPage.UpdateExtensionStatus (cac); - // MainPage.WriteLog ("ReadThermostatExtensionACK : 555"); - // IO.FileUtils.SaveEquipmentMessage (cac, cac.LoopID.ToString ()); - // } - // } - // } - // } - // break; - - // case Command.ReadThermostatHostACK: - // case Command.SetThermostatHostACK: - // foreach (var cac in Room.Thermostat_HostList) { - // if (cac.SubnetID == subnetID && cac.DeviceID == deviceID && cac.HostID == usefullBytes [0]) { - // // 1 閫氶亾鍙� - // // 2 寮�/鍏虫満 0--鍏� 1--寮� - // // 3 杩愯妯″紡 1-鍒跺喎锛�2-鍒剁儹锛�3-閫氶锛�4-闄ゆ箍锛�5-鍒剁儹闄ゆ箍 - // // 4 杩愯鍦烘櫙 1-鍦ㄥ锛�2-绂诲锛�3-鐫$湢 - // // 5 婀垮害妗d綅 1-浣庯紝2-涓紝3-楂橈紙鍙湪鍒剁儹妯″紡涓嬪彲浠ヨ缃級 - // // 6 婊ょ綉鐧惧垎姣� % - // // 7 娓╂帶鍣ㄥ垎鏈烘暟閲� 1-32 - // // 8-9 鏁呴殰淇℃伅1 - // // 10-11 鏁呴殰淇℃伅2 - // // 12-13 鏁呴殰淇℃伅3 - // // 14-15 鏁呴殰淇℃伅4 - // // 16-17 鏁呴殰淇℃伅5 - // // 18-19 鏁呴殰淇℃伅6 - // // 20-21 妯℃嫙閲忔縺娲讳綅 浠庝綆浣嶅紑濮嬶紝濡俥nable[0] 鐨刡it0--->瀹ゅ唴娓╁害 - // // 22-25 妯℃嫙閲�1锛坆it0锛夊鍐呮俯搴� 娴偣鍨嬫暟鎹� IEEE 754娴偣鏁� - // // 26-29 妯℃嫙閲�2锛坆it1锛夊鍐呮箍搴� 娴偣鍨嬫暟鎹� 0-100 % IEEE 754娴偣鏁� - // // 30-33 妯℃嫙閲�3锛坆it2锛夊鍐匔O2 娴偣鍨嬫暟鎹� PPM IEEE 754娴偣鏁� - // // 34-37 妯℃嫙閲�4锛坆it3锛夊鍐匱VOC 娴偣鍨嬫暟鎹� 绾� IEEE 754娴偣鏁� - // // 38-41 妯℃嫙閲�5锛坆it4锛夊鍐匬M2.5 娴偣鍨嬫暟鎹� PPM IEEE 754娴偣鏁� - // // 42-45 妯℃嫙閲�6锛坆it5锛夊澶栨俯搴� 娴偣鍨嬫暟鎹� IEEE 754娴偣鏁� - // // 46-49 妯℃嫙閲�7锛坆it6锛夊澶栨箍搴� 娴偣鍨嬫暟鎹� 0-100 % IEEE 754娴偣鏁� - // // 50-53 妯℃嫙閲�8锛坆it7锛夊澶朠M2.5 娴偣鍨嬫暟鎹� PPM IEEE 754娴偣鏁� - // cac.LoopID = 1; - // cac.Power = usefullBytes [1]; - // cac.CurrentMode = usefullBytes [2]; - // cac.CurrentScene = usefullBytes [3]; - // cac.HumidityLevel = usefullBytes [4]; - // cac.StrainerState = usefullBytes [5]; - // cac.ExtensionCount = usefullBytes [6]; - // cac.FaultInformation1 = usefullBytes [7] * 256 + usefullBytes [8]; - // cac.FaultInformation1 = usefullBytes [9] * 256 + usefullBytes [10]; - // cac.FaultInformation1 = usefullBytes [11] * 256 + usefullBytes [12]; - // cac.FaultInformation1 = usefullBytes [13] * 256 + usefullBytes [14]; - // cac.FaultInformation1 = usefullBytes [15] * 256 + usefullBytes [16]; - // cac.FaultInformation1 = usefullBytes [17] * 256 + usefullBytes [18]; - // cac.AnalogActivationByte = usefullBytes [19]; - // cac.AnalogActivationByte2 = usefullBytes [20]; - // var AnalogActivationIndexString = Convert.ToString (cac.AnalogActivationByte2,2).PadLeft(8,'0'); - // if (AnalogActivationIndexString [7] == '1') { - // cac.Indoor_Temperature_Values1 = usefullBytes [21]; - // cac.Indoor_Temperature_Values2 = usefullBytes [22]; - // cac.Indoor_Temperature_Values3 = usefullBytes [23]; - // cac.Indoor_Temperature_Values4 = usefullBytes [24]; - // } - // if (AnalogActivationIndexString [6] == '1') { - // cac.Indoor_Humidity_Values1 = usefullBytes [25]; - // cac.Indoor_Humidity_Values2 = usefullBytes [26]; - // cac.Indoor_Humidity_Values3 = usefullBytes [27]; - // cac.Indoor_Humidity_Values4 = usefullBytes [28]; - // } - // if (AnalogActivationIndexString [5] == '1') { - // cac.Indoor_CO2_Values1 = usefullBytes [29]; - // cac.Indoor_CO2_Values2 = usefullBytes [30]; - // cac.Indoor_CO2_Values3 = usefullBytes [31]; - // cac.Indoor_CO2_Values4 = usefullBytes [32]; - // } - // if (AnalogActivationIndexString [4] == '1') { - // cac.Indoor_TVOC_Values1 = usefullBytes [33]; - // cac.Indoor_TVOC_Values2 = usefullBytes [34]; - // cac.Indoor_TVOC_Values3 = usefullBytes [35]; - // cac.Indoor_TVOC_Values4 = usefullBytes [36]; - // } - // if (AnalogActivationIndexString [3] == '1') { - // cac.Indoor_PM25_Values1 = usefullBytes [37]; - // cac.Indoor_PM25_Values2 = usefullBytes [38]; - // cac.Indoor_PM25_Values3 = usefullBytes [39]; - // cac.Indoor_PM25_Values4 = usefullBytes [40]; - // } - // if (AnalogActivationIndexString [2] == '1') { - // cac.Outdoor_Temperature_Values1 = usefullBytes [41]; - // cac.Outdoor_Temperature_Values2 = usefullBytes [42]; - // cac.Outdoor_Temperature_Values3 = usefullBytes [43]; - // cac.Outdoor_Temperature_Values4 = usefullBytes [44]; - // } - // if (AnalogActivationIndexString [1] == '1') { - // cac.Outdoor_Humidity_Values1 = usefullBytes [45]; - // cac.Outdoor_Humidity_Values2 = usefullBytes [46]; - // cac.Outdoor_Humidity_Values3 = usefullBytes [47]; - // cac.Outdoor_Humidity_Values4 = usefullBytes [48]; - // } - // if (AnalogActivationIndexString [0] == '1') { - // cac.Outdoor_PM25_Values1 = usefullBytes [49]; - // cac.Outdoor_PM25_Values2 = usefullBytes [50]; - // cac.Outdoor_PM25_Values3 = usefullBytes [51]; - // cac.Outdoor_PM25_Values4 = usefullBytes [52]; - // } - - - // ThermostatHostPage.UpdateStatus (cac); - // ThermostatExtensionPage.UptateMode (cac); - // foreach (var room in Room.Lists) { - // foreach (var device in room.DeviceList) { - // if (device.Type == DeviceType.Thermostat) { - // var cac1 = device as Thermostat; - // if (cac.SubnetID == cac1.SubnetID && cac.DeviceID == cac1.DeviceID && cac.HostID == cac1.HostID) { - // cac1.CurrentMode = cac.CurrentMode; - // UserRoom.UpdateThermostatModeStatus (cac1); - // IO.FileUtils.SaveEquipmentMessage (cac1, cac1.LoopID.ToString ()); - // } - // } - // } - // } - // IO.FileUtils.SaveEquipmentMessage (cac); - // } - // } - // break; - // case Command.FreshAirReadACK: - // case Command.FreshAirControlACK: - // foreach (var room in Room.Lists) { - // var common = room.DeviceList.Find ((obj) => obj.SubnetID == subnetID && obj.DeviceID == deviceID && obj.LoopID == usefullBytes [0] && obj.Type == DeviceType.FreshAir); - // if (common != null) { - // var fresAirReceive = common as FreshAir; - // fresAirReceive.SwitchStatus = usefullBytes [1]; - // fresAirReceive.WindSpeed = usefullBytes [2]; - // fresAirReceive.SetPattern = usefullBytes [3]; - // fresAirReceive.EnableValue1 = usefullBytes [4]; - // fresAirReceive.EnableValue2 = usefullBytes [5]; - // if (usefullBytes.Length > 6) { - // fresAirReceive.InTemp = floatChange (usefullBytes [6], usefullBytes [7], usefullBytes [8], usefullBytes [9]); - // fresAirReceive.OutTemp = floatChange (usefullBytes [10], usefullBytes [11], usefullBytes [12], usefullBytes [13]); - // fresAirReceive.Humidity = floatChange (usefullBytes [14], usefullBytes [15], usefullBytes [16], usefullBytes [17]); - // fresAirReceive.PM25 = floatChange (usefullBytes [18], usefullBytes [19], usefullBytes [20], usefullBytes [21]); - // fresAirReceive.TVOC = floatChange (usefullBytes [22], usefullBytes [23], usefullBytes [24], usefullBytes [25]); - // fresAirReceive.CO2 = floatChange (usefullBytes [26], usefullBytes [27], usefullBytes [28], usefullBytes [29]); - // } - // IO.FileUtils.SaveEquipmentMessage (fresAirReceive, fresAirReceive.LoopID.ToString ()); - // UserFresAirList.UpdateStatus (fresAirReceive); - // UserRoom.UpdataDeviceStatus (fresAirReceive); - // UserFreshAirPage.UpdateStatus (fresAirReceive); - // } - // } - // break; - // case Command.SetArmACK: - // case Command.ReadArmACK: - // if (Application.IsPad) { } else { - // SecurityModul sm = new SecurityModul () { - // SubnetID = subnetID, - // DeviceID = subnetID, - // LoopID = usefullBytes [0], - // AreaType = usefullBytes [1], - // }; - // UserSecurityAreaPage.UpdateStatus (sm); - // } - // break; - // case Command.ReadLightEquipmentAllLoopBrightnessACK://18145611909 - // for (byte i = 1; i <= usefullBytes [0]; i++) { - // bool updateLightStatus = true; - // foreach (var room in Room.Lists) { - // Common common = null; - // var commons = room.DeviceList.FindAll ((obj) => obj.SubnetID == subnetID && obj.DeviceID == deviceID); - // if (commons.Count > 0) { - // foreach (var c in commons) { - // if (c.Type == DeviceType.LightMixDimming) { - // var rcuDimming = (c as LightMixDimming); - // if (rcuDimming.SubnetID == subnetID && rcuDimming.DeviceID == deviceID && rcuDimming.PhysicsLoopID == i) { - // if (rcuDimming.CurrentBrightness == usefullBytes [i]) { - // updateLightStatus = false; - // } - // rcuDimming.CurrentBrightness = usefullBytes [i]; - // common = rcuDimming; - // } - // } - // if (c.Type == DeviceType.LightMixSwitch) { - // var rcuSwitch = (c as LightMixSwitch); - // if (rcuSwitch.SubnetID == subnetID && rcuSwitch.DeviceID == deviceID && rcuSwitch.PhysicsLoopID == i) { - // if (rcuSwitch.CurrentBrightness == usefullBytes [i]) { - // updateLightStatus = false; - // } - // rcuSwitch.CurrentBrightness = usefullBytes [i]; - // common = rcuSwitch; - // } - // } - // } - // } - // if (common == null) - // common = room.DeviceList.Find ((obj) => obj.SubnetID == subnetID && obj.DeviceID == deviceID && obj.LoopID == i); - // if (common != null) { - // //foreach (var common in room.DeviceList) { - // //if (common.SubnetID != subnetID || common.DeviceID != deviceID || common.LoopID != i) { - // // continue; - // //} - // common.LastUpdateTime = DateTime.Now; - // if (common.Type == DeviceType.LightSwitch || common.Type == DeviceType.LightSwitchSocket || common.Type == DeviceType.LightEnergySwitch) { - // if ((common as LightSwitch).CurrentBrightness == usefullBytes [i]) { - // updateLightStatus = false; - // } - // (common as LightSwitch).CurrentBrightness = usefullBytes [i]; - // } else if (common.Type == DeviceType.LightDimming) { - // if ((common as LightDimming).CurrentBrightness == usefullBytes [i]) { - // updateLightStatus = false; - // } - // (common as LightDimming).CurrentBrightness = usefullBytes [i]; - // } else if (common.Type == DeviceType.FanModule) { - // if ((common as FanModule).Switch == usefullBytes [i]) { - // updateLightStatus = false; - // } - // (common as FanModule).Switch = usefullBytes [i]; - // if (usefullBytes [i] != 0) - // (common as FanModule).WindSpeed = usefullBytes [i]; - // } else if (common.Type == DeviceType.LightDALI) { - // if ((common as LightDALI).CurrentBrightness == usefullBytes [i]) { - // updateLightStatus = false; - // } - // (common as LightDALI).CurrentBrightness = usefullBytes [i]; - // } - // string updateFlag = common.CommonLoopID; - // if (Application.IsPad) { - // //Pad.UserLightPage.UpdateStatus (updateFlag, usefullBytes [i]); - // //Pad.UserDeviceToLight.UpdateStatus (); - // //Pad.UserDeviceToLight.UpdateAllLightsStatus (updateFlag, usefullBytes [i]); - // //Pad.UserDeviceToSocket.UpdateStatus (updateFlag, usefullBytes [i]); - // //Pad.UserFan.UpdataFanView (updateFlag, usefullBytes [i]); - // } else { - // UserDeviceToLight.UpdateBrighingCount (updateFlag); - // if (updateLightStatus) { - // UserRoom.UpdataDeviceStatus (common); - // UserLightPage.UpdateStatus (updateFlag, usefullBytes [i]); - // UserDeviceToLight.UpdateStatus (updateFlag, usefullBytes [i]); - // UserFan.UpdataFanView (updateFlag, usefullBytes [i]); - // UserDeviceToFan.UpdataStatus (updateFlag, usefullBytes [i]); - // UserDeviceToSocket.UpdateStatus (updateFlag, usefullBytes [i]); - // } - // } - // } - // } - // } - // break; - // case Command.SetSingleLightACK: - // foreach (var room in Room.Lists) { - // var common = room.DeviceList.Find ((obj) => obj.CommonLoopID == subnetID.ToString () + "_" + deviceID.ToString () + "_" + usefullBytes [0].ToString ()); - // if (common != null) { - // //foreach (var common in room.DeviceList) { - // if (common.CommonLoopID != subnetID.ToString () + "_" + deviceID.ToString () + "_" + usefullBytes [0].ToString ()) { - // continue; - // } - // string updateFlag = common.CommonLoopID; - // if (common.Type == DeviceType.LightRGB) { - // break; - // } - // common.LastUpdateTime = DateTime.Now; - // bool hadBeUpdate = true; - // if (common.Type == DeviceType.LightSwitch || common.Type == DeviceType.LightSwitchSocket || common.Type == DeviceType.LightSwitchSocket) { - // if ((common as LightSwitch).CurrentBrightness == usefullBytes [2]) - // hadBeUpdate = false; - // (common as LightSwitch).CurrentBrightness = usefullBytes [2]; - // } else if (common.Type == DeviceType.LightDimming) { - // if ((common as LightDimming).CurrentBrightness == usefullBytes [2]) - // hadBeUpdate = false; - // (common as LightDimming).CurrentBrightness = usefullBytes [2]; - // } else if (common.Type == DeviceType.FanModule) { - // if ((common as FanModule).Switch == usefullBytes [2]) - // hadBeUpdate = false; - // (common as FanModule).Switch = usefullBytes [2]; - // if (usefullBytes [2] != 0) - // (common as FanModule).WindSpeed = usefullBytes [2]; - // } else if (common.Type == DeviceType.LightMixSwitch) { - // if ((common as LightMixSwitch).CurrentBrightness == usefullBytes [2]) - // hadBeUpdate = false; - // (common as LightMixSwitch).CurrentBrightness = usefullBytes [2]; - // } else if (common.Type == DeviceType.LightMixDimming) { - // if ((common as LightMixDimming).CurrentBrightness == usefullBytes [2]) - // hadBeUpdate = false; - // (common as LightMixDimming).CurrentBrightness = usefullBytes [2]; - // } else if (common.Type == DeviceType.LightDALI) { - // if ((common as LightDALI).CurrentBrightness == usefullBytes [2]) - // hadBeUpdate = false; - // (common as LightDALI).CurrentBrightness = usefullBytes [2]; - // } - // if (Application.IsPad) { - // //Pad.UserLightPage.UpdateStatus (updateFlag, usefullBytes [2]); - // //Pad.UserDeviceToLight.UpdateStatus (); - // //Pad.UserDeviceToLight.UpdateAllLightsStatus (updateFlag, usefullBytes [2]); - // //Pad.UserDeviceToSocket.UpdateStatus (updateFlag, usefullBytes [2]); - // //Pad.UserFan.UpdataFanView (updateFlag, usefullBytes [2]); - // //break; - // } else { - // UserDeviceToLight.UpdateBrighingCount (updateFlag); - // if (hadBeUpdate) { - // UserRoom.UpdataDeviceStatus (common); - // UserLightPage.UpdateStatus (updateFlag, usefullBytes [2]); - // UserDeviceToLight.UpdateStatus (updateFlag, usefullBytes [2]); - // UserFan.UpdataFanView (updateFlag, usefullBytes [2]); - // UserDeviceToFan.UpdataStatus (updateFlag, usefullBytes [2]); - // UserDeviceToSocket.UpdateStatus (updateFlag, usefullBytes [2]); - // } - // //break; - // } - // } - // } - // break; - // case Command.SetSceneACK: - // /// [0]// 鍖哄彿1-n锛� 255琛ㄧず鎵�鏈夊尯(鐢ㄤ簬骞挎挱鍦烘櫙) 1byte // /// [1]// 鍦哄彿0-x 1byte - // /// [2]// 鍥炶矾鎬绘暟n 1byte - // /// [3]// 鍥炶矾鐘舵��:bit浣� 0鍏炽��1寮�锛�(byte锛歜it0-7瀵瑰簲1-8鍥炶矾 ...n鍥炶矾) ((n+7)/8) byte - // foreach (var room in Room.Lists) { - // var commonList = room.DeviceList.FindAll ((obj) => obj.CommonLoopID == subnetID.ToString () + "_" + deviceID.ToString () + "_" + usefullBytes [0].ToString ()); - // if (commonList != null && commonList.Count > 0) { - // foreach (var common in commonList) { - // if (common.LoopID > usefullBytes [2]) { - // continue; - // } - // string updateFlag = common.CommonLoopID; - // int useIndex = common.LoopID / 8; - // int selfIndex = common.LoopID % 8; - // var binaryString = Convert.ToString (usefullBytes [2 + useIndex], 2).ToCharArray(); - // byte ackSceneBrightness = 100; - // if (binaryString [selfIndex] == '0') { - // ackSceneBrightness = 0; - // } - // if (common.Type == DeviceType.LightRGB) { - // break; - // } - // common.LastUpdateTime = DateTime.Now; - // bool hadBeUpdate = true; - // if (common.Type == DeviceType.LightSwitch || common.Type == DeviceType.LightSwitchSocket || common.Type == DeviceType.LightSwitchSocket) { - // if ((common as LightSwitch).CurrentBrightness == ackSceneBrightness) - // hadBeUpdate = false; - // (common as LightSwitch).CurrentBrightness = ackSceneBrightness; - // } else if (common.Type == DeviceType.LightDimming) { - // if ((common as LightDimming).CurrentBrightness == ackSceneBrightness) - // hadBeUpdate = false; - // (common as LightDimming).CurrentBrightness = ackSceneBrightness; - // } else if (common.Type == DeviceType.FanModule) { - // if ((common as FanModule).Switch == ackSceneBrightness) - // hadBeUpdate = false; - // (common as FanModule).Switch = ackSceneBrightness; - // if (ackSceneBrightness != 0) - // (common as FanModule).WindSpeed = ackSceneBrightness; - // } else if (common.Type == DeviceType.LightMixSwitch) { - // if ((common as LightMixSwitch).CurrentBrightness == ackSceneBrightness) - // hadBeUpdate = false; - // (common as LightMixSwitch).CurrentBrightness = ackSceneBrightness; - // } else if (common.Type == DeviceType.LightMixDimming) { - // if ((common as LightMixDimming).CurrentBrightness == ackSceneBrightness) - // hadBeUpdate = false; - // (common as LightMixDimming).CurrentBrightness = ackSceneBrightness; - // } else if (common.Type == DeviceType.LightDALI) { - // if ((common as LightDALI).CurrentBrightness == ackSceneBrightness) - // hadBeUpdate = false; - // (common as LightDALI).CurrentBrightness = ackSceneBrightness; - // } - // if (Application.IsPad) { - - // } else { - // UserDeviceToLight.UpdateBrighingCount (updateFlag); - // if (hadBeUpdate) { - // UserRoom.UpdataDeviceStatus (common); - // UserLightPage.UpdateStatus (updateFlag, ackSceneBrightness); - // UserDeviceToLight.UpdateStatus (updateFlag, ackSceneBrightness); - // UserFan.UpdataFanView (updateFlag, ackSceneBrightness); - // UserDeviceToFan.UpdataStatus (updateFlag, ackSceneBrightness); - // UserDeviceToSocket.UpdateStatus (updateFlag, ackSceneBrightness); - // } - // //break; - // } - // } - // } - // } - // break; - // case Command.ReadAnalogValueACK: - // foreach (var room in Room.Lists) { - // foreach (var common in room.DeviceList) { - // if (common.SubnetID != subnetID || common.DeviceID != deviceID || common.LoopID != usefullBytes [1]) { - // continue; - // } - // if (common.Type == DeviceType.LightEnergySwitch) { - // string updateFlag = common.CommonLoopID; - // if (!Application.IsPad) { - // UserDeviceToSocket.UpdataEnergy (updateFlag, usefullBytes [2] * 256 + usefullBytes [3]); - // UserRoom.UpdataEnergy (updateFlag, usefullBytes [2] * 256 + usefullBytes [3]); - // break; - // } else { - // //Pad.UserDeviceToSocket.UpdataEnergy (updateFlag, usefullBytes [2] + usefullBytes [3]); - // break; - // } - // } - - // int dddd = usefullBytes [0] & 0x3F; - - // // 0xXX锛氬叕鍙稿唴閮ㄥ崗璁搴旂殑搴忓彿 - // // common.Type锛氬搴旂殑鏄紪杈戣蒋浠剁殑搴忓彿(娌℃湁涓�涓�瀵瑰簲锛屾槸涓轰簡灏嗙浉杩戠殑璋冩暣鍦ㄤ竴璧凤紝鏂逛究瀹㈡埛浣跨敤) - // if (dddd == 0x09 && common.Type == DeviceType.SensorPM25) { - // // PM2.5 - // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // (common as SensorPM25).CurrentPM25 = value; - // //} else if (dddd == 0x13 && common.Type == 1) { - // // PM10 - // //int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // //common.value = value; - // //} else if (dddd == 0x0D && common.Type == DeviceType.SensorCH4) { - // //// 姘ф皵 - // //int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // //common.value = value; - // } else if (dddd == 0x07 && common.Type == DeviceType.SensorCO2) { - // // CO2 - // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // (common as SensorCO2).CurrentCO2 = value; - // //} else if (dddd == 0x10 && common.Type == DeviceType.co) { - // //// CO - // //int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // //common.value = value; - // } else if (dddd == 0x05 && common.Type == DeviceType.SensorHumidity) { - // // 婀垮害 - // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // (common as SensorHumidity).CurrentHumidity = value; - // } else if (dddd == 0x01 && common.Type == DeviceType.SensorTemperature) { - // // Temperature - // if (usefullBytes [2] >> 7 == 0) {// 娓╁害 - // int value = usefullBytes [3] & 0xFF; - // (common as SensorTemperature).CurrentTemperature = value; - // } else { - // int value = -(usefullBytes [3] & 0xFF); - // (common as SensorTemperature).CurrentTemperature = value; - // } - // } else if (dddd == 0x0C && common.Type == DeviceType.SensorTVOC) { - // // VOC - // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // (common as SensorTVOC).CurrentTVOC = value; - // //} else if (dddd == 0x04 && common.Type == DeviceType.SensorTVOC) { - // // // Air_ppressure 姘斿帇 - // // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // // common.value = value; - // //} else if (dddd == 0x00 && common.Type == DeviceType.SensorIllumination) { - // // // 浜害 - // // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // // (common as SensorIllumination).CurrentIllumination = value; - // //} else if (dddd == 0x02 && common.Type == DeviceType.SensorVoltage) { - // // // 鐢靛帇 - // // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // // (common as SensorVoltage).CurrentVoltage = value; - // //} else if (dddd == 0x03 && common.Type == DeviceType.SensorCurrent) { - // // // 鐢垫祦 - // // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // // (common as SensorCurrent).CurrentCurrent = value; - // //} else if (dddd == 0x04 && common.Type == DeviceType.SensorVoltage) { - // // // 鍘嬪姏 - // // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // // (common as SensorVoltage).CurrentVoltage = value; - // //} else if (dddd == 0x06 && common.Type == DeviceType.SensorWindSpeed) { - // // // 椋庨�� - // // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // // (common as SensorWindSpeed).CurrentWindSpeed = value; - - // //} else if (dddd == 0x0A && common.Type == DeviceType.SensorVoltage) { - // // // 鍔熺巼 - // // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // // (common as SensorVoltage).CurrentVoltage = value; - // //} else if (dddd == 0x0B && common.Type == DeviceType.SensorVoltage) { - // // // 鐢佃兘 - // // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // // (common as SensorVoltage).CurrentVoltage = value; - // //} else if (dddd == 0x0E && common.Type == DeviceType.SensorVoltage) { - // // // 鐑熼浘 - // // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // // (common as SensorVoltage).CurrentVoltage = value; - // //} else if (dddd == 0x0F && common.Type == DeviceType.SensorVoltage) { - // // // 鐢查啗 - // // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // // (common as SensorVoltage).CurrentVoltage = value; - // //} else if (dddd == 0x11 && common.Type == DeviceType.SensorVoltage) { - // // // 鐢茬兎 - // // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // // (common as SensorVoltage).CurrentVoltage = value; - // //} else if (dddd == 0x12 && common.Type == DeviceType.SensorVoltage) { - // // // 鍣煶 - // // int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // // (common as SensorVoltage).CurrentVoltage = value; - // //} else if (dddd == 0x14 && common.Type == DeviceType.SensorVoltage) { - // //// 绌烘皵璐ㄩ噺 - // //int value = (usefullBytes [2] & 0xFF) * 256 + (usefullBytes [3] & 0xFF); - // //(common as SensorVoltage).CurrentVoltage = value; - - // } - - - - // } - // } - // break; - // case Command.SetLogicLoopColorACK: - // case Command.ReadLogicLoopColorACK: - // foreach (var room in Room.Lists) { - // foreach (var common in room.DeviceList) { - // if (common.SubnetID != subnetID || common.DeviceID != deviceID || common.LoopID != usefullBytes [0]) { - // continue; - // } - // common.LastUpdateTime = DateTime.Now; - // if (common.Type == DeviceType.LightRGB) { - // (common as LightLogic).CurrentBrightness = usefullBytes [1]; - // string updateFlag = common.CommonLoopID + "RGB"; - // if (Application.IsPad) { - // UserLightPage.UpdateStatus (updateFlag, usefullBytes [1]); - // UserDeviceToLight.UpdateStatus (updateFlag, usefullBytes [1]); - // } else { - // UserRoom.UpdataDeviceStatus (common); - // UserLightPage.UpdateStatus (updateFlag, usefullBytes [1]); - // UserDeviceToLight.UpdateStatus (updateFlag, usefullBytes [1]); - // } - // } - // } - // } - // break; - // case Command.SetFoolHeatACK: - // case Command.ReadFoolHeatACK: - // case Command.Serverx_FH_CMD_ACK: - // foreach (var room in Room.Lists) { - // var fhCommon = room.DeviceList.Find ((obj) => obj.SubnetID == subnetID && obj.DeviceID == deviceID && obj.LoopID == usefullBytes [0]); - // if (fhCommon != null) { - // (fhCommon as FoolHeat).Serverx_FH_CMD (FoolHeat.CommandType.Null, usefullBytes); - // } - // } - // break; - // case Command.BroadcastDryContactStatus://骞叉帴鐐瑰箍鎾嚭鏉ョ殑鏁版嵁鎺ュ彈锛屼笉鏄洖澶嶆暟鎹� - // if (Application.IsPad) { } else { - // UserDryContact.UpdataView (subnetID, deviceID, usefullBytes [0], usefullBytes [2]); - // } - // break; - - // #region 闂ㄩ攣 - // case Command.ReadDoorLockClockACK: - // //闂ㄩ攣111 - // foreach (var room in Room.Lists) { - // foreach (var common in room.DeviceList) { - // if (common.SubnetID != subnetID || common.DeviceID != deviceID || common.LoopID != usefullBytes [0]) { - // continue; - // } - // if (common.Type == DeviceType.DoorLock) { - // common.LastUpdateTime = DateTime.Now; - // var doorLock = common as DoorLock; - // doorLock.DoorLockNum = usefullBytes [1]; - // if (Application.IsPad) { - // //Pad.UserDoorLockPage.UpdateStatus (doorLock); - // } else { - // //PasswordList.UpdateStatus (doorLock); - // } - // } - // } - // } - // break; - // //骞挎挱闂ㄩ攣鐘舵�佸拰鎶ヨ, - // //闂ㄩ攣111,BroadcastDoorLockStateAndAlarm - // case Command.BroadcastDoorLockStateAndAlarm: - // if (Application.IsPad) { } else { - // UserDryContact.UpdataView (subnetID, deviceID, usefullBytes [0], usefullBytes [2]); - // } - // break; - // #endregion - // case Command.ReadCurtainStutasACK: - // case Command.UpdataCurtainModelStutasACK: - // #region 绐楀笜 - // foreach (var room in Room.Lists) { - // foreach (var common in room.DeviceList) { - // if (common.SubnetID != subnetID || common.DeviceID != deviceID) { - // continue; - // } - // common.LastUpdateTime = DateTime.Now; - // if (common.Type == DeviceType.CurtainModel) { - // if (common.LoopID == usefullBytes [0]) { - // (common as CurtainModel).Status = (CurtainStatus)usefullBytes [1]; - // if (Application.IsPad) { - // //Pad.UserCurtainPage.UpdateStatus (common); - // } else { - // UserCurtainPage.UpdateStatus (common); - // } - // } - // } else if (common.Type == DeviceType.CurtainRoller) { - // if (usefullBytes [0] == 17) { - // (common as CurtainRoller).CurtainProress = usefullBytes [1]; - // } else { - // (common as CurtainRoller).Status = (CurtainStatus)usefullBytes [1]; - // } - // if (Application.IsPad) { - // //Pad.UserCurtainPage.UpdateStatus (common); - // } else { - // UserCurtainPage.UpdateStatus (common); - // } - // } else if (common.Type == DeviceType.CurtainTrietex) { - // if (usefullBytes [0] == 17) { - // (common as CurtainTrietex).CurtainProress = usefullBytes [1]; - // } else { - // (common as CurtainTrietex).Status = (CurtainStatus)usefullBytes [1]; - // } - // if (Application.IsPad) { - // //Pad.UserCurtainPage.UpdateStatus (common); - // } else { - // UserCurtainPage.UpdateStatus (common); - // } - // } - // } - // } - // break; - // #endregion - - // case Command.SonosControlACK: { - // #region Sonos闊充箰鎾斁鍣� - // var result = Encoding.UTF8.GetString (usefullBytes); - // if (result != null) { - // var jObject = JObject.Parse (result); - // if (jObject == null) { - // return; - // } - // var sid = jObject ["sid"]?.ToString (); - // if (sid == null) { - // return; - // } - // var sidUlong = Convert.ToUInt64 (sid, 16); - // var property = (byte)((sidUlong >> 16) & 0xFF); - // var subnetId = (byte)((sidUlong >> 40) & 0xFF); - // var deviceId = (byte)((sidUlong >> 32) & 0xFF); - // var targetNumber = (uint)((sidUlong >> 0) & 0xFFFF); - // string CommonLoopID = subnetId.ToString () + "_" + deviceId.ToString () + "_" + targetNumber.ToString (); - // foreach (var music in SonosMusic.SonosMusicList) { - // if (music.CommonLoopID == CommonLoopID && music.sidlist.Contains (sid)) { - - // var Issuccess = Convert.ToBoolean (jObject ["event"] ["success"]); - // var job = jObject ["event"] ["data"]; - // if (Issuccess) { - // if (property == 35) { - // //music.sonosPlayStatus.vol = job ["groupVolume"]?.ToString ();//缁勯煶閲� - // if (music.ServerClientType == -1) { - // //music.sonosPlayStatus.playbackState = job.Value<int> ("playbackState"); - // //if (music.sonosPlayStatus.playbackState != 4) { - // music.sonosPlayStatus.vol = job ["playerVolume"]?.ToString ();//闊抽噺 - // //} - // } else { - // music.sonosPlayStatus.vol = job ["playerVolume"]?.ToString ();//闊抽噺 - // music.sonosPlayStatus.positionMillis = job.Value<int> ("positionMillis"); - // music.sonosPlayStatus.durationMillis = job.Value<int> ("durationMillis"); - // music.sonosPlayStatus.playModes = job.Value<int> ("playModes"); - // music.sonosPlayStatus.playbackState = job.Value<int> ("playbackState"); - // music.sonosPlayStatus.mute = Convert.ToBoolean (job ["muted"]); - // music.sonosPlayStatus.DateTime = DateTime.Now; - // if (music.sonosPlayStatus.playbackState != 4) { - // music.sonosPlayStatus.songName = job ["songName"]?.ToString (); - // music.sonosPlayStatus.artist = job ["artist"]?.ToString (); - // music.sonosPlayStatus.album = job ["album"]?.ToString (); - // music.sonosPlayStatus.imageUrl = job ["imageUrl"]?.ToString (); - // } - - // } - // } - // } - - // //if(Issuccess){ - // // if (property == 27) { - // // //music.sonosPlayStatus.vol = job ["playerVolume"]?.ToString (); - // // } - // // // - // //}else{ - // // ////鎻愮ず锛氭帶鍒跺け璐� - // //} - - // } - // } - // } - // #endregion - // } - // break; - - // case Command.ControlMusicModel1ACK: - // #region 闊充箰 - // foreach (var m in Room.Lists) { - // var device = m.DeviceList.Find ((v) => { - // return v.Type == DeviceType.MusicModel && v.SubnetID == subnetID && v.DeviceID == deviceID; - // }); - // if (device == null) { - // continue; - // } - // MusicModel music = device as MusicModel; - - // //鎶婃帴鏀跺埌鐨勬暟鎹浆鎹负瀛楃涓� - // string backAllString = CommonPage.MyEncodingGB2312.GetString (usefullBytes); - - // //鎶婂綋鍓嶅瓧绗︿覆浠ワ紝鍙峰垎寮� - // string [] backResult = backAllString.Split (','); - - // string commandString = backResult [0]; - - - - // if (commandString.StartsWith ("#Z")) { - // if (2 <= backResult.Length) { - // //music.PlayStatus = backResult [1] == "ON" ? MusicModel.Status.Play : MusicModel.Status.Stop; - // } - // if (backResult.Length > 3) { - // //璁剧疆闊充箰鐨勫尯鍙凤紝婧愬彿锛岄煶閲忓�笺�� - // if (backResult [0].StartsWith ("#Z") && backResult [1] == "ON" && backResult [2].StartsWith ("SRC") && backResult [3].StartsWith ("VOL")) { - - // music.ZoneID = backResult [0].Replace ("#Z", ""); - // music.SourceID = backResult [2].Replace ("SRC", ""); - // music.CurVol = backResult [3].Replace ("VOL", "").TrimEnd (new char [] { '\r', '\n' }); - // } - // } - // } - - // if (commandString.Length > 3) { - // if (commandString.StartsWith ("#S")) { - // //music_SourceID=commandString.Substring (2, 1); - // } - - // commandString = commandString.Substring (3, commandString.Length - 3); - // byte [] bytes = null; - // switch (commandString) { - // case "DISPLINE4": - // //褰撳墠鎾斁姝屾洸鍚� - // var len = 0; - // for (var i = 14; i < usefullBytes.Length; i += 2) { - // if (usefullBytes [i] == 0x00 && usefullBytes [i + 1] == 0x03) { - // break; - // } - // len += 2; - // } - // bytes = new byte [len]; - - // for (var j = 0; j < bytes.Length;) { - - // bytes [j + 1] = usefullBytes [14 + j]; - // bytes [j] = usefullBytes [14 + j + 1]; - // j += 2; - // } - - // music.curPlayMusicName = Encoding.Unicode.GetString (bytes); - // break; - // case "DISPLINE1": - // //鍒楄〃鍙枫�佸垪琛ㄦ�绘暟锛岃繑鍥炴牸寮�: L:1/2 - // bytes = new byte [usefullBytes.Length - 4 - 14]; - // for (int i = 14, j = 0; j < bytes.Length;) { - // bytes [j + 1] = usefullBytes [i++]; - // bytes [j] = usefullBytes [i++]; - // j += 2; - // } - // string curPlayListNumberAndCount = Encoding.Unicode.GetString (bytes); - - // // mm1ACK.musicListNumber = "0"; - - // int number = 0; - - // if (curPlayListNumberAndCount.StartsWith ("L:")) { - // curPlayListNumberAndCount = curPlayListNumberAndCount.Replace ("L:", ""); - - // if (curPlayListNumberAndCount.Contains ("/")) { - // number = int.Parse (curPlayListNumberAndCount.Split ('/') [0]); - // music.curListNumber = number < 10 ? "00" + number : (number < 100 ? "0" + number : number.ToString ()); - - // } - // } - // break; - // case "DISPLINE2": - // //褰撳墠鍒楄〃鍚嶏紝杩斿洖鏍煎紡: SOME.PLS - // bytes = new byte [usefullBytes.Length - 4 - 14]; - // for (int i = 14, j = 0; j < bytes.Length;) { - // bytes [j + 1] = usefullBytes [i++]; - // bytes [j] = usefullBytes [i++]; - // j += 2; - // } - // string curPlayMusicListName = Encoding.Unicode.GetString (bytes); - - // string curMusicListName = curPlayMusicListName; - - // if (curPlayMusicListName.Contains (".PLS")) { - // curMusicListName = curPlayMusicListName.Split ('.') [0]; - // } - // music.curMusicListName = curMusicListName; - - // //MusicStatusFunction.updateMusicStatus_PlayListName (subnetID, deviceID, music_SourceID, curMusicListName, iPEndPoint.Address.ToString (), iPEndPoint.Port); - // break; - // case "DISPLINE3": - // //姝屾洸鍙枫�佹瓕鏇叉�绘暟锛岃繑鍥炴牸寮�: S:10/23 - // bytes = new byte [usefullBytes.Length - 4 - 14]; - // for (int i = 14, j = 0; j < bytes.Length;) { - // bytes [j + 1] = usefullBytes [i++]; - // bytes [j] = usefullBytes [i++]; - // j += 2; - // } - // string curPlayMusicNumberAndCount = System.Text.Encoding.Unicode.GetString (bytes); - - // int musicFileNumber = 0; - - // if (curPlayMusicNumberAndCount.StartsWith ("S:")) { - // curPlayMusicNumberAndCount = curPlayMusicNumberAndCount.Replace ("S:", ""); - - // if (curPlayMusicNumberAndCount.Contains ("/")) { - // musicFileNumber = int.Parse (curPlayMusicNumberAndCount.Split ('/') [0]); - // } - // } - // music.curSongNumber = musicFileNumber < 10 ? "00" + musicFileNumber : (musicFileNumber < 100 ? "0" + musicFileNumber : musicFileNumber.ToString ()); - // //MusicStatusFunction.updateMusicStatus_PlayMusicFileNumber (subnetID, deviceID, music_SourceID, musicFileNumber, iPEndPoint.Address.ToString (), iPEndPoint.Port); - // break; - // case "DISPINFO": - // //褰撳墠鎾斁姝屾洸鐨勭姸鎬侊紝杩斿洖鏍煎紡: #SsDISPINFO,DUR1945,POS0,STATUS2 - // //DUR鍚庢暟鍊硷細涓烘瓕鏇叉挱鏀炬�绘椂闂� 锛堢脳10锛屽疄闄呮椂闂寸殑10鍊嶏級 - // //POS鍚庢暟鍊硷細涓烘瓕鏇插凡鎾斁鏃堕棿 锛堢脳10锛屽疄闄呮椂闂寸殑10鍊嶏級 - // //STATUS鍚庢暟鍊硷細涓�1琛ㄧずstop,涓�2琛ㄧずplay,涓�3琛ㄧずpause - - // if (backResult [1].StartsWith ("DUR") && backResult [2].StartsWith ("POS") && backResult [3].StartsWith ("STATUS")) { - // music.SoundGenerator = backResult [0] [2].ToString (); - // music.musicTime = backResult [1].Replace ("DUR", ""); - // music.musicPalyTime = backResult [2].Replace ("POS", ""); - // music.musicCurPalyStatus = backResult [3] [6].ToString ();//.Replace ("STATUS", "")[0]; - // music.PlayStatus = music.musicCurPalyStatus == "2" ? MusicModel.Status.Play : MusicModel.Status.Stop; - // music.LastDateTime = DateTime.Now; - // } - // // UserMusicModelRoom.UpdateControls(mm1ACK); - // //UserMusicModel.UpdateRoomMusicStatus(mm1ACK); - // break; - - // //鎾斁妯″紡 - // case "DISPMODE": - // if (7 <= backResult [1].Length) { - // music.playMode = int.Parse (backResult [1].Substring (6, 1)); - // System.MainPage.WriteLog ("DISPMODE=====" + music.playMode); - // } - // break; - // } - // } - // } - // break; - // #endregion - // #region 绌鸿皟 - // case Command.ReadPanelTempTypeACK: - // foreach (var room in Room.Lists) { - // foreach (var common in room.DeviceList) { - // if (common.SubnetID != subnetID || common.DeviceID != deviceID || common.LoopID != usefullBytes [0]) { - // continue; - // } - // common.LastUpdateTime = DateTime.Now; - // if (common.Type == DeviceType.ACPanel ) { - // var ac = common as ACPanel; - // ac.TemperatureMode = usefullBytes [0]; - // } - // } - // } - // break; - // case Command.ReadACModeACK: - // case Command.SetACModeACK: - // foreach (var room in Room.Lists) { - // foreach (var common in room.DeviceList) { - // if (common.SubnetID != subnetID || common.DeviceID != deviceID || common.LoopID != usefullBytes [0]) { - // continue; - // } - // common.LastUpdateTime = DateTime.Now; - // if (common.Type == DeviceType.HVAC || common.Type == DeviceType.ACPanel || common.Type == DeviceType.ACInfrared - // || common.Type == DeviceType.LongXiAC) { - // if (common.Type == DeviceType.LongXiAC) { - // var ac = common as LongXiAC; - // ac.TemperatureMode = usefullBytes [1]; - // ac.IndoorTemperature = usefullBytes [2]; - // ac.CoolTemperature = usefullBytes [3]; - // ac.HeatTemperature = usefullBytes [4]; - // ac.AutoTemperature = usefullBytes [5]; - // ac.ChuShiTemperature = usefullBytes [6]; - // ac.RealModeAndFanSpeed = usefullBytes [7]; - // ac.Power = usefullBytes [8]; - // ac.SetMode = usefullBytes [9]; - // ac.SetFanSpeed = usefullBytes [10]; - // ac.Wave = usefullBytes [12]; - // if (usefullBytes.Length == 23) {//棣栧煄鐝戠幒瀹氬埗鐨勬柊椋庣┖璋冨浐浠舵槸涓嶄竴鏍风殑 - // ac.ElectricHeating = usefullBytes [15]; - // ac.Antifreeze = usefullBytes [16]; - // ac.OutTemp = usefullBytes [17] > 50 ? (byte)(0 - (usefullBytes [17] - 50)) : usefullBytes [17]; - // ac.Humidity = usefullBytes [18]; - // ac.TVOC = usefullBytes [19] * 256 + usefullBytes [20]; - // ac.PM25 = usefullBytes [21] * 256 + usefullBytes [22]; - - // } - // if (Application.IsPad) { - // //Pad.UserACPage.UpdateStatus (ac); - // } else { - // UserLongXiACPage.UpdateStatus (ac); - // UserDeviceToAC.UpdateStatus (ac); - // UserRoom.UpdataDeviceStatus (ac); - // } - // } else { - // var ac = common as AC; - // ac.TemperatureMode = usefullBytes [1]; - // ac.IndoorTemperature = usefullBytes [2]; - // ac.CoolTemperature = usefullBytes [3]; - // ac.HeatTemperature = usefullBytes [4]; - // ac.AutoTemperature = usefullBytes [5]; - // ac.ChuShiTemperature = usefullBytes [6]; - // ac.RealModeAndFanSpeed = usefullBytes [7]; - // ac.Power = usefullBytes [8]; - // ac.SetMode = usefullBytes [9]; - // ac.SetFanSpeed = usefullBytes [10]; - // //if (usefullBytes [11] < 16 || usefullBytes [11] == 0) { - // // ac.SetTemperature = (byte)16; - // //} else { - // // ac.SetTemperature = usefullBytes [11]; - // //} - // ac.ShaoFanMode = usefullBytes [12]; - // //IO.F - // if (Application.IsPad) { - // //Pad.UserACPage.UpdateStatus (ac); - // } else { - // UserACPage.UpdateStatus (ac); - // UserDeviceToAC.UpdateStatus (ac); - // UserRoom.UpdataDeviceStatus (ac); - // } - // } - // } - // } - // } - // break; - // case Command.ReadPanleTempACK: - // case Command.PanleBroadcastTemp: - // foreach (var room in Room.Lists) { - // foreach (var common in room.DeviceList) { - // if (common.CommonLoopID == subnetID + "_" + deviceID + "_" + usefullBytes [0]) { - // if (common.Type == DeviceType.ACPanel) { - // var tempAC = common as ACPanel; - // tempAC.IndoorTemperature = usefullBytes [1]; - // UserACPage.UpdateIndoorTemp (tempAC.Type + "_" + tempAC.SubnetID + "_" + tempAC.DeviceID, usefullBytes [1]); - // } else if (common.Type == DeviceType.FoolHeatPanel) { - // var tempFH22 = common as FoolHeatPanel; - // tempFH22.IndoorTemperature = usefullBytes [1]; - // UserFHPage.UpdateIndoorTemp (tempFH22.Type + "_" + tempFH22.SubnetID + "_" + tempFH22.DeviceID, usefullBytes [1]); - // } - // } - // } - // } - // break; - // case Command.InstructionPanelKeyACK: - // case Command.ReadInstructionPanelKeyACK: - // byte reACPanel = 0; - // if (usefullBytes.Length == 2) { - // reACPanel = 1; - // } else if (usefullBytes.Length == 3) { - // reACPanel = usefullBytes [2]; - // } else { - // break; - // } - // foreach (var room in Room.Lists) { - // foreach (var common in room.DeviceList) { - // if (common.SubnetID != subnetID || common.DeviceID != deviceID || common.LoopID != reACPanel) { - // continue; - // } - // common.LastUpdateTime = DateTime.Now; - // if (common.Type == DeviceType.ACPanel) { - // var ac = common as ACPanel; - // switch (usefullBytes [0]) { - // case 3:// - // ac.Power = usefullBytes [1]; - // UserACPage.UpdatePower (ac.CommonLoopID, usefullBytes [1]); - // UserDeviceToAC.UpdatePower (ac.CommonLoopID, usefullBytes [1]); - // UserRoom.Update_ACPanel_Power (ac.Type.ToString () + "_" + ac.CommonLoopID, usefullBytes [1]); - // break; - // case 4: - // ac.CoolTemperature = usefullBytes [1]; - // if (ac.SetMode == 0) { - // ac.SetTemperature = usefullBytes [1]; - // UserACPage.UpdateWorkingTemp (ac.CommonLoopID, usefullBytes [1]); - // UserDeviceToAC.UpdateWorkingTemp (ac.CommonLoopID, usefullBytes [1]); - // UserRoom.Update_ACPanel_WorkingTemp (ac.Type.ToString () + "_" + ac.CommonLoopID, usefullBytes [1], ac.TemperatureMode); - // } - // break; - // case 5: - // ac.SetFanSpeed = usefullBytes [1]; - // UserACPage.UpdateSetFanSpeed (ac.CommonLoopID, usefullBytes [1]); - // UserDeviceToAC.UpdateFanSpeed (ac.CommonLoopID, usefullBytes [1]); - // UserRoom.Update_ACPanel_FanIcon (ac.Type.ToString () + "_" + ac.CommonLoopID, usefullBytes [1]); - // break; - // case 6: - // ac.SetMode = usefullBytes [1]; - // UserACPage.UpdateSetMode (ac.CommonLoopID, usefullBytes [1]); - // UserDeviceToAC.UpdateSetMode (ac.CommonLoopID, usefullBytes [1]); - // UserRoom.Update_ACPanel_ModeIcon (ac.Type.ToString () + "_" + ac.CommonLoopID, usefullBytes [1]); - // break; - // case 7: - // ac.HeatTemperature = usefullBytes [1]; - // if (ac.SetMode == 1) { - // ac.SetTemperature = usefullBytes [1]; - // UserACPage.UpdateWorkingTemp (ac.CommonLoopID, usefullBytes [1]); - // UserDeviceToAC.UpdateWorkingTemp (ac.CommonLoopID, usefullBytes [1]); - // UserRoom.Update_ACPanel_WorkingTemp (ac.Type.ToString () + "_" + ac.CommonLoopID, usefullBytes [1], ac.TemperatureMode); - // } - // break; - // case 8: - // ac.AutoTemperature = usefullBytes [1]; - // if (ac.SetMode == 3) { - // ac.SetTemperature = usefullBytes [1]; - // UserACPage.UpdateWorkingTemp (ac.CommonLoopID, usefullBytes [1]); - // UserDeviceToAC.UpdateWorkingTemp (ac.CommonLoopID, usefullBytes [1]); - // UserRoom.Update_ACPanel_WorkingTemp (ac.Type.ToString () + "_" + ac.CommonLoopID, usefullBytes [1], ac.TemperatureMode); - // } - // break; - // case 19: - // ac.ChuShiTemperature = usefullBytes [1]; - // if (ac.SetMode == 4) { - // ac.SetTemperature = usefullBytes [1]; - // UserACPage.UpdateWorkingTemp (ac.CommonLoopID, usefullBytes [1]); - // UserDeviceToAC.UpdateWorkingTemp (ac.CommonLoopID, usefullBytes [1]); - // UserRoom.Update_ACPanel_WorkingTemp (ac.Type.ToString () + "_" + ac.CommonLoopID, usefullBytes [1], ac.TemperatureMode); - // } - // break; - // } - // if (Application.IsPad) { - // //Pad.UserACPage.UpdateStatus (ac); - // } else { - // //UserACPage.UpdateStatus (ac); - // //UserDeviceToAC.UpdateStatus (ac); - // //UserRoom.UpdataDeviceStatus (ac); - // } - // } else if (common.Type == DeviceType.FoolHeatPanel) { - // var fh = common as FoolHeatPanel; - - // switch (usefullBytes [0]) { - // case 20:// - // fh.Status = usefullBytes [1]; - // UserDeviceToFH.UpdatePower (fh.CommonLoopID, usefullBytes [1]); - // UserFHPage.UpdatePower (fh.CommonLoopID, usefullBytes [1]); - // UserRoom.Update_FoolHeatPanel_Power (fh.Type.ToString () + "_" + fh.CommonLoopID, usefullBytes [1]); - // break; - // case 21: - // fh.TemperatureType = usefullBytes [1]; - // UserFHPage.UpdateWorkingMode (fh.CommonLoopID, usefullBytes [1]); - // if (usefullBytes [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)(usefullBytes [1] + 24), fh.LoopID }, SendCount.Zero); - // break; - // case 25: - // fh.NormalTemperature = usefullBytes [1]; - // if (fh.TemperatureType == 1) { - // fh.WorkingTemperature = usefullBytes [1]; - // UserDeviceToFH.UpdateWorkingTemp (fh.CommonLoopID, usefullBytes [1]); - // UserFHPage.UpdateWorkingTemp (fh.CommonLoopID, usefullBytes [1]); - // UserRoom.Update_FoolHeatPanel_WorkingTemp (fh.Type.ToString () + "_" + fh.CommonLoopID, usefullBytes [1]); - // } - // break; - // case 26: - // fh.DayTemperature = usefullBytes [1]; - // if (fh.TemperatureType == 2) { - // fh.WorkingTemperature = usefullBytes [1]; - // UserDeviceToFH.UpdateWorkingTemp (fh.CommonLoopID, usefullBytes [1]); - // UserFHPage.UpdateWorkingTemp (fh.CommonLoopID, usefullBytes [1]); - // UserRoom.Update_FoolHeatPanel_WorkingTemp (fh.Type.ToString () + "_" + fh.CommonLoopID, usefullBytes [1]); - // } - // break; - // case 27: - // fh.NightTemperature = usefullBytes [1]; - // if (fh.TemperatureType == 3) { - // fh.WorkingTemperature = usefullBytes [1]; - // UserDeviceToFH.UpdateWorkingTemp (fh.CommonLoopID, usefullBytes [1]); - // UserFHPage.UpdateWorkingTemp (fh.CommonLoopID, usefullBytes [1]); - // UserRoom.Update_FoolHeatPanel_WorkingTemp (fh.Type.ToString () + "_" + fh.CommonLoopID, usefullBytes [1]); - // } - // break; - // case 28: - // fh.AwayTemperature = usefullBytes [1]; - // if (fh.TemperatureType == 4) { - // fh.WorkingTemperature = usefullBytes [1]; - // UserDeviceToFH.UpdateWorkingTemp (fh.CommonLoopID, usefullBytes [1]); - // UserFHPage.UpdateWorkingTemp (fh.CommonLoopID, usefullBytes [1]); - // UserRoom.Update_FoolHeatPanel_WorkingTemp (fh.Type + "_" + fh.CommonLoopID, usefullBytes [1]); - // } - // break; - // } - // if (Application.IsPad) { - // //SimpleControl.Pad.UserFHPage.UpdateStatus (fh); - // } else { - // //UserDeviceToFH.UpdateStatus (fh); - // //UserFHPage.UpdateStatus (fh); - // //UserRoom.UpdataDeviceStatus (fh); - // } - // } - // } - // } - - // break; - // case Command.Read_Air_Condition_Set_ack: - // byte acpanelLoopId = 0; - // if (usefullBytes.Length == 10) { - // acpanelLoopId = 1; - // } else if (usefullBytes.Length == 11) { - // acpanelLoopId = usefullBytes [10]; - // } - // foreach (var room in Room.Lists) { - // var common = room.DeviceList.Find ((obj) => obj.SubnetID == subnetID && obj.DeviceID == deviceID && obj.LoopID == usefullBytes [1] && obj.Type == DeviceType.ACPanel); - // if (common == null) - // continue; - // common.LastUpdateTime = DateTime.Now; - // var ac = common as ACPanel; - // ac.Power = usefullBytes [0]; - // ac.CoolTemperature = usefullBytes [1]; - // ac.SetMode = (byte)(usefullBytes [2] >> 4);//妯″紡鍜岄閫� - // ac.SetFanSpeed = (byte)(usefullBytes [2] & 0x0F); - // //绌鸿皟閿� - // ac.SetTemperature = usefullBytes [4];//褰撳墠娓╁害 - // ac.HeatTemperature = usefullBytes [5];//鍒剁儹娓╁害 - // //绌鸿皟瀹為檯杩愯妯″紡鍜岄閫� - // ac.AutoTemperature = usefullBytes [7];//鑷姩娓╁害 - // ac.ChuShiTemperature = usefullBytes [8];//鎶芥箍娓╁害 - // ac.ShaoFanMode = usefullBytes [9];//绌鸿皟鏄惁鎵(浣庡洓浣�) - // if (Application.IsPad) { - - // } else { - // UserACPage.UpdateStatus (ac); - // UserDeviceToAC.UpdateStatus (ac); - // UserRoom.UpdataDeviceStatus (ac); - // } - // } - // break; - // case Command.Set_Air_State_New_ack: - // if (usefullBytes.Length == 15) { - // /// [0]//MODIFY_SUCCESS 1byte - // /// [1]//绌鸿皟椤靛彿(0-8) 1byte - // /// [2]//绌鸿皟寮�鍏�(1寮�0鍏�) 1byte - // /// [3]//鍒跺喎鎺у埗娓╁害(鎽勬皬0-30锛屽崕姘�32-86) 1byte - // /// [4]//鍒剁儹鎺у埗娓╁害(鎽勬皬0-30锛屽崕姘�32-86) 1byte - // /// [5]//鑷姩鎺у埗娓╁害(鎽勬皬0-30锛屽崕姘�32-86) 1byte - // /// [6]//闄ゆ箍鎺у埗娓╁害(鎽勬皬0-30锛屽崕姘�32-86) 1byte - // /// [7]//璁剧疆妯″紡(0鍒跺喎锛�1鍒剁儹锛�2閫氶锛�3鑷姩锛�4闄ゆ箍) 1byte - // /// [8]//璁剧疆椋庨��(0鑷姩锛�1楂橀锛�2涓锛�3浣庨) 1byte //娉ㄦ剰:褰撴ā寮忎负闄ゆ箍鎴栨ā寮忎负閫氶鍙婇閫熶负鑷姩鏃讹紝椋庨�熻涓哄皬椋庝负鍑� - // /// [9]//璁剧疆鎵(0涓嶆壂椋庯紝1鎵) 1byte - // /// [10]//娓╁害妯″紡(鎽勬皬Celsius:0锛屽崕姘廎ahrenheit:1) 1byte - // /// [11]//妯″紡瀹為檯宸ヤ綔鐘舵��(0鍒跺喎锛�1鍒剁儹锛�2閫氶锛�3鑷姩锛�4闄ゆ箍) 1byte - // /// [12]//椋庨�熷疄闄呭伐浣滅姸鎬�(0鍏抽棴锛�1楂橀锛�2涓锛�3浣庨) 1byte - // /// [13]//鎵瀹為檯宸ヤ綔鐘舵��(0涓嶆壂椋庯紝1鎵) 1byte - // /// [14]//鐜娓╁害(鎽勬皬0-40锛屽崕姘�32-99) 1byte - // foreach (var room in Room.Lists) { - // //foreach (var common in room.DeviceList) { - // var common = room.DeviceList.Find ((obj) => obj.SubnetID == subnetID && obj.DeviceID == deviceID && obj.LoopID == usefullBytes [1] && obj.Type == DeviceType.ACPanel); - // if (common == null) - // continue; - // //if (common.SubnetID != subnetID || common.DeviceID != deviceID || common.LoopID != usefullBytes[1]) { - // // continue; - // //} - // common.LastUpdateTime = DateTime.Now; - // var ac = common as ACPanel; - // ac.Power = usefullBytes [2]; - // ac.CoolTemperature = usefullBytes [3]; - // ac.SetMode = usefullBytes [7];//妯″紡鍜岄閫� - // ac.SetFanSpeed = (byte)(usefullBytes [2] & 0x0F); - // //绌鸿皟閿� - // ac.SetTemperature = usefullBytes [4];//褰撳墠娓╁害 - // ac.HeatTemperature = usefullBytes [4];//鍒剁儹娓╁害 - // //绌鸿皟瀹為檯杩愯妯″紡鍜岄閫� - // ac.AutoTemperature = usefullBytes [5];//鑷姩娓╁害 - // ac.ChuShiTemperature = usefullBytes [6];//鎶芥箍娓╁害 - // ac.ShaoFanMode = usefullBytes [9];//绌鸿皟鏄惁鎵(浣庡洓浣�) - // ac.IndoorTemperature = usefullBytes [14]; - // if (Application.IsPad) { - - // } else { - // UserACPage.UpdateStatus (ac); - // UserDeviceToAC.UpdateStatus (ac); - // UserRoom.UpdataDeviceStatus (ac); - // } - // //} - // } - // } - // break; - // #endregion - - // #region 鍦扮儹 - // case Command.Read_Floor_Heat_State_ack: - // foreach (var room in Room.Lists) { - // byte fhLoopId = 1; - // if (usefullBytes.Length == 11) { - // fhLoopId = usefullBytes [10]; - // } - - // var common = room.DeviceList.Find ((obj) => obj.SubnetID == subnetID && obj.DeviceID == deviceID && obj.LoopID == fhLoopId && obj.Type == DeviceType.FoolHeatPanel); - // if (common == null) - // continue; - // /// 1娓╁害妯″紡(鎽勬皬Celsius:0锛屽崕姘廎ahrenheit:1) (1byte) - // /// 2娓╁害婧愭俯搴�(鏈�楂樹綅0:姝�,1:璐�.鍚�7bit涓哄��) (1byte) - // /// 3鍦扮儹鍦板喎寮�鍏筹細锛�0鍏炽��1寮� (1byte) - // /// 4宸ヤ綔娓╁害妯″紡锛�1:鏅��,2:鐧藉ぉ,3:澶滄櫄,4:绂诲紑,5:鏃堕棿 (1-5) (1byte) - // /// 5鏅�氭俯搴� (鎽勬皬0-99锛屽崕姘�32-210) (1byte) - // /// 6鐧藉ぉ娓╁害 (鎽勬皬0-99锛屽崕姘�32-210) (1byte) - // /// 7澶滄櫄娓╁害 (鎽勬皬0-99锛屽崕姘�32-210) (1byte) - // /// 8绂诲紑娓╁害 (鎽勬皬0-99锛屽崕姘�32-210) (1byte) - // /// 9鏃堕棿妯″紡鐨勬椂闂存鏍囧織 (0锛氱櫧澶╋紝1锛氬鏅�) (1byte) //20110112鍔犳椂闂存鏍囧織 - // /// 10妯″紡锛�0鍦扮儹妯″紡銆�1鍦板喎妯″紡銆�2鑷姩 (1byte) //20120802鍔�//20140805鍔犺嚜鍔� - // /// 11鍦扮儹椤靛彿0-8 (1byte)//褰╁睆鍔犲叆20150714 - // var th = common as FoolHeatPanel; - // th.IndoorTemperature = usefullBytes [1] > 128 ? (byte)(0 - (usefullBytes [1] - 128)) : usefullBytes [1]; - // th.Status = usefullBytes [2]; - // th.TemperatureType = usefullBytes [3]; - // th.NormalTemperature = usefullBytes [4]; - // th.DayTemperature = usefullBytes [5]; - // th.NightTemperature = usefullBytes [6]; - // th.AwayTemperature = usefullBytes [7]; - // switch (usefullBytes [3]) { - // case 1://鏅�� - // th.WorkingTemperature = th.NormalTemperature; - // break; - // case 2://鐧藉ぉ - // th.WorkingTemperature = th.DayTemperature; - // break; - // case 3://澶滄櫄 - // th.WorkingTemperature = th.NightTemperature; - // break; - // case 4://绂诲紑 - // th.WorkingTemperature = th.AwayTemperature; - // break; - // case 5://鏃堕棿妯″紡 - // th.Timer = usefullBytes [9]; - // if (usefullBytes [9] == 1)//鏃堕棿妯″紡鐨勬椂闂存鏍囧織 (0锛氱櫧澶╋紝1锛氬鏅�) (1byte) //20110112鍔犳椂闂存鏍囧織 - // th.WorkingTemperature = th.DayTemperature; - // else - // th.WorkingTemperature = th.NightTemperature; - // break; - // } - // UserDeviceToFH.UpdateStatus (th); - // UserFHPage.UpdateStatus (th,fhLoopId); - // UserRoom.UpdataDeviceStatus (th); - // } - // break; - // case Command.Set_Floor_Heat_State_ack: - // foreach (var room in Room.Lists) { - // byte fhLoopId = 1; - // if (usefullBytes.Length == 12) { - // fhLoopId = usefullBytes [11]; - // } - - // var common = room.DeviceList.Find ((obj) => obj.SubnetID == subnetID && obj.DeviceID == deviceID && obj.LoopID == fhLoopId && obj.Type == DeviceType.FoolHeatPanel); - // if (common == null) - // continue; - // /// 1 MODIFY_SUCCESS 1 byte - // /// 2娓╁害妯″紡(鎽勬皬Celsius:0锛屽崕姘廎ahrenheit:1) (1byte) - // /// 3鍦扮儹鍦板喎寮�鍏筹細锛�0鍏炽��1寮� (1byte) - // /// 4宸ヤ綔娓╁害妯″紡锛�1:鏅��,2:鐧藉ぉ,3:澶滄櫄,4:绂诲紑,5:鏃堕棿 (1-5) (1byte) - // /// 5鏅�氭俯搴� (鎽勬皬0-99锛屽崕姘�32-210) (1byte) - // /// 6鐧藉ぉ娓╁害 (鎽勬皬0-99锛屽崕姘�32-210) (1byte) - // /// 7澶滄櫄娓╁害 (鎽勬皬0-99锛屽崕姘�32-210) (1byte) - // /// 8绂诲紑娓╁害 (鎽勬皬0-99锛屽崕姘�32-210) (1byte) - // /// 9鏃堕棿妯″紡鐨勬椂闂存鏍囧織 (0锛氱櫧澶╋紝1锛氬鏅�) (1byte) //20120802鍔� - // /// 10宸ヤ綔妯″紡锛�0鍦扮儹銆�1鍦板喎銆�2鑷姩 (1byte) //20120802鍔�//20140805鍔犺嚜鍔� - // var th = common as FoolHeatPanel; - // th.Status = usefullBytes [2]; - // th.TemperatureType = usefullBytes [3]; - // th.NormalTemperature = usefullBytes [4]; - // th.DayTemperature = usefullBytes [5]; - // th.NightTemperature = usefullBytes [6]; - // th.AwayTemperature = usefullBytes [7]; - // switch (usefullBytes [3]) { - // case 1://鏅�� - // th.WorkingTemperature = th.NormalTemperature; - // break; - // case 2://鐧藉ぉ - // th.WorkingTemperature = th.DayTemperature; - // break; - // case 3://澶滄櫄 - // th.WorkingTemperature = th.NightTemperature; - // break; - // case 4://绂诲紑 - // th.WorkingTemperature = th.AwayTemperature; - // break; - // case 5://鏃堕棿妯″紡 - // th.Timer = usefullBytes [9]; - // if (usefullBytes [9] == 1)//鏃堕棿妯″紡鐨勬椂闂存鏍囧織 (0锛氱櫧澶╋紝1锛氬鏅�) (1byte) //20110112鍔犳椂闂存鏍囧織 - // th.WorkingTemperature = th.DayTemperature; - // else - // th.WorkingTemperature = th.NightTemperature; - // break; - // } - // UserDeviceToFH.UpdateStatus (th); - // UserFHPage.UpdateStatus (th,fhLoopId); - // UserRoom.UpdataDeviceStatus (th); - // } - // break; - // #endregion - // //璇诲彇缃戝叧璁惧鍥炲 - // case Command.ReadGatewayACK: - // if (!LocalPhoneFindDevice) {//r濡傛灉涓嶆槸鏈満鍦ㄦ煡鎵捐澶� - // break; - // } - // if (usefullBytes [0] != RandomHigh | usefullBytes [1] != RandomLow) { - // return; - // } - - // if (GateWayList.Find ((l) => { return l.SubnetID == subnetID && l.DeviceID == deviceID; }) != null) { - // return; - // } - // DeviceType deviceType = (DeviceType)(usefullBytes [2] * 256 + usefullBytes [3]); - // bool notHasRemake = false; - // for (int ki = 0; ki < 20; ki++) { - // if (usefullBytes [13 + ki] != 255) { - // break; - // } else { - // notHasRemake = true; - // } - // } - - // if (notHasRemake) { - // byte [] ddd = CommonPage.MyEncodingGB2312.GetBytes ("Gateway " + subnetID.ToString ()); - // //byte [] newddd = new byte [20]; - // //Array.Copy (ddd, 0, newddd, 0, 20 < ddd.Length ? 20 : ddd.Length); - // Array.Copy (ddd, 0, usefullBytes, 13, 20 < ddd.Length ? 20 : ddd.Length); - // } - // switch (deviceType) { - // case DeviceType.SuperWireless: - // //string macstring = byteToHex16 (usefullBytes [5]) + byteToHex16 (usefullBytes [6]) + byteToHex16 (usefullBytes [7]) + byteToHex16 (usefullBytes [8]) + byteToHex16 (usefullBytes [9]) + byteToHex16 (usefullBytes [10]) + byteToHex16 (usefullBytes [11]) + byteToHex16 (usefullBytes [12]); - // //if (!UserConfig.Instance.GatewayMACList.Contains (macstring) && MainPage.LoginUser.AccountString != "464027401@qq.com") { - // // HasNotInListMAC = true; - // // break; - // //} - // #region - // SuperWireless superWireless = new SuperWireless (); - // string superWirelessPath = "Equipment_" + typeof (SuperWireless).Name + "_" + subnetID + "_" + deviceID; - // var superWirelessbytes = IO.FileUtils.ReadFile (superWirelessPath); - // if (superWirelessbytes.Length > 1) { - // superWireless = Newtonsoft.Json.JsonConvert.DeserializeObject<SuperWireless> (MyEncodingUTF8.GetString (superWirelessbytes)); - // } - // superWireless.SubnetID = subnetID; - // superWireless.DeviceID = deviceID; - // superWireless.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); - - // superWireless.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0');//============= - // superWireless.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; - // superWireless.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; - // superWireless.IPMAC = (char)usefullBytes [41] + "." + (char)usefullBytes [42] + "." + (char)usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; - // superWireless.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; - // superWireless.DHCP = usefullBytes [51] == 0 ? false : true; - // if (usefullBytes.Length == 80) { - // superWireless.EncryptionFlag = usefullBytes [53]; - // superWireless.Password = MyEncodingGB2312.GetString (usefullBytes, 54, 8).Trim ('\0'); - // superWireless.WirelessBand = usefullBytes [62]; - // superWireless.WirelessChannel = usefullBytes [63]; - // superWireless.WirelessPassword = MyEncodingGB2312.GetString (usefullBytes, 64, 16).Trim ('\0'); - // } - // GateWayList.Add (superWireless); - // //IO.FileUtils.SaveEquipmentMessage (superWireless); - // //System.Threading.Tasks.Task.Run (() => { - // // if (string.IsNullOrEmpty (UserConfig.Current.RemoteModeFile)) { - // // var gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, superWireless.SubnetID, superWireless.DeviceID, new byte [] { }); - // // if (gatewayBytes!=null&&gatewayBytes [0] == 2) { - // // UserConfig.Current.RemoteModeFile = "Equipment_" + superWireless.Type.ToString () + "_" + superWireless.SubnetID.ToString () + "_" + superWireless.DeviceID.ToString (); - // // UserConfig.Current.SaveUserConfig (); - // // } - // // } - // //}); - // #endregion - // break; - // case DeviceType.OnePortWirelessFR: - // #region - // OnePortWirelessFR onePortWirelessFR = new OnePortWirelessFR (); - // string wirelessPath = "Equipment_" + typeof (OnePortWirelessFR).Name + "_" + subnetID + "_" + deviceID; - // var bytes = IO.FileUtils.ReadFile (wirelessPath); - // if (bytes.Length > 1) { - // onePortWirelessFR = Newtonsoft.Json.JsonConvert.DeserializeObject<OnePortWirelessFR> (MyEncodingUTF8.GetString (bytes)); - // } - // onePortWirelessFR.SubnetID = subnetID; - // onePortWirelessFR.DeviceID = deviceID; - // onePortWirelessFR.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); - // onePortWirelessFR.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0');//============= - // onePortWirelessFR.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; - // onePortWirelessFR.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; - // onePortWirelessFR.IPMAC = (char)usefullBytes [41] + "." + (char)usefullBytes [42] + "." + (char)usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; - // onePortWirelessFR.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; - // onePortWirelessFR.DHCP = usefullBytes [51] == 0 ? false : true; - // if (usefullBytes.Length == 80) { - // onePortWirelessFR.EncryptionFlag = usefullBytes [53]; - // onePortWirelessFR.Password = MyEncodingGB2312.GetString (usefullBytes, 54, 8).Trim ('\0'); - // onePortWirelessFR.WirelessBand = usefullBytes [62]; - // onePortWirelessFR.WirelessChannel = usefullBytes [63]; - // onePortWirelessFR.WirelessPassword = MyEncodingGB2312.GetString (usefullBytes, 64, 16).Trim ('\0'); - // } - // GateWayList.Add (onePortWirelessFR); - // if (onePortWirelessFR.Name == "") { - // onePortWirelessFR.Name = onePortWirelessFR.CommonLoopID.ToString (); - // } - // //IO.FileUtils.SaveEquipmentMessage (onePortWirelessFR); - // //System.Threading.Tasks.Task.Run (() => { - // // if (string.IsNullOrEmpty (UserConfig.Current.RemoteModeFile)) { - // // var gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, onePortWirelessFR.SubnetID, onePortWirelessFR.DeviceID, new byte [] { }); - // // if (gatewayBytes!=null&&gatewayBytes [0] == 2) { - // // UserConfig.Current.RemoteModeFile = "Equipment_" + onePortWirelessFR.Type.ToString () + "_" + onePortWirelessFR.SubnetID.ToString () + "_" + onePortWirelessFR.DeviceID.ToString (); - // // UserConfig.Current.SaveUserConfig (); - // // } - // // } - // //}); - // #endregion - // break; - // case DeviceType.OnePortBus: - // #region - // OnePortBus onePortBus = new OnePortBus (); - // string onePath = "Equipment_" + typeof (OnePortBus).Name + "_" + subnetID + "_" + deviceID; - // var bytesOne = IO.FileUtils.ReadFile (onePath); - // if (bytesOne.Length > 1) { - // onePortBus = Newtonsoft.Json.JsonConvert.DeserializeObject<OnePortBus> (MyEncodingUTF8.GetString (bytesOne)); - // } - // onePortBus.SubnetID = subnetID; - // onePortBus.DeviceID = deviceID; - // //onePortBus.ChNumberCount = usefullBytes [4]; - // onePortBus.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); - // onePortBus.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0'); ; - // onePortBus.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; - // onePortBus.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; - // onePortBus.IPMAC = (char)usefullBytes [41] + "." + (char)usefullBytes [42] + "." + (char)usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; - // onePortBus.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; - // onePortBus.DHCP = usefullBytes [51] == 0 ? false : true; - // //onePortBus.SubnetID = usefullBytes [52]; - // if (usefullBytes.Length == 53 + 1 + 8) { - // onePortBus.EncryptionFlag = usefullBytes [53]; - // onePortBus.Password = MyEncodingGB2312.GetString (usefullBytes, 54, 8).Trim ('\0'); - // } - // GateWayList.Add (onePortBus); - // if (onePortBus.Name == "") { - // onePortBus.Name = onePortBus.CommonLoopID.ToString (); - // } - // //IO.FileUtils.SaveEquipmentMessage (onePortBus); - // //System.Threading.Tasks.Task.Run (() => { - // // if (string.IsNullOrEmpty (UserConfig.Current.RemoteModeFile)) { - // // var gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, onePortBus.SubnetID, onePortBus.DeviceID, new byte [] { }); - // // if (gatewayBytes!=null&&gatewayBytes [0] == 2) { - // // UserConfig.Current.RemoteModeFile = "Equipment_" + onePortBus.Type.ToString () + "_" + onePortBus.SubnetID.ToString () + "_" + onePortBus.DeviceID.ToString (); - // // UserConfig.Current.SaveUserConfig (); - // // } - // // } - // //}); - // #endregion - // break; - // case DeviceType.RCU: - // RCU RCU_Device = new RCU (); - // string RCU_DevicePath = "Equipment_" + typeof (RCU).Name + "_" + subnetID + "_" + deviceID; - // var RCU_DeviceBytes = IO.FileUtils.ReadFile (RCU_DevicePath); - // if (RCU_DeviceBytes.Length > 1) { - // RCU_Device = Newtonsoft.Json.JsonConvert.DeserializeObject<RCU> (MyEncodingUTF8.GetString (RCU_DeviceBytes)); - // } - // RCU_Device.SubnetID = subnetID; - // RCU_Device.DeviceID = deviceID; - // RCU_Device.LoopID = usefullBytes [4]; - // RCU_Device.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); - // RCU_Device.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0');//============= - // RCU_Device.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; - // RCU_Device.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; - // RCU_Device.IPMAC = (char)usefullBytes [41] + "." + (char)usefullBytes [42] + "." + (char)usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; - // RCU_Device.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; - // RCU_Device.DHCP = usefullBytes [51] == 0 ? false : true; - // RCU_Device.LinkNetworkLine = true; - // GateWayList.Add (RCU_Device); - // if (RCU_Device.Name == "") { - // RCU_Device.Name = RCU_Device.CommonLoopID.ToString (); - // } - // //IO.FileUtils.SaveEquipmentMessage (RCU_Device); - // break; - // case DeviceType.MusicModel: - // MusicModel mm = new MusicModel (); - // GateWayList.Add (mm); - // mm.SubnetID = subnetID; - // mm.DeviceID = deviceID; - // mm.ChNumberCount = usefullBytes [4]; - // mm.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); - // mm.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0');//============= - // mm.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; - // mm.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; - // mm.IPMAC = (char)usefullBytes [41] + "." + (char)usefullBytes [42] + "." + (char)usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; - // mm.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; - // mm.DHCP = 0; - // if (mm.Name == "") { - // mm.Name = mm.CommonLoopID.ToString (); - // } - // IO.FileUtils.SaveEquipmentMessage (mm); - // IO.FileUtils.SaveEquipmentMessage (mm, "1"); - // break; - // case DeviceType.MusicA31: - // MusicA31 mm31 = new MusicA31 (); - // GateWayList.Add (mm31); - // mm31.SubnetID = subnetID; - // mm31.DeviceID = deviceID; - // mm31.ChNumberCount = usefullBytes [4]; - // mm31.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]); - // mm31.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0');//============= - // mm31.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36]; - // mm31.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40]; - // mm31.IPMAC = (char)usefullBytes [41] + "." + (char)usefullBytes [42] + "." + (char)usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46]; - // mm31.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50]; - // mm31.DHCP = usefullBytes [51]; - // if (mm31.Name == "") { - // mm31.Name = mm31.CommonLoopID.ToString (); - // } - // //mm31.SubnetID - // IO.FileUtils.SaveEquipmentMessage (mm31); - // IO.FileUtils.SaveEquipmentMessage (mm31, "1"); - // break; - // default: - - // break; - // } - // break; - // //璇诲彇闈炵綉缁滆澶囧洖澶� - // case Command.ReadDeviceModulACK: - // if (!LocalPhoneFindDevice) {//r濡傛灉涓嶆槸鏈満鍦ㄦ煡鎵捐澶� - // break; - // } - // if (!string.IsNullOrEmpty (SystemMiddle.curGatewayIP) && SystemMiddle.curGatewayIP != revGatewayIP) { - // return; - // } - // if (usefullBytes [0] != RandomHigh || usefullBytes [1] != RandomLow) { - // return; - // } - // if (DeviceList.Find ((l) => { return l.SubnetID == subnetID && l.DeviceID == deviceID; }) != null) { - // return; - // } - - - - // notHasRemake = false; - // for (int ki = 0; ki < 20; ki++) { - // if (usefullBytes [3 + ki] != 255) { - // break; - // } else { - // notHasRemake = true; - // } - // } - // if (usefullBytes [24] == 0) { - - - // } else { - // for (int i = 22; i < usefullBytes.Length; i += 3) { - // if (usefullBytes [i + 2] == 0) { - // continue; - // } - // deviceType = (DeviceType)(usefullBytes [i] * 256 + usefullBytes [i + 1]); - // //MainPage.WriteLog (deviceType.ToString ()); - // //if (notHasRemake ) { - // // byte [] ddd = CommonPage.MyEncodingGB2312.GetBytes (deviceType.ToString () + "-" + subnetID.ToString () + "-" + deviceID.ToString ()); - // // Array.Copy (ddd, 0, usefullBytes, 2, 20 < ddd.Length ? 20 : ddd.Length); - // //} - // if (deviceType.ToString () == (usefullBytes [i] * 256 + usefullBytes [i + 1]).ToString ()) { - // continue; - // } - // if (deviceType == DeviceType.MusicModel || deviceType == DeviceType.RCU || deviceType == DeviceType.MusicPanel) {//|| deviceType == DeviceType.LogicModule) {// || deviceType == DeviceType.FoolHeat){// ||deviceType == DeviceType.InfraredMode) { - // continue; - // } - // if (deviceType == DeviceType.Thermostat) { - // if (i > 24) - // continue; - // } - // Common common = new Common () { - // GatewayMAC = SystemMiddle.curGatewayMAC, - // SubnetID = subnetID, DeviceID = deviceID, - // Name = MyEncodingGB2312.GetString (usefullBytes, 2, 20).Trim ('\0'), Type = deviceType, LoopCount = usefullBytes [i + 2], - // }; - - // DeviceList.Add (common); - // if (i > 24) { - - // common.isMixBox = true; - // common.MixType = (DeviceType)(usefullBytes [22] * 256 + usefullBytes [23]); - // } - // IO.FileUtils.SaveEquipmentMessage (common); - // } - // } - // break; - // //璁惧瀵瑰簲鍥炶矾 - // case Command.ReadDeviceLoopInfoACK: - // MainPage.WriteLog ("ReadDeviceLoopInfoACK : " + LocalPhoneFindDevice); - // if (!LocalPhoneFindDevice) {//r濡傛灉涓嶆槸鏈満鍦ㄦ煡鎵捐澶� - // if (usefullBytes [0] * 256 != 5) - // break; - // //Application.RunOnMainThread (() => { - // // try { - // // new Alert (Language.StringByID (R.MyInternationalizationString.Tip), "ReadDeviceLoopInfoACK fail", Language.StringByID (R.MyInternationalizationString.Close)).Show (); - // // } catch { - // // } - // //}); - // } - // DeviceType deviceType1 = (DeviceType)(usefullBytes [0] * 256 + usefullBytes [1]); - // bool notHasRemake2 = false; - // for (int ki = 0; ki < 20; ki++) { - // if (usefullBytes [3 + ki] != 255) { - // break; - // } else { - // notHasRemake2 = true; - // } - // } - - // //澶勭悊鐗规畩瀛楃 - // for (var remakeIndex = 22; remakeIndex >= 3; remakeIndex--) { - // if (usefullBytes [remakeIndex] == 0xFF) { - // usefullBytes [remakeIndex] = 0; - // } else { - // break; - // } - // } - - // if (notHasRemake2 || MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0') == "") { - // byte [] ddd = CommonPage.MyEncodingGB2312.GetBytes (deviceType1.ToString () + "-" + subnetID.ToString () + "-" + deviceID.ToString () + "-" + usefullBytes [2].ToString ()); - // Array.Copy (ddd, 0, usefullBytes, 3, 20 < ddd.Length ? 20 : ddd.Length); - // } - - // if (null != DeviceLoopList.Find ((common) => { - // return common.Type == deviceType1 && common.SubnetID == subnetID & common.DeviceID == deviceID && common.LoopID == usefullBytes [2]; - // })) { - // //瀛樺湪褰撳墠璁惧灏辫繑鍥� - // return; - // } - - // //if (ModuleType.YIPanel == (ModuleType)(usefullBytes [0] * 256 + usefullBytes [1])){ - // // var yIPanel = new YIPanel () { - // // SubnetID = subnetID, DeviceID = deviceID, Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'), - // // }; - // // IO.FileUtils.SaveEquipmentMessage (yIPanel); - // //} - - // switch (deviceType1) { - // case DeviceType.Thermostat: - // var thermostat = new Thermostat () { - // SubnetID = subnetID, DeviceID = deviceID, LoopID = usefullBytes [2], Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'), - // HostID = usefullBytes[23],ExtensionID = usefullBytes[24] - // }; - // DeviceLoopList.Add (thermostat); - // IO.FileUtils.SaveEquipmentMessage (thermostat, thermostat.LoopID.ToString ()); - // break; - // case DeviceType.FreshAir: - // //閫氶亾鍙凤紙1 - 200锛� + 澶囨敞 + 寮�鍏筹紙0锛�1锛� + 椋庨�燂紙0 鍏筹紝1浣庯紝2涓紝3楂橈級 + 妯″紡锛�0鎵嬪姩锛�1 鑷姩锛� + 鎹㈡皵鎵囷紙0 鍏筹紝1浣庯紝2涓紝3楂橈級 + 瀹ゅ唴娓╁害 + 瀹ゅ娓╁害 + 瀹ゅ唴婀垮害+ PM2.5 + VOC +CO2 - - // FreshAir fresAir = new FreshAir () { - // SubnetID = subnetID, DeviceID = deviceID, LoopID = usefullBytes [2], Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'), - // //SwitchStatus = usefullBytes[23], WindSpeed = usefullBytes [24], SetPattern= usefullBytes [25], InTemp = usefullBytes [26], - // //OutTemp =usefullBytes [27], InHumidity =usefullBytes [28], PM25 = usefullBytes [29], TVOC = usefullBytes [30], CO2 = usefullBytes [31] - // }; - // DeviceLoopList.Add (fresAir); - // IO.FileUtils.SaveEquipmentMessage (fresAir, fresAir.LoopID.ToString ()); - // break; - - // case DeviceType.MusicPanel: - // MusicPanel mm = new MusicPanel (); - // mm.SubnetID = subnetID; - // mm.DeviceID = deviceID; - // mm.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // mm.Status = usefullBytes [23]; - // mm.isMixBox = true; - // DeviceLoopList.Add (mm); - // IO.FileUtils.SaveEquipmentMessage (mm, "1"); - // break; - // case DeviceType.DryContact: - // #region - // DryContact sdc = new DryContact (); - // sdc.SubnetID = subnetID; - // sdc.DeviceID = deviceID; - // sdc.LoopID = usefullBytes [2];//鍓嶄袱浣嶄负闅忔満鏁� - // sdc.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // sdc.Mode = usefullBytes [23]; - // DeviceLoopList.Add (sdc); - // IO.FileUtils.SaveEquipmentMessage (sdc, sdc.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.FoolHeat: - // #region - // var thRDD = new FoolHeat (); - // thRDD.SubnetID = subnetID; - // thRDD.DeviceID = deviceID; - // thRDD.LoopID = usefullBytes [2]; - // thRDD.Name = Encoding.Unicode.GetString (usefullBytes, 3, 20).Trim ('\0'); - // thRDD.Status = usefullBytes [23]; - // thRDD.WorkingMode = usefullBytes [24]; - // thRDD.WorkingTemperature = usefullBytes [25]; - // thRDD.PIDSpeed = usefullBytes [26]; - // thRDD.IndoorTemperature = usefullBytes [27]; - // thRDD.FloorTemperature = usefullBytes [28]; - // DeviceLoopList.Add (thRDD); - // IO.FileUtils.SaveEquipmentMessage (thRDD, thRDD.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.FoolHeatPanel: - // #region - // var thp = new FoolHeatPanel (); - // thp.SubnetID = subnetID; - // thp.DeviceID = deviceID; - // thp.LoopID = usefullBytes [2]; - // thp.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // thp.Status = usefullBytes [23]; - // thp.WorkingMode = usefullBytes [24]; - // thp.WorkingTemperature = usefullBytes [25]; - // thp.PIDSpeed = usefullBytes [26]; - // thp.IndoorTemperature = usefullBytes [27]; - // thp.FloorTemperature = usefullBytes [28]; - // DeviceLoopList.Add (thp); - // IO.FileUtils.SaveEquipmentMessage (thp, thp.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.LightDimming: - // #region - // var lightDimming = new LightDimming (); - // lightDimming.SubnetID = subnetID; - // lightDimming.DeviceID = deviceID; - // lightDimming.LoopID = usefullBytes [2]; - // lightDimming.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // lightDimming.Minimum = usefullBytes [23]; - // lightDimming.MaxLevel = usefullBytes [24]; - // lightDimming.CurrentBrightness = usefullBytes [25]; - - // DeviceLoopList.Add (lightDimming); - // IO.FileUtils.SaveEquipmentMessage (lightDimming, lightDimming.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.LightDALI: - // #region - // /* - // 鍥炶矾鍙凤紝澶囨敞锛屼綆闄愶紝鏈�澶ф按骞筹紝褰撳墠浜害鍊硷紝 24byte - // 鍥炶矾鍦ㄧ嚎(0x00涓嶅湪锛宱xff鍦ㄧ嚎)锛屽洖璺被鍨�(鍏ㄩ儴鏈変寒搴︼紝鍙�8鏈夎壊娓�)锛� 2byte - // 鑹叉俯鐗╃悊鏈�鏆朒 + 鏈�鏆朙锛岃壊娓╃墿鐞嗘渶鍐稨 + 鏈�鍐稬锛� 4byte - // 鑹叉俯鏈�鏆朒 + 鏈�鏆朙锛岃壊娓╂渶鍐稨 + 鏈�鍐稬锛� 4byte - // 褰撳墠鑹叉俯H + L锛� 2byte - // */ - // var lightDALI = new LightDALI (); - // lightDALI.Type = DeviceType.LightDALI; - // lightDALI.SubnetID = subnetID; - // lightDALI.DeviceID = deviceID; - // lightDALI.LoopID = usefullBytes [2]; - // lightDALI.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // lightDALI.Minimum = usefullBytes [23]; - // lightDALI.MaxLevel = usefullBytes [24]; - // if (usefullBytes.Length > 27) { - // //lightDALI.LinkLightStatus = usefullBytes [24]; - // lightDALI.CurrentBrightness = usefullBytes [25]; - // lightDALI.DALIModule = true; - // lightDALI.Online = usefullBytes [26]; - // lightDALI.LoopType = usefullBytes [27]; - // lightDALI.WarmTones_High_Modular = usefullBytes [28]; - // lightDALI.WarmTones_Low_Modular = usefullBytes [29]; - // lightDALI.CoolTones_High_Modular = usefullBytes [30]; - // lightDALI.CoolTones_Low_Modular = usefullBytes [31]; - // lightDALI.WarmTones_High = usefullBytes [32]; - // lightDALI.WarmTones_Low = usefullBytes [33]; - // lightDALI.CoolTones_High = usefullBytes [34]; - // lightDALI.CoolTones_Low = usefullBytes [35]; - // lightDALI.CurTones_High = usefullBytes [36]; - // lightDALI.CurTones_Low = usefullBytes [37]; - // } - // //lightDALI.MinClass = 7; - // DeviceLoopList.Add (lightDALI); - // IO.FileUtils.SaveEquipmentMessage (lightDALI, lightDALI.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.LightSwitch: - // #region - // var lightSwitch = new LightSwitch (); - // lightSwitch.SubnetID = subnetID; - // lightSwitch.DeviceID = deviceID; - // lightSwitch.LoopID = usefullBytes [2]; - // lightSwitch.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // lightSwitch.CurrentBrightness = usefullBytes [23]; - // if (UserConfig.Instance.SocketList.Contains (lightSwitch.CommonLoopID)) { - // lightSwitch.Type = DeviceType.LightSwitchSocket; - // lightSwitch.DeviceTextID = SimpleControl.R.MyInternationalizationString.ElectricalControl; - // } - // DeviceLoopList.Add (lightSwitch); - // IO.FileUtils.SaveEquipmentMessage (lightSwitch, lightSwitch.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.LightEnergySwitch: - // #region - // var lightEnergySwitch = new LightEnergySwitch (); - // lightEnergySwitch.SubnetID = subnetID; - // lightEnergySwitch.DeviceID = deviceID; - // lightEnergySwitch.LoopID = usefullBytes [2]; - // lightEnergySwitch.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // lightEnergySwitch.CurrentBrightness = usefullBytes [23]; - // //if (UserConfig.Current.SocketList.Contains (lightEnergySwitch.CommonLoopID)) { - // // lightEnergySwitch.Type = DeviceType.LightSwitchSocket; - // // lightEnergySwitch.DeviceTextID = SimpleControl.R.MyInternationalizationString.ElectricalControl; - // //} - // DeviceLoopList.Add (lightEnergySwitch); - // IO.FileUtils.SaveEquipmentMessage (lightEnergySwitch, lightEnergySwitch.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.LightMixDimming: - // #region - // var lightMixDimming = new LightMixDimming (); - // lightMixDimming.SubnetID = subnetID; - // lightMixDimming.DeviceID = deviceID; - // lightMixDimming.LoopID = usefullBytes [2]; - // lightMixDimming.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // lightMixDimming.Minimum = usefullBytes [23]; - // lightMixDimming.MaxLevel = usefullBytes [24]; - // lightMixDimming.CurrentBrightness = usefullBytes [25]; - // lightMixDimming.PhysicsLoopID = usefullBytes [26]; - // DeviceLoopList.Add (lightMixDimming); - // IO.FileUtils.SaveEquipmentMessage (lightMixDimming, lightMixDimming.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.LightMixSwitch: - // #region - // var lightMixSwitch = new LightMixSwitch (); - // lightMixSwitch.SubnetID = subnetID; - // lightMixSwitch.DeviceID = deviceID; - // lightMixSwitch.LoopID = usefullBytes [2]; - // lightMixSwitch.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // lightMixSwitch.CurrentBrightness = usefullBytes [23]; - // lightMixSwitch.PhysicsLoopID = usefullBytes [24]; - // DeviceLoopList.Add (lightMixSwitch); - // IO.FileUtils.SaveEquipmentMessage (lightMixSwitch, lightMixSwitch.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.LightRGB: - // var lightRGB = new LightLogic (); - // lightRGB.Type = DeviceType.LightRGB; - // lightRGB.SubnetID = subnetID; - // lightRGB.DeviceID = deviceID; - // lightRGB.LoopID = usefullBytes [2]; - // lightRGB.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // lightRGB.RStatus = usefullBytes [23]; - // lightRGB.GStatus = usefullBytes [24]; - // lightRGB.BStatus = usefullBytes [25]; - // DeviceLoopList.Add (lightRGB); - // IO.FileUtils.SaveEquipmentMessage (lightRGB, lightRGB.LoopID.ToString ()); - // break; - // case DeviceType.LightRGBW: - // //var lightRGBW = new LightLogic (); - // //lightRGBW.Type = DeviceType.LightRGBW; - // //lightRGBW.SubnetID = subnetID; - // //lightRGBW.DeviceID = deviceID; - // //lightRGBW.LoopID = usefullBytes [2]; - // //lightRGBW.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //lightRGBW.RStatus = usefullBytes [23] /100 * 255; - // //lightRGBW.GStatus = usefullBytes [24] /100 * 255; - // //lightRGBW.BStatus = usefullBytes [25] /100 * 255; - // //lightRGBW.WStatus = usefullBytes [26] /100 * 255; - // //DeviceLoopList.Add (lightRGBW); - // //IO.FileUtils.SaveEquipmentMessage (lightRGBW, lightRGBW.LoopID.ToString ()); - // break; - // case DeviceType.LightCCT: - // //var lightCCT = new LightLogic (); - // //lightCCT.Type = DeviceType.LightCCT; - // //lightCCT.SubnetID = subnetID; - // //lightCCT.DeviceID = deviceID; - // //lightCCT.LoopID = usefullBytes [2]; - // //lightCCT.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //lightCCT.CTHStatus = usefullBytes [23]; - // //lightCCT.CTLStatus = usefullBytes [24]; - // //DeviceLoopList.Add (lightCCT); - // //IO.FileUtils.SaveEquipmentMessage (lightCCT, lightCCT.LoopID.ToString ()); - // break; - // case DeviceType.LightRGBandCCT: - // //var lightRGBandCCT = new LightLogic (); - // //lightRGBandCCT.Type = DeviceType.LightRGBandCCT; - // //lightRGBandCCT.SubnetID = subnetID; - // //lightRGBandCCT.DeviceID = deviceID; - // //lightRGBandCCT.LoopID = usefullBytes [2]; - // //lightRGBandCCT.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //lightRGBandCCT.RStatus = usefullBytes [23] /100 * 255; - // //lightRGBandCCT.GStatus = usefullBytes [24] /100 * 255; - // //lightRGBandCCT.BStatus = usefullBytes [25] /100 * 255; - // //lightRGBandCCT.CTHStatus = usefullBytes [26]; - // //lightRGBandCCT.CTLStatus = usefullBytes [27]; - // //DeviceLoopList.Add (lightRGBandCCT); - // //IO.FileUtils.SaveEquipmentMessage (lightRGBandCCT, lightRGBandCCT.LoopID.ToString ()); - // break; - // case DeviceType.CurtainModel: - // #region - // var curtain = new CurtainModel (); - // curtain.SubnetID = subnetID; - // curtain.DeviceID = deviceID; - // curtain.LoopID = usefullBytes [2]; - // curtain.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // curtain.RunTime = (usefullBytes [23] * 256 + usefullBytes [24])/10; - // curtain.Status = (CurtainStatus)(usefullBytes [25]); - // DeviceLoopList.Add (curtain); - // FileUtils.SaveEquipmentMessage (curtain, curtain.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.CurtainTrietex: - // #region - // var curtaintrietex = new CurtainTrietex (); - // curtaintrietex.SubnetID = subnetID; - // curtaintrietex.DeviceID = deviceID; - // curtaintrietex.LoopID = usefullBytes [2]; - // curtaintrietex.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // curtaintrietex.CurtainLength = usefullBytes [23] * 256 + usefullBytes [24]; - // //curtaintrietex.Status = (CurtainStatus)(usefullBytes [24]); - // curtaintrietex.CurtainProress = usefullBytes [25]; - // curtaintrietex.MotorRotation = usefullBytes [26]; - // DeviceLoopList.Add (curtaintrietex); - // FileUtils.SaveEquipmentMessage (curtaintrietex, curtaintrietex.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.CurtainRoller: - // #region - // var CurtainRoller = new CurtainRoller (); - // CurtainRoller.SubnetID = subnetID; - // CurtainRoller.DeviceID = deviceID; - // CurtainRoller.LoopID = usefullBytes [2]; - // CurtainRoller.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // CurtainRoller.CurtainProress = usefullBytes [23]; - // CurtainRoller.MotorRotation = usefullBytes [24]; - // DeviceLoopList.Add (CurtainRoller); - // FileUtils.SaveEquipmentMessage (CurtainRoller, CurtainRoller.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.HVAC: - // #region - // var acHost = new HVAC (); - // acHost.SubnetID = subnetID; - // acHost.DeviceID = deviceID; - // acHost.LoopID = usefullBytes [2]; - - // acHost.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // DeviceLoopList.Add (acHost); - // IO.FileUtils.SaveEquipmentMessage (acHost, acHost.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.ACPanel: - // #region - // var acPanel = new ACPanel (); - // acPanel.SubnetID = subnetID; - // acPanel.DeviceID = deviceID; - // acPanel.LoopID = usefullBytes [2]; - // acPanel.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // DeviceLoopList.Add (acPanel); - // IO.FileUtils.SaveEquipmentMessage (acPanel, acPanel.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.ButtonPanel: - // #region MyRegion - // if (usefullBytes [23] == 255) - // break; - // ButtonPanel wirelessPanelButtonKey = new ButtonPanel (); - // DeviceLoopList.Add (wirelessPanelButtonKey); - // wirelessPanelButtonKey.SubnetID = subnetID; - // wirelessPanelButtonKey.DeviceID = deviceID; - // wirelessPanelButtonKey.LoopID = usefullBytes [2]; - // wirelessPanelButtonKey.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // wirelessPanelButtonKey.Mode = usefullBytes [23]; - // ButtonBkeyModelList.Add (wirelessPanelButtonKey.Mode); - // System.MainPage.WriteLog ("璇诲彇闈㈡澘鎸夐敭锛氬洖璺彿锛�" + wirelessPanelButtonKey.LoopID + " 妯″紡锛�" + wirelessPanelButtonKey.Mode); - // IO.FileUtils.SaveEquipmentMessage (wirelessPanelButtonKey, wirelessPanelButtonKey.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.InfraredMode: - // #region 绾㈠妯″潡 - // InfraredMode infrared = new InfraredMode (); - // DeviceLoopList.Add (infrared); - // infrared.SubnetID = subnetID; - // infrared.DeviceID = deviceID; - // infrared.LoopID = usefullBytes [2]; - // infrared.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // IO.FileUtils.SaveEquipmentMessage (infrared, infrared.LoopID.ToString ()); - // SystemWirelessGateway.Waiting = true; - // try { - // Control.ControlBytesSendHasReturn (Command.DownloadInfrared, subnetID, deviceID, new byte [] { usefullBytes [2], 0, 0 }); - // SystemWirelessGateway.Waiting = false; - // } catch { - // SystemWirelessGateway.Waiting = false; - // } - // #endregion - // break; - // case DeviceType.ACInfrared: - // #region - // var acInfrared = new ACInfrared (); - // acInfrared.SubnetID = subnetID; - // acInfrared.DeviceID = deviceID; - // acInfrared.LoopID = usefullBytes [2]; - // acInfrared.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // DeviceLoopList.Add (acInfrared); - // IO.FileUtils.SaveEquipmentMessage (acInfrared, acInfrared.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.SecurityModule: - // #region 瀹夐槻妯″潡 - // var SecurityMould = new SecurityModul (); - // SecurityMould.SubnetID = subnetID; - // SecurityMould.DeviceID = deviceID; - // SecurityMould.LoopID = usefullBytes [2]; - // SecurityMould.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // SecurityMould.AreaType = usefullBytes [23]; - // DeviceLoopList.Add (SecurityMould); - // IO.FileUtils.SaveEquipmentMessage (SecurityMould, SecurityMould.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.FanModule: - // #region 椋庢墖妯″潡 - // var fanModule = new FanModule (); - // fanModule.SubnetID = subnetID; - // fanModule.DeviceID = deviceID; - // fanModule.LoopID = usefullBytes [2]; - // fanModule.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // fanModule.WindSpeed = 1; - // //fanModule.WindSpeed = usefullBytes [23]; - // IO.FileUtils.SaveEquipmentMessage (fanModule, fanModule.LoopID.ToString ()); - // #endregion - // break; - // case DeviceType.LogicModule: - // LogicModule logicModule = new LogicModule (); - // logicModule.SubnetID = subnetID; - // logicModule.DeviceID = deviceID; - // logicModule.LoopID = usefullBytes [2]; - // logicModule.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // logicModule.AreaID = usefullBytes [23]; - // logicModule.AreaSceneID = usefullBytes [24]; - // IO.FileUtils.SaveEquipmentMessage (logicModule, logicModule.LoopID.ToString ()); - // break; - // case DeviceType.DoorLock: - // var doorLock = new DoorLock ();//闂ㄩ攣111 - // doorLock.SubnetID = subnetID; - // doorLock.DeviceID = deviceID; - // doorLock.LoopID = usefullBytes [2]; - // doorLock.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // DeviceLoopList.Add (doorLock); - // IO.FileUtils.SaveEquipmentMessage (doorLock, doorLock.LoopID.ToString ()); - // UserConfig.Instance.HideDeviceTypes.Remove (R.MyInternationalizationString.DoorLock); - // UserConfig.Instance.SaveUserConfig (); - // break; - // #region 浼犳劅鍣� - // case DeviceType.SensorMobileDetection: - // //var sensor = new SensorMobileDetection (); - // //sensor.SubnetID = subnetID; - // //sensor.DeviceID = deviceID; - // //sensor.LoopID = usefullBytes [2]; - // //sensor.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor.Sensitivity = usefullBytes [24]; - // //sensor.Status = usefullBytes [25]; - // //IO.FileUtils.SaveEquipmentMessage (sensor, sensor.LoopID.ToString ()); - // break; - // /// <summary> - // /// 娓╁害 - // /// </summary> - // case DeviceType.SensorTemperature: - // var sensor1 = new SensorTemperature (); - // sensor1.SubnetID = subnetID; - // sensor1.DeviceID = deviceID; - // sensor1.LoopID = usefullBytes [2]; - // sensor1.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // byte [] tempBytes = new byte [] { usefullBytes [24], usefullBytes [25], usefullBytes [26], usefullBytes [27] }; - // sensor1.CurrentTemperature = Math.Round (BitConverter.ToSingle (tempBytes, 0), 1); - // bool inLocal1 = false; - // foreach (var room in Room.Lists) { - // var roomSensor = room.DeviceList.Find ((obj) => obj.MinClass == sensor1.MinClass && obj.SubnetID == sensor1.SubnetID && obj.DeviceID == sensor1.DeviceID && obj.LoopID == sensor1.LoopID); - // if (roomSensor != null) { - // (roomSensor as SensorTemperature).CurrentTemperature = sensor1.CurrentTemperature; - // inLocal1 = true; - // } - // } - // //if(!inLocal1){ - // IO.FileUtils.SaveEquipmentMessage (sensor1, sensor1.LoopID.ToString ()); - // //} - // break; - // /// <summary> - // /// 婀垮害 - // /// </summary> - // case DeviceType.SensorHumidity: - // var sensor2 = new SensorHumidity (); - // sensor2.SubnetID = subnetID; - // sensor2.DeviceID = deviceID; - // sensor2.LoopID = usefullBytes [2]; - // sensor2.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // sensor2.Enable = usefullBytes [23] == 1 ? true : false; - // sensor2.CurrentHumidity = Convert.ToDouble (usefullBytes [24] * 256 + usefullBytes [25]) / 10; - // bool inLocal2 = false; - // foreach (var room in Room.Lists) { - // var roomSensor = room.DeviceList.Find ((obj) => obj.MinClass == sensor2.MinClass && obj.SubnetID == sensor2.SubnetID && obj.DeviceID == sensor2.DeviceID && obj.LoopID == sensor2.LoopID); - // if (roomSensor != null) { - // (roomSensor as SensorHumidity).CurrentHumidity = sensor2.CurrentHumidity; - // inLocal2 = true; - // } - // } - // //if(!inLocal2){ - // IO.FileUtils.SaveEquipmentMessage (sensor2, sensor2.LoopID.ToString ()); - // //} - // break; - // ///// <summary> - // ///// 鍏夌収 - // ///// </summary> - // case DeviceType.SensorIllumination: - // //var sensor3 = new SensorIllumination (); - // //sensor3.SubnetID = subnetID; - // //sensor3.DeviceID = deviceID; - // //sensor3.LoopID = usefullBytes [2]; - // //sensor3.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor3.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor3.CurrentIllumination = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor3, sensor3.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// TVOC锛�05锛� - // ///// </summary> - // case DeviceType.SensorTVOC: - // var sensor4 = new SensorTVOC (); - // sensor4.SubnetID = subnetID; - // sensor4.DeviceID = deviceID; - // sensor4.LoopID = usefullBytes [2]; - // sensor4.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // sensor4.Enable = usefullBytes [23] == 1 ? true : false; - // sensor4.CurrentTVOC = Convert.ToDouble (usefullBytes [24] * 256 + usefullBytes [25]) / 100; - // bool inLocal3 = false; - // foreach (var room in Room.Lists) { - // var roomSensor = room.DeviceList.Find ((obj) => obj.MinClass == sensor4.MinClass && obj.SubnetID == sensor4.SubnetID && obj.DeviceID == sensor4.DeviceID && obj.LoopID == sensor4.LoopID); - // if (roomSensor != null) { - // inLocal3 = true; - // (roomSensor as SensorTVOC).CurrentTVOC = sensor4.CurrentTVOC; - // } - // } - // //if (!inLocal3) { - // IO.FileUtils.SaveEquipmentMessage (sensor4, sensor4.LoopID.ToString ()); - // //} - // break; - // ///// <summary> - // ///// The sensor PM 25. - // ///// </summary> - // case DeviceType.SensorPM25: - // var sensor5 = new SensorPM25 (); - // sensor5.SubnetID = subnetID; - // sensor5.DeviceID = deviceID; - // sensor5.LoopID = usefullBytes [2]; - // sensor5.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // sensor5.Enable = usefullBytes [23] == 1 ? true : false; - // sensor5.CurrentPM25 = Convert.ToInt32 (usefullBytes [24] * 256 + usefullBytes [25]); - // bool inLocal4 = false; - // foreach (var room in Room.Lists) { - // var roomSensor = room.DeviceList.Find ((obj) => obj.MinClass == sensor5.MinClass && obj.SubnetID == sensor5.SubnetID && obj.DeviceID == sensor5.DeviceID && obj.LoopID == sensor5.LoopID); - // if (roomSensor != null) { - // (roomSensor as SensorPM25).CurrentPM25 = sensor5.CurrentPM25; - // inLocal4 = true; - // } - // } - // //if(!inLocal4){ - // IO.FileUtils.SaveEquipmentMessage (sensor5, sensor5.LoopID.ToString ()); - // //} - // break; - // ///// <summary> - // ///// The sensor CO2. - // ///// </summary> - // case DeviceType.SensorCO2: - // var sensor6 = new SensorCO2 (); - // sensor6.SubnetID = subnetID; - // sensor6.DeviceID = deviceID; - // sensor6.LoopID = usefullBytes [2]; - // sensor6.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // sensor6.Enable = usefullBytes [23] == 1 ? true : false; - // sensor6.CurrentCO2 = Convert.ToInt32 (usefullBytes [24] * 256 + usefullBytes [25]); - // bool inLocal5 = false; - // foreach (var room in Room.Lists) { - // var roomSensor = room.DeviceList.Find ((obj) => obj.MinClass == sensor6.MinClass && obj.SubnetID == sensor6.SubnetID && obj.DeviceID == sensor6.DeviceID && obj.LoopID == sensor6.LoopID); - // if (roomSensor != null) { - // (roomSensor as SensorCO2).CurrentCO2 = sensor6.CurrentCO2; - // inLocal5 = true; - // } - // } - // //if(!inLocal5) - // //{ - // IO.FileUtils.SaveEquipmentMessage (sensor6, sensor6.LoopID.ToString ()); - // //} - // break; - // ///// <summary> - // ///// 娑插寲鐭虫补姘旓紙LPG锛夛紙08锛� - // ///// </summary> - // //SensorLPG = 0x0508, - // case DeviceType.SensorLPG: - // //var sensor7 = new SensorLPG (); - // //sensor7.SubnetID = subnetID; - // //sensor7.DeviceID = deviceID; - // //sensor7.LoopID = usefullBytes [2]; - // //sensor7.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor7.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor7.CurrentLPG = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor7, sensor7.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 浜哄伐鐓ゆ皵锛圕O锛孒2锛夛紙09锛� - // ///// </summary> - // case DeviceType.SensorCOH2: - // //var sensor8 = new SensorCOH2 (); - // //sensor8.SubnetID = subnetID; - // //sensor8.DeviceID = deviceID; - // //sensor8.LoopID = usefullBytes [2]; - // //sensor8.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor8.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor8.CurrentCOH2 = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor8, sensor8.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 澶╃劧姘旓紙CH4锛夛紙10锛� - // ///// </summary> - // case DeviceType.SensorCH4: - // //var sensor9 = new SensorCH4 (); - // //sensor9.SubnetID = subnetID; - // //sensor9.DeviceID = deviceID; - // //sensor9.LoopID = usefullBytes [2]; - // //sensor9.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor9.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor9.CurrentCH4 = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor9, sensor9.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 鐑熼浘锛�11锛� - // ///// </summary> - // case DeviceType.SensorSmoke: - // //var sensor10 = new SensorSmoke (); - // //sensor10.SubnetID = subnetID; - // //sensor10.DeviceID = deviceID; - // //sensor10.LoopID = usefullBytes [2]; - // //sensor10.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor10.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor10.CurrentStatus = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor10, sensor10.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 椋庨�燂紙12锛� - // ///// </summary> - // case DeviceType.SensorWindSpeed: - // //var sensor11 = new SensorWindSpeed (); - // //sensor11.SubnetID = subnetID; - // //sensor11.DeviceID = deviceID; - // //sensor11.LoopID = usefullBytes [2]; - // //sensor11.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor11.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor11.CurrentWindSpeed = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor11, sensor11.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 椋庡帇锛�13锛� - // ///// </summary> - // case DeviceType.SensorWindPressure: - // //var sensor12 = new SensorWindPressure (); - // //sensor12.SubnetID = subnetID; - // //sensor12.DeviceID = deviceID; - // //sensor12.LoopID = usefullBytes [2]; - // //sensor12.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor12.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor12.CurrentWindPressure = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor12, sensor12.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 娑蹭綋娴侀噺锛�14锛� - // ///// </summary> - // case DeviceType.SensorLiquidFlow: - // //var sensor13 = new SensorLiquidFlow (); - // //sensor13.SubnetID = subnetID; - // //sensor13.DeviceID = deviceID; - // //sensor13.LoopID = usefullBytes [2]; - // //sensor13.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor13.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor13.CurrentLiquidFlow = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor13, sensor13.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 娑蹭綋鍘嬪姏锛�15锛� - // ///// </summary> - // case DeviceType.SensorLiquidPressure: - // //var sensor14 = new SensorLiquidPressure (); - // //sensor14.SubnetID = subnetID; - // //sensor14.DeviceID = deviceID; - // //sensor14.LoopID = usefullBytes [2]; - // //sensor14.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor14.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor14.CurrentLiquidPressure = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor14, sensor14.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 娑蹭綋娣卞害锛�16锛� - // ///// </summary> - // case DeviceType.SensorLiquidDepth: - // //var sensor15 = new SensorLiquidDepth (); - // //sensor15.SubnetID = subnetID; - // //sensor15.DeviceID = deviceID; - // //sensor15.LoopID = usefullBytes [2]; - // //sensor15.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor15.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor15.CurrentLiquidDepth = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor15, sensor15.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 闆ㄩ噺锛�17锛� - // ///// </summary> - // //SensorRainfall = 0x0517, - // case DeviceType.SensorRainfall: - // //var sensor16 = new SensorRainfall (); - // //sensor16.SubnetID = subnetID; - // //sensor16.DeviceID = deviceID; - // //sensor16.LoopID = usefullBytes [2]; - // //sensor16.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor16.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor16.CurrentRainfall = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor16, sensor16.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 閲嶉噺 - // ///// </summary> - // case DeviceType.SensorWeight: - // //var sensor17 = new SensorWeight (); - // //sensor17.SubnetID = subnetID; - // //sensor17.DeviceID = deviceID; - // //sensor17.LoopID = usefullBytes [2]; - // //sensor17.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor17.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor17.CurrentWeight = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor17, sensor17.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 楂樺害/闀垮害 - // ///// </summary> - // case DeviceType.SensorHeightLength: - // //var sensor18 = new SensorHeightLength (); - // //sensor18.SubnetID = subnetID; - // //sensor18.DeviceID = deviceID; - // //sensor18.LoopID = usefullBytes [2]; - // //sensor18.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor18.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor18.CurrentHeightLength = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor18, sensor18.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 鐗╀綋閫熷害锛�20锛� - // ///// </summary> - // case DeviceType.SensorVelocity: - // //var sensor19 = new SensorVelocity (); - // //sensor19.SubnetID = subnetID; - // //sensor19.DeviceID = deviceID; - // //sensor19.LoopID = usefullBytes [2]; - // //sensor19.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor19.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor19.CurrentVelocity = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor19, sensor19.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 闇囧姩锛�21锛� - // ///// </summary> - // case DeviceType.SensorVibration: - // //var sensor20 = new SensorVibration (); - // //sensor20.SubnetID = subnetID; - // //sensor20.DeviceID = deviceID; - // //sensor20.LoopID = usefullBytes [2]; - // //sensor20.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor20.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor20.CurrentVibration = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor20, sensor20.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 鐢靛帇 - // ///// </summary> - // case DeviceType.SensorVoltage: - // //var sensor21 = new SensorVoltage (); - // //sensor21.SubnetID = subnetID; - // //sensor21.DeviceID = deviceID; - // //sensor21.LoopID = usefullBytes [2]; - // //sensor21.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor21.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor21.CurrentVoltage = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor21, sensor21.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 鐢垫祦 - // ///// </summary> - // case DeviceType.SensorCurrent: - // //var sensor22 = new SensorCurrent (); - // //sensor22.SubnetID = subnetID; - // //sensor22.DeviceID = deviceID; - // //sensor22.LoopID = usefullBytes [2]; - // //sensor22.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor22.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor22.CurrentCurrent = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor22, sensor22.LoopID.ToString ()); - // break; - // ///// <summary> - // ///// 鍔熺巼 - // ///// </summary> - // case DeviceType.SensorPower: - // //var sensor23 = new SensorPower (); - // //sensor23.SubnetID = subnetID; - // //sensor23.DeviceID = deviceID; - // //sensor23.LoopID = usefullBytes [2]; - // //sensor23.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0'); - // //sensor23.Enable = usefullBytes [23] == 1 ? true : false; - // //sensor23.CurrentPower = Convert.ToInt32(usefullBytes [24] * 256 + usefullBytes [25]); - // //IO.FileUtils.SaveEquipmentMessage (sensor23, sensor23.LoopID.ToString ()); - // break; - - // #endregion - // default: - // //DeviceLoopList.Add (new Common () { SubnetID = subnetID, DeviceID = deviceID }); - // break; - // } - // MainPage.WriteLog ("ReadDeviceLoopInfoACK " + deviceType1); - // break; - // case Command.WriteWirelessPanelButtonKey: - // //01 01 59(+30) 02 0D 03 64 00 01 - // break; - // case Command.AssignedAddressACK: - // MainPage.WriteLog (usefullBytes [0].ToString ()); - // if (usefullBytes [0] == 3) { - // dt = DateTime.Now; - // } else if (usefullBytes [0] == 4) { - // dt = System.DateTime.MinValue; - // } - // break; - // case Command.Remote3thACK: - // MainPage.WriteLog (usefullBytes [0]); - // break; - // case Command.DownloadInfraredACK: - // string loopID_IM = usefullBytes [0] < 10 ? "0" + usefullBytes [0].ToString () : usefullBytes [0].ToString (); - // if ((InfraredType)usefullBytes [2] != InfraredType.AC) { - // if ((InfraredType)usefullBytes [2] == InfraredType.NULL) { - // MainPage.WriteLog ("NULL-------------"); - // } - // string filePath = "Equipment_InfraredMode_" + subnetID + "_" + deviceID + "_" + loopID_IM; - // InfraredMode im = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (filePath))); - // im.InfraredType = (InfraredType)usefullBytes [2]; - // MainPage.WriteLog (im.InfraredType.ToString () + "----------------------------------------"); - // IO.FileUtils.SaveEquipmentMessage (im, im.LoopID.ToString ()); - // } - // break; - // } - //} catch (Exception ex) { - // MainPage.WriteLog ("Packet_ReceiveEvent锛�" + ex.ToString ()); - //} } /// <summary> @@ -2699,34 +139,6 @@ } else if (nameValueCollection ["Command"].StartsWith ("Upload")) { string path = Application.RootPath + nameValueCollection ["Command"].Replace ("Upload", ""); string dePath = nameValueCollection ["Command"].Replace ("Upload", ""); - //if (dePath.Contains ("Room_")) { - // new Room ().Add (dePath); - //} - //if (dePath.Split ('_').Length == 5) { - // if (dePath.Split ('_') [1] == (typeof (OnePortBus).Name) || dePath.Split ('_') [1] == (typeof (OnePortWirelessFR).Name)) { - // UserConfig.Instance.RemoteModeFile = dePath; - // UserConfig.Instance.SaveUserConfig (); - // } - // if (dePath.Split ('_') [1] == (typeof (SecurityModul).Name)) { - // if (UserConfig.Instance.HideDeviceTypes.Contains ((InternationalizationString.Security))) { - // UserConfig.Instance.HideDeviceTypes.Remove (InternationalizationString.Security); - // UserConfig.Instance.SaveUserConfig (); - // } - // } - //} - - //if (dePath.Split ('_').Length == 2 && dePath.StartsWith ("GlobalScene")) { - // var sceneFileList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>> (System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (Scene.GlobalSceneFilePath))); - // if (!sceneFileList.Contains (dePath)) { - // sceneFileList.Add (dePath); - // IO.FileUtils.WriteFileByBytes (Scene.GlobalSceneFilePath, CommonPage.MyEncodingUTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (sceneFileList))); - // } - //} - //FileUtils.WriteFileByInputStream (path, inputStream); - //Common common = Newtonsoft.Json.JsonConvert.DeserializeObject<Common> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (path))); - //if (common.DeviceTextID == R.MyInternationalizationString.ElectricalControl) { - // UserConfig.Instance.SocketList.Add (common.CommonLoopID); - //} } else { byte [] bytes = System.Text.Encoding.UTF8.GetBytes ("璇锋眰鍛戒护鏃犳晥锛�"); outputStream.Write (bytes, 0, bytes.Length); @@ -2745,19 +157,6 @@ /// 闅忔満鏁颁綆浣� /// </summary> public static byte RandomLow; - - /// <summary> - /// 璁惧鍒楄〃 - /// </summary> - public static System.Collections.Generic.List<Common> DeviceList = new System.Collections.Generic.List<Common> (); - /// <summary> - /// 缃戝叧璁惧鍒楄〃 - /// </summary> - public static System.Collections.Generic.List<Common> GateWayList = new System.Collections.Generic.List<Common> (); - /// <summary> - /// 璁惧瀵瑰簲鍥炶矾鍒楄〃 - /// </summary> - public static System.Collections.Generic.List<Common> DeviceLoopList = new System.Collections.Generic.List<Common> (); /// <summary> /// Updates Device's remake. -- Gitblit v1.8.0