From c1de48884fa145a16a0f8bcee93274dcfaa0ff82 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期四, 07 五月 2020 10:40:28 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into dev-2020xm --- ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs | 420 ----------------------------------------------------------- 1 files changed, 2 insertions(+), 418 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs index 09952d0..05f1cf9 100644 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs @@ -101,7 +101,7 @@ } } - #region variable + #region variable /// <summary> /// 杩滅▼杩炴帴鎴愬姛鏃剁殑鏃堕棿 /// </summary> @@ -600,422 +600,6 @@ return d; }); - } - #endregion - - #region 鑾峰彇宸插叆缃戣澶囦俊鎭� - /// <summary> - /// 鑾峰彇缃戝叧璁惧淇℃伅(娉ㄦ剰锛岃繖涓帴鍙d細琚幓鎺夛級 - /// </summary> - public async System.Threading.Tasks.Task<List<CommonDevice>> GetGwDeviceList() - { - DeviceList.Clear(); - return await System.Threading.Tasks.Task.Run((Func<System.Threading.Tasks.Task<List<CommonDevice>>>)(async () => - { - var dateTime = DateTime.Now; - bool canBreak = false; - Action<string, string> action = (topic, message) => - { - var gatewayID = topic.Split('/')[0]; - var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); - - if (topic == gatewayID + "/" + "DeviceInfoRespon") - { - dateTime = DateTime.Now; - var totalNum = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["TotalNum"].ToString()); - if (totalNum == 0) - { - canBreak = true; - return; - } - var deviceID = jobject.Value<int>("Device_ID"); - switch ((DeviceType)(deviceID)) - { - //case DeviceType.DimmableLight: - // var dimmableLight = new DimmableLight() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = this.getGatewayBaseInfo?.gwID }; - // dimmableLight.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<DimmableLight.DeviceInfoData>(jobject["Data"].ToString()); - // if (dimmableLight.DeviceInfo == null) - // { - // return; - // } - // var light = DeviceList.Find(obj => obj.DeviceID == dimmableLight.DeviceID && obj.DeviceAddr == dimmableLight.DeviceAddr && obj.DeviceEpoint == dimmableLight.DeviceEpoint); - // if (light == null) - // { - // DeviceList.Add(dimmableLight); - // dimmableLight.DeviceName = dimmableLight.DeviceInfo.MacName; - // dimmableLight.DeviceEpointName = dimmableLight.DeviceInfo.DeviceName; - // dimmableLight.ImgVersion = dimmableLight.DeviceInfo.ImgVersion; - // dimmableLight.HwVersion = dimmableLight.DeviceInfo.HwVersion; - // dimmableLight.IsOnline = dimmableLight.DeviceInfo.IsOnline; - // dimmableLight.DriveCode = dimmableLight.DeviceInfo.DriveCode; - // dimmableLight.ImgTypeId = dimmableLight.DeviceInfo.ImgTypeId; - // dimmableLight.IasDeviceType = dimmableLight.DeviceInfo.DeviceType; - // dimmableLight.Profile = dimmableLight.DeviceInfo.Profile; - // dimmableLight.InClusterList = dimmableLight.DeviceInfo.InClusterList; - // dimmableLight.OutClusterList = dimmableLight.DeviceInfo.OutClusterList; - // dimmableLight.AttributeStatus = dimmableLight.DeviceInfo.AttributeStatus; - // //dimmableLight.Save(); - // } - // else - // { - // light.DeviceInfo = dimmableLight.DeviceInfo; - // light.DeviceName = dimmableLight.DeviceInfo.MacName; - // light.DeviceEpointName = dimmableLight.DeviceInfo.DeviceName; - // light.ImgVersion = dimmableLight.DeviceInfo.ImgVersion; - // light.HwVersion = dimmableLight.DeviceInfo.HwVersion; - // light.IsOnline = dimmableLight.DeviceInfo.IsOnline; - // light.DriveCode = dimmableLight.DeviceInfo.DriveCode; - // light.ImgTypeId = dimmableLight.DeviceInfo.ImgTypeId; - // light.IasDeviceType = dimmableLight.DeviceInfo.DeviceType; - // light.Profile = dimmableLight.DeviceInfo.Profile; - // light.InClusterList = dimmableLight.DeviceInfo.InClusterList; - // light.OutClusterList = dimmableLight.DeviceInfo.OutClusterList; - // light.AttributeStatus = dimmableLight.DeviceInfo.AttributeStatus; - // //dimmableLight.ReSave(); - // } - // DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}"); - - // break; - //case DeviceType.OnOffSwitch: - // var panel = new Panel() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = this.getGatewayBaseInfo?.gwID }; - // panel.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel.DeviceInfoData>(jobject["Data"].ToString()); - // if (panel.DeviceInfo == null) - // { - // return; - // } - // var panelInfo = DeviceList.Find(obj => obj.DeviceID == panel.DeviceID && obj.DeviceAddr == panel.DeviceAddr && obj.DeviceEpoint == panel.DeviceEpoint); - // if (panelInfo == null) - // { - // DeviceList.Add(panel); - // panel.DeviceName = panel.DeviceInfo.MacName; - // panel.DeviceEpointName = panel.DeviceInfo.DeviceName; - // panel.ImgTypeId = panel.DeviceInfo.ImgTypeId; - // panel.ImgVersion = panel.DeviceInfo.ImgVersion; - // panel.HwVersion = panel.DeviceInfo.HwVersion; - // panel.IasDeviceType = panel.DeviceInfo.DeviceType; - // panel.IsOnline = panel.DeviceInfo.IsOnline; - // panel.DriveCode = panel.DeviceInfo.DriveCode; - // panel.Profile = panel.DeviceInfo.Profile; - // panel.InClusterList = panel.DeviceInfo.InClusterList; - // panel.OutClusterList = panel.DeviceInfo.OutClusterList; - // panel.AttributeStatus = panel.DeviceInfo.AttributeStatus; - // //panel.Save(); - // } - // else - // { - // panelInfo.DeviceInfo = panel.DeviceInfo; - // panelInfo.DeviceName = panel.DeviceInfo.MacName; - // panelInfo.DeviceEpointName = panel.DeviceInfo.DeviceName; - // panelInfo.ImgVersion = panel.DeviceInfo.ImgVersion; - // panelInfo.HwVersion = panel.DeviceInfo.HwVersion; - // panelInfo.IsOnline = panel.DeviceInfo.IsOnline; - // panelInfo.DriveCode = panel.DeviceInfo.DriveCode; - // panelInfo.IasDeviceType = panel.DeviceInfo.DeviceType; - // panelInfo.Profile = panel.DeviceInfo.Profile; - // panelInfo.ImgTypeId = panel.DeviceInfo.ImgTypeId; - // panelInfo.InClusterList = panel.DeviceInfo.InClusterList; - // panelInfo.OutClusterList = panel.DeviceInfo.OutClusterList; - // panelInfo.AttributeStatus = panel.DeviceInfo.AttributeStatus; - // //panel.ReSave(); - // } - // DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}"); - - // break; - //case DeviceType.OnOffOutput: - // var toggleLight = new ToggleLight() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = this.getGatewayBaseInfo?.gwID }; - // toggleLight.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ToggleLight.DeviceInfoData>(jobject["Data"].ToString()); - // if (toggleLight.DeviceInfo == null) - // { - // return; - // } - // var toggleLightInfo = DeviceList.Find(obj => obj.DeviceID == toggleLight.DeviceID && obj.DeviceAddr == toggleLight.DeviceAddr && obj.DeviceEpoint == toggleLight.DeviceEpoint); - // if (toggleLightInfo == null) - // { - // DeviceList.Add(toggleLight); - // toggleLight.DeviceName = toggleLight.DeviceInfo.MacName; - // toggleLight.DeviceEpointName = toggleLight.DeviceInfo.DeviceName; - // toggleLight.ImgVersion = toggleLight.DeviceInfo.ImgVersion; - // toggleLight.HwVersion = toggleLight.DeviceInfo.HwVersion; - // toggleLight.IsOnline = toggleLight.DeviceInfo.IsOnline; - // toggleLight.DriveCode = toggleLight.DeviceInfo.DriveCode; - // toggleLight.IasDeviceType = toggleLight.DeviceInfo.DeviceType; - // toggleLight.Profile = toggleLight.DeviceInfo.Profile; - // toggleLight.ImgTypeId = toggleLight.DeviceInfo.ImgTypeId; - // toggleLight.InClusterList = toggleLight.DeviceInfo.InClusterList; - // toggleLight.OutClusterList = toggleLight.DeviceInfo.OutClusterList; - // toggleLight.AttributeStatus = toggleLight.DeviceInfo.AttributeStatus; - // //toggleLight.Save(); - // } - // else - // { - // toggleLightInfo.DeviceName = toggleLight.DeviceInfo.MacName; - // toggleLightInfo.DeviceEpointName = toggleLight.DeviceInfo.DeviceName; - // toggleLightInfo.ImgVersion = toggleLight.DeviceInfo.ImgVersion; - // toggleLightInfo.HwVersion = toggleLight.DeviceInfo.HwVersion; - // toggleLightInfo.IsOnline = toggleLight.DeviceInfo.IsOnline; - // toggleLightInfo.DriveCode = toggleLight.DeviceInfo.DriveCode; - // toggleLightInfo.IasDeviceType = toggleLight.DeviceInfo.DeviceType; - // toggleLightInfo.Profile = toggleLight.DeviceInfo.Profile; - // toggleLightInfo.ImgTypeId = toggleLight.DeviceInfo.ImgTypeId; - // toggleLightInfo.InClusterList = toggleLight.DeviceInfo.InClusterList; - // toggleLightInfo.OutClusterList = toggleLight.DeviceInfo.OutClusterList; - // toggleLightInfo.AttributeStatus = toggleLight.DeviceInfo.AttributeStatus; - // toggleLightInfo.DeviceInfo = toggleLight.DeviceInfo; - // //toggleLightInfo.ReSave(); - // } - // DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}"); - - // break; - //case DeviceType.AirSwitch: - // var airSwitch = new AirSwitch() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = this.getGatewayBaseInfo?.gwID }; - // airSwitch.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<AirSwitch.DeviceInfoData>(jobject["Data"].ToString()); - // if (airSwitch.DeviceInfo == null) - // { - // return; - // } - // var airSwitchInfo = DeviceList.Find(obj => obj.DeviceID == airSwitch.DeviceID && obj.DeviceAddr == airSwitch.DeviceAddr && obj.DeviceEpoint == airSwitch.DeviceEpoint); - // if (airSwitchInfo == null) - // { - // DeviceList.Add(airSwitch); - // airSwitch.DeviceName = airSwitch.DeviceInfo.MacName; - // airSwitch.DeviceEpointName = airSwitch.DeviceInfo.DeviceName; - // airSwitch.ImgVersion = airSwitch.DeviceInfo.ImgVersion; - // airSwitch.HwVersion = airSwitch.DeviceInfo.HwVersion; - // airSwitch.IsOnline = airSwitch.DeviceInfo.IsOnline; - // airSwitch.DriveCode = airSwitch.DeviceInfo.DriveCode; - // airSwitch.IasDeviceType = airSwitch.DeviceInfo.DeviceType; - // airSwitch.Profile = airSwitch.DeviceInfo.Profile; - // airSwitch.ImgTypeId = airSwitch.DeviceInfo.ImgTypeId; - // airSwitch.InClusterList = airSwitch.DeviceInfo.InClusterList; - // airSwitch.OutClusterList = airSwitch.DeviceInfo.OutClusterList; - // airSwitch.AttributeStatus = airSwitch.DeviceInfo.AttributeStatus; - // //airSwitch.Save(); - // } - // else - // { - // airSwitchInfo.DeviceName = airSwitch.DeviceInfo.MacName; - // airSwitchInfo.DeviceEpointName = airSwitch.DeviceInfo.DeviceName; - // airSwitchInfo.ImgVersion = airSwitch.DeviceInfo.ImgVersion; - // airSwitchInfo.HwVersion = airSwitch.DeviceInfo.HwVersion; - // airSwitchInfo.IsOnline = airSwitch.DeviceInfo.IsOnline; - // airSwitchInfo.DriveCode = airSwitch.DeviceInfo.DriveCode; - // airSwitchInfo.IasDeviceType = airSwitch.DeviceInfo.DeviceType; - // airSwitchInfo.Profile = airSwitch.DeviceInfo.Profile; - // airSwitchInfo.ImgTypeId = airSwitch.DeviceInfo.ImgTypeId; - // airSwitchInfo.InClusterList = airSwitch.DeviceInfo.InClusterList; - // airSwitchInfo.OutClusterList = airSwitch.DeviceInfo.OutClusterList; - // airSwitchInfo.AttributeStatus = airSwitch.DeviceInfo.AttributeStatus; - // airSwitchInfo.DeviceInfo = airSwitch.DeviceInfo; - // // airSwitchInfo.ReSave(); - // } - // DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}"); - - // break; - //case DeviceType.WindowCoveringDevice: - // var windowCovering = new Rollershade() { DeviceID = jobject.Value<int>((object)"Device_ID"), DeviceAddr = jobject.Value<string>((object)"DeviceAddr"), DeviceEpoint = jobject.Value<int>((object)"Epoint"), DataID = jobject.Value<int>((object)"Data_ID"), CurrentGateWayId = this.getGatewayBaseInfo?.gwID }; - // windowCovering.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<Rollershade.DeviceInfoData>(jobject["Data"].ToString()); - // if (windowCovering.DeviceInfo == null) - // { - // return; - // } - // var wc = DeviceList.Find(obj => obj.DeviceID == windowCovering.DeviceID && obj.DeviceAddr == windowCovering.DeviceAddr && obj.DeviceEpoint == windowCovering.DeviceEpoint); - // if (wc == null) - // { - // DeviceList.Add(windowCovering); - // windowCovering.DeviceName = windowCovering.DeviceInfo.MacName; - // windowCovering.DeviceEpointName = windowCovering.DeviceInfo.DeviceName; - // windowCovering.ImgVersion = windowCovering.DeviceInfo.ImgVersion; - // windowCovering.HwVersion = windowCovering.DeviceInfo.HwVersion; - // windowCovering.IsOnline = windowCovering.DeviceInfo.IsOnline; - // windowCovering.DriveCode = windowCovering.DeviceInfo.DriveCode; - // windowCovering.IasDeviceType = windowCovering.DeviceInfo.DeviceType; - // windowCovering.Profile = windowCovering.DeviceInfo.Profile; - // windowCovering.ImgTypeId = windowCovering.DeviceInfo.ImgTypeId; - // windowCovering.InClusterList = windowCovering.DeviceInfo.InClusterList; - // windowCovering.OutClusterList = windowCovering.DeviceInfo.OutClusterList; - // windowCovering.AttributeStatus = windowCovering.DeviceInfo.AttributeStatus; - // //windowCovering.Save(); - // } - // else - // { - // wc.DeviceName = windowCovering.DeviceInfo.MacName; - // wc.DeviceEpointName = windowCovering.DeviceInfo.DeviceName; - // wc.DeviceInfo = windowCovering.DeviceInfo; - // wc.ImgVersion = windowCovering.DeviceInfo.ImgVersion; - // wc.HwVersion = windowCovering.DeviceInfo.HwVersion; - // wc.IsOnline = windowCovering.DeviceInfo.IsOnline; - // wc.DriveCode = windowCovering.DeviceInfo.DriveCode; - // wc.IasDeviceType = windowCovering.DeviceInfo.DeviceType; - // wc.Profile = windowCovering.DeviceInfo.Profile; - // wc.ImgTypeId = windowCovering.DeviceInfo.ImgTypeId; - // wc.InClusterList = windowCovering.DeviceInfo.InClusterList; - // wc.OutClusterList = windowCovering.DeviceInfo.OutClusterList; - // wc.AttributeStatus = windowCovering.DeviceInfo.AttributeStatus; - // // wc.ReSave(); - // } - // DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}"); - // break; - //case DeviceType.IASZone: - // var ias = new IASZone() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = this.getGatewayBaseInfo?.gwID }; - // ias.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<IASZone.DeviceInfoData>(jobject["Data"].ToString()); - // if (ias.DeviceInfo == null) - // { - // return; - // } - // var infoIAS = DeviceList.Find(obj => obj.DeviceID == ias.DeviceID && obj.DeviceAddr == ias.DeviceAddr && obj.DeviceEpoint == ias.DeviceEpoint); - // if (infoIAS == null) - // { - // DeviceList.Add(ias); - // ias.DeviceName = ias.DeviceInfo.MacName; - // ias.DeviceEpointName = ias.DeviceInfo.DeviceName; - // ias.ImgVersion = ias.DeviceInfo.ImgVersion; - // ias.HwVersion = ias.DeviceInfo.HwVersion; - // ias.IsOnline = ias.DeviceInfo.IsOnline; - // ias.DriveCode = ias.DeviceInfo.DriveCode; - // ias.IasDeviceType = ias.DeviceInfo.DeviceType; - // ias.Profile = ias.DeviceInfo.Profile; - // ias.ImgTypeId = ias.DeviceInfo.ImgTypeId; - // ias.InClusterList = ias.DeviceInfo.InClusterList; - // ias.OutClusterList = ias.DeviceInfo.OutClusterList; - // ias.AttributeStatus = ias.DeviceInfo.AttributeStatus; - // //ias.Save(); - // } - // else - // { - // infoIAS.DeviceName = ias.DeviceInfo.MacName; - // infoIAS.DeviceEpointName = ias.DeviceInfo.DeviceName; - // infoIAS.DeviceEpointName = ias.DeviceInfo.DeviceName; - // infoIAS.ImgVersion = ias.DeviceInfo.ImgVersion; - // infoIAS.HwVersion = ias.DeviceInfo.HwVersion; - // infoIAS.IsOnline = ias.DeviceInfo.IsOnline; - // infoIAS.DriveCode = ias.DeviceInfo.DriveCode; - // infoIAS.IasDeviceType = ias.DeviceInfo.DeviceType; - // infoIAS.Profile = ias.DeviceInfo.Profile; - // infoIAS.ImgTypeId = ias.DeviceInfo.ImgTypeId; - // infoIAS.InClusterList = ias.DeviceInfo.InClusterList; - // infoIAS.OutClusterList = ias.DeviceInfo.OutClusterList; - // infoIAS.AttributeStatus = ias.DeviceInfo.AttributeStatus; - // infoIAS.DeviceInfo = ias.DeviceInfo; - // //ias.ReSave(); - // } - // DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}"); - // break; - //case DeviceType.OtaDevice: - //case DeviceType.OtaPanelDevice: - //var ota = new OTADevice() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = this.getGatewayBaseInfo?.gwID }; - //ota.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceInfoData>(jobject["Data"].ToString()); - //if (ota.DeviceInfo == null) - //{ - // return; - //} - //var infoOta = DeviceList.Find(obj => obj.DeviceID == ota.DeviceID && obj.DeviceAddr == ota.DeviceAddr && obj.DeviceEpoint == ota.DeviceEpoint); - //if (infoOta == null) - //{ - // DeviceList.Add(ota); - // ota.DeviceName = ota.DeviceInfo.MacName; - // ota.DeviceEpointName = ota.DeviceInfo.DeviceName; - // ota.ImgVersion = ota.DeviceInfo.ImgVersion; - // ota.HwVersion = ota.DeviceInfo.HwVersion; - // ota.IsOnline = ota.DeviceInfo.IsOnline; - // ota.DriveCode = ota.DeviceInfo.DriveCode; - // ota.IasDeviceType = ota.DeviceInfo.DeviceType; - // ota.Profile = ota.DeviceInfo.Profile; - // ota.ImgTypeId = ota.DeviceInfo.ImgTypeId; - // ota.InClusterList = ota.DeviceInfo.InClusterList; - // ota.OutClusterList = ota.DeviceInfo.OutClusterList; - // ota.AttributeStatus = ota.DeviceInfo.AttributeStatus; - // //ota.Save(); - //} - //else - //{ - // infoOta.DeviceName = ota.DeviceInfo.MacName; - // infoOta.DeviceEpointName = ota.DeviceInfo.DeviceName; - // infoOta.DeviceEpointName = ota.DeviceInfo.DeviceName; - // infoOta.ImgVersion = ota.DeviceInfo.ImgVersion; - // infoOta.HwVersion = ota.DeviceInfo.HwVersion; - // infoOta.IsOnline = ota.DeviceInfo.IsOnline; - // infoOta.DriveCode = ota.DeviceInfo.DriveCode; - // infoOta.IasDeviceType = ota.DeviceInfo.DeviceType; - // infoOta.Profile = ota.DeviceInfo.Profile; - // infoOta.ImgTypeId = ota.DeviceInfo.ImgTypeId; - // infoOta.InClusterList = ota.DeviceInfo.InClusterList; - // infoOta.OutClusterList = ota.DeviceInfo.OutClusterList; - // infoOta.AttributeStatus = ota.DeviceInfo.AttributeStatus; - // infoOta.DeviceInfo = ota.DeviceInfo; - // //ota.ReSave(); - //} - //DebugPrintLog($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}"); - //break; - //case DeviceType.Thermostat: - //var thermostat = new ThermostatObj() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; - //thermostat.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ThermostatObj.DeviceInfoData>(jobject["Data"].ToString()); - //if (thermostat.DeviceInfo == null) - //{ - // return; - //} - //var ther = gateway.DeviceList.Find(obj => obj.DeviceID == thermostat.DeviceID && obj.DeviceAddr == thermostat.DeviceAddr && obj.DeviceEpoint == thermostat.DeviceEpoint); - //if (ther == null) - //{ - // gateway.DeviceList.Add(thermostat); - // thermostat.DeviceName = thermostat.DeviceInfo.DeviceName; - // IO.LocalFileUtils.SaveDeviceInfo(thermostat, thermostat.DeviceEpoint.ToString()); - //} - //else - //{ - // ther.DeviceName = thermostat.DeviceInfo.DeviceName; - // ther.DeviceInfo = thermostat.DeviceInfo; - // ZigBee.IO.LocalFileUtils.SaveDeviceInfo(ther, ther.DeviceEpoint.ToString()); - //} - //break; - //case DeviceType.TemperatureSensor: - //var temperatureSensor = new TemperatureSensor() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; - //temperatureSensor.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<TemperatureSensor.DeviceInfoData>(jobject["Data"].ToString()); - //if (temperatureSensor.DeviceInfo == null) - //{ - // return; - //} - //var ts = gateway.DeviceList.Find(obj => obj.DeviceID == temperatureSensor.DeviceID && obj.DeviceAddr == temperatureSensor.DeviceAddr && obj.DeviceEpoint == temperatureSensor.DeviceEpoint); - //if (ts == null) - //{ - // gateway.DeviceList.Add(temperatureSensor); - // temperatureSensor.DeviceName = temperatureSensor.DeviceInfo.DeviceName; - // IO.LocalFileUtils.SaveDeviceInfo(temperatureSensor, temperatureSensor.DeviceEpoint.ToString()); - //} - //else - //{ - // ts.DeviceName = temperatureSensor.DeviceInfo.DeviceName; - // ts.DeviceInfo = temperatureSensor.DeviceInfo; - // IO.LocalFileUtils.SaveDeviceInfo(ts, ts.DeviceEpoint.ToString()); - //} - //break; - - } - } - else if (topic == gatewayID + "/" + "DeviceInfoResponEnd") - { - canBreak = true; - } - }; - - Actions += action; - DebugPrintLog("DeviceInfo Actions 鍚姩" + "_" + System.DateTime.Now.ToString()); - - try - { - var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 93 } }; - Send("GetDeviceInfo", jObject.ToString()); - } - catch { } - - while (canBreak == false && (DateTime.Now - dateTime).TotalMilliseconds < 6000) - { - await System.Threading.Tasks.Task.Delay(10); - } - - Actions -= action; - DebugPrintLog("DeviceInfo_Actions 閫�鍑�" + System.DateTime.Now.ToString()); - return DeviceList; - })); } #endregion @@ -3527,7 +3111,7 @@ await RemoteMqttClient.DisconnectAsync(); } } - catch (Exception e) + catch (Exception e) { DebugPrintLog($"Remote鏂紑閫氳杩炴帴鍑哄紓甯�:{e.Message}"); } -- Gitblit v1.8.0