| | |
| | | /// <param name="msgData">接收的数据</param>
|
| | | public void GatewayOverallMsgReceive(string gatewayId, string topic, string reportTopic, string msgData) |
| | | { |
| | | //如果它在登陆界面,则不做任何处理 |
| | | if (Common.Config.Instance.HomeId == string.Empty) |
| | | { |
| | | return; |
| | | } |
| | | if (topic == "AppNoLogin") |
| | | { |
| | | HdlThreadLogic.Current.RunMain(() => |
| | |
| | | { |
| | | if (HdlGatewayLogic.Current.IsGatewayExist(gatewayId) == false) |
| | | { |
| | | //不是自己绑定的网关,则不处理 |
| | | //不是自己绑定的网关,则不处理,但是下面这个东西有点特殊 |
| | | if (gatewayId == this.GatewayReceiveId) |
| | | { |
| | | this.GatewayReceiveEvent?.Invoke(topic, msgData); |
| | | } |
| | | return; |
| | | } |
| | | //设备属性上报 |
| | |
| | | ((LightBase)locadevice).OnOffStatus = report.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | //已经接收到状态 |
| | | locadevice.HadReadDeviceStatu = true; |
| | | } |
| | | |
| | | if (locadevice is TemperatureSensor) |
| | | { |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { locadevice }); |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | locadevice.DeviceStatusReport = report.DeviceStatusReport; |
| | | ((TemperatureSensor)locadevice).OnOffStatus = report.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | //已经接收到状态 |
| | | locadevice.HadReadDeviceStatu = true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | //PM2.5 |
| | | if (attData.AttributeId == (int)AttriButeId.MeasuredValue) |
| | | { |
| | | |
| | | if (attData.AttriButeDataType == 57) |
| | | { |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { locadevice }); |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | ((TemperatureSensor)locadevice).currentPmData = attData.AttriButeData; |
| | | } |
| | | else |
| | | { |
| | | ((PMSensor)locadevice).currentPmData = attData.AttriButeData; |
| | | } |
| | | } |
| | | } |
| | | //已经接收到状态 |
| | |
| | | |
| | | #endregion
|
| | | |
| | | #region ■ CO2数据 |
| | | else if (report.DeviceStatusReport.CluterID == 1037) |
| | | { |
| | | foreach (var attData in report.DeviceStatusReport.AttriBute) |
| | | { |
| | | if (attData.AttributeId == (int)AttriButeId.MeasuredValue) |
| | | { |
| | | if (attData.AttriButeDataType == 57) |
| | | { |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { locadevice }); |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | ((TemperatureSensor)locadevice).currentCO2 = attData.AttriButeData; |
| | | } |
| | | } |
| | | } |
| | | //已经接收到状态 |
| | | locadevice.HadReadDeviceStatu = true; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 设备基础信息
|
| | | |
| | | else if (report.DeviceStatusReport.CluterID == 0) |