old mode 100755
new mode 100644
| | |
| | | using Shared.Common;
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | | using ZigBee.Device;
|
| | |
|
| | | namespace Shared.Phone.UserCenter
|
| | | {
|
| | | /// <summary>
|
| | | /// 设备的其他逻辑(目前用来存放郭雪城的代码)
|
| | | /// </summary>
|
| | | public class HdlDeviceOtherLogic
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 设备的其他逻辑
|
| | | /// </summary>
|
| | | private static HdlDeviceOtherLogic m_Current = null;
|
| | | /// <summary>
|
| | | /// 设备的其他逻辑
|
| | | /// </summary>
|
| | | public static HdlDeviceOtherLogic Current
|
| | | {
|
| | | get
|
| | | {
|
| | | if (m_Current == null)
|
| | | {
|
| | | m_Current = new HdlDeviceOtherLogic();
|
| | | }
|
| | | return m_Current;
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 显示控制设备是否成功的提示_________
|
| | |
|
| | | /// <summary>
|
| | | /// 显示控制设备是否成功的提示
|
| | | /// </summary>
|
| | | /// <param name="r">The red component.</param>
|
| | | public void ShowStatuTip(int r)
|
| | | {
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | string msg = Language.StringByID(r);
|
| | | var tip = new ShowMsgControl(ShowMsgType.Tip, msg);
|
| | | tip.Show();
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 获取设备状态的翻译_________________
|
| | |
|
| | | /// <summary>
|
| | | /// GetDeviceStatu
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | public string GetDeviceStatu(CommonDevice device)
|
| | | {
|
| | | if (device.Type == DeviceType.OnOffOutput)
|
| | | {
|
| | | //在网关没有回复之前,默认离线
|
| | | if (device.HadReadDeviceStatu == false)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.uOffLine);
|
| | | }
|
| | | if ((device as ToggleLight).OnOffStatus == 1)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.uOpen1);
|
| | | }
|
| | | return Language.StringByID(R.MyInternationalizationString.Close);
|
| | | }
|
| | | else if (device.Type == DeviceType.AirSwitch)
|
| | | {
|
| | | //在网关没有回复之前,默认离线
|
| | | if (device.HadReadDeviceStatu == false)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.uOffLine);
|
| | | }
|
| | | if ((device as AirSwitch).OnOffStatus == 1)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.uOpen1);
|
| | | }
|
| | | return Language.StringByID(R.MyInternationalizationString.Close);
|
| | | }
|
| | | else if (device.Type == DeviceType.DimmableLight)
|
| | | {
|
| | | //在网关没有回复之前,默认离线
|
| | | if (device.HadReadDeviceStatu == false)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.uOffLine);
|
| | | }
|
| | | if ((device as DimmableLight).OnOffStatus == 0)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.Close);
|
| | | }
|
| | | return $"{(int)((device as DimmableLight).Level * 1.0 / 254 * 100)}%";
|
| | | }
|
| | | else if (device.Type == DeviceType.ColorTemperatureLight)
|
| | | {
|
| | | //在网关没有回复之前,默认离线
|
| | | if (device.HadReadDeviceStatu == false)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.uOffLine);
|
| | | }
|
| | | if ((device as ColorTemperatureLight).OnOffStatus == 0)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.Close);
|
| | | }
|
| | | return $"{(int)((device as ColorTemperatureLight).Level * 1.0 / 254 * 100)}%";
|
| | | }
|
| | | else if (device.Type == DeviceType.WindowCoveringDevice)
|
| | | {
|
| | | //在网关没有回复之前,默认离线
|
| | | if (device.HadReadDeviceStatu == false)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.uOffLine);
|
| | | }
|
| | | if ((device as Rollershade).WcdCurrentPositionLiftPercentage == 0)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.Close);
|
| | | }
|
| | | return $"{(device as Rollershade).WcdCurrentPositionLiftPercentage}%";
|
| | | }
|
| | | else if (device.Type == DeviceType.FreshAir)
|
| | | {
|
| | | //在网关没有回复之前,默认离线
|
| | | if (device.HadReadDeviceStatu == false)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.uOffLine);
|
| | | }
|
| | |
|
| | | //模式
|
| | | string wind = string.Empty;
|
| | | var freshAir = device as FreshAir;
|
| | | if (freshAir.currentFanStatus == 0)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.Close);
|
| | | }
|
| | | if (freshAir.currentFanSpeed == 1)
|
| | | {
|
| | | wind = Language.StringByID(R.MyInternationalizationString.Fan_Low);
|
| | | }
|
| | | else if (freshAir.currentFanSpeed == 2)
|
| | | {
|
| | | wind = Language.StringByID(R.MyInternationalizationString.Fan_Middle);
|
| | | }
|
| | | else if (freshAir.currentFanSpeed == 3)
|
| | | {
|
| | | wind = Language.StringByID(R.MyInternationalizationString.Fan_Height);
|
| | | }
|
| | | return $"{wind}";
|
| | | }
|
| | | else if (device.Type == DeviceType.PMSensor)
|
| | | {
|
| | | //空气质量
|
| | | string curQuality = "";
|
| | | //温度
|
| | | string temperature = string.Empty;
|
| | | //湿度
|
| | | string humidity = string.Empty;
|
| | | //PM2.5
|
| | | string pm = string.Empty;
|
| | | var pMSensor = device as PMSensor;
|
| | | if (pMSensor.currentPmData <= 35 && pMSensor.currentPmData >= 0)
|
| | | {
|
| | | curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
|
| | | }
|
| | | else if (pMSensor.currentPmData <= 75 && pMSensor.currentPmData > 35)
|
| | | {
|
| | | curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
|
| | | }
|
| | | else if (pMSensor.currentPmData <= 115 && pMSensor.currentPmData > 75)
|
| | | {
|
| | | curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
|
| | | }
|
| | | else if (pMSensor.currentPmData <= 150 && pMSensor.currentPmData > 115)
|
| | | {
|
| | | curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
|
| | | }
|
| | | else if (pMSensor.currentPmData <= 250 && pMSensor.currentPmData > 150)
|
| | | {
|
| | | curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
|
| | | }
|
| | | else if (pMSensor.currentPmData > 250)
|
| | | {
|
| | | curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality);
|
| | | }
|
| | | else
|
| | | {
|
| | | curQuality = "--";
|
| | | }
|
| | |
|
| | | humidity = $"{pMSensor.currentHumidity}%";
|
| | | temperature = $"{pMSensor.currentTemperature}℃";
|
| | | pm = $"{pMSensor.currentPmData}μg/m³";
|
| | | return $"{curQuality},{pm},{temperature},{humidity}";
|
| | |
|
| | | }
|
| | | else if (device.Type == DeviceType.Thermostat)
|
| | | {
|
| | | //在网关没有回复之前,默认离线
|
| | | if (device.HadReadDeviceStatu == false)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.uOffLine);
|
| | | }
|
| | | //温度,模式,风速
|
| | | string tempareture = string.Empty;
|
| | | string model = string.Empty;
|
| | | string wind = string.Empty;
|
| | |
|
| | | var ac = device as AC;
|
| | |
|
| | | if (ac.currentSystemMode == 0)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.Close);
|
| | | }
|
| | | else if (ac.currentSystemMode == 1)
|
| | | {
|
| | | model = Language.StringByID(R.MyInternationalizationString.Mode_Auto);
|
| | | tempareture = $"{ac.currentAutoSetpoint} ℃";
|
| | | }
|
| | | else if (ac.currentSystemMode == 3)
|
| | | {
|
| | | model = Language.StringByID(R.MyInternationalizationString.Mode_Cool);
|
| | | tempareture = $"{ac.currentCoolingSetpoint} ℃";
|
| | | }
|
| | | else if (ac.currentSystemMode == 4)
|
| | | {
|
| | | model = Language.StringByID(R.MyInternationalizationString.Mode_Heat);
|
| | | tempareture = $"{ac.currentHeatingSetpoint} ℃";
|
| | | }
|
| | | else if (ac.currentSystemMode == 7)
|
| | | {
|
| | | model = Language.StringByID(R.MyInternationalizationString.Mode_FanOnly);
|
| | | }
|
| | | else if (ac.currentSystemMode == 8)
|
| | | {
|
| | | model = Language.StringByID(R.MyInternationalizationString.Mode_Dry);
|
| | | tempareture = $"{ac.currentCoolingSetpoint} ℃";
|
| | | }
|
| | |
|
| | | if (ac.currentFanMode == 1)
|
| | | {
|
| | | wind = Language.StringByID(R.MyInternationalizationString.Fan_Low);
|
| | | }
|
| | | else if (ac.currentFanMode == 2)
|
| | | {
|
| | | wind = Language.StringByID(R.MyInternationalizationString.Fan_Middle);
|
| | | }
|
| | | else
|
| | | {
|
| | | wind = Language.StringByID(R.MyInternationalizationString.Fan_Height);
|
| | | }
|
| | |
|
| | | if (string.IsNullOrEmpty(tempareture))
|
| | | {
|
| | | return $"{model},{wind}";
|
| | | }
|
| | | return $"{model},{wind},{tempareture}";
|
| | | }
|
| | | else if (device.Type == DeviceType.IASZone)
|
| | | {
|
| | | var ias = device as IASZone;
|
| | | //区分传感器具体类型
|
| | | var info = LocalDevice.Current.GetNotHdlMyDeviceEnumInfo(new List<CommonDevice> { device });
|
| | | if (info.ConcreteType == DeviceConcreteType.Sensor_Infrared)
|
| | | {
|
| | | //红外
|
| | | if (ias.iASInfo?.Alarm1 == 1)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_HavePerson);
|
| | | }
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_NoPerson);
|
| | | }
|
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_Water)
|
| | | {
|
| | | //水浸
|
| | | if (ias.iASInfo?.Alarm1 == 1)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_HaveWater);
|
| | | }
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Normal);
|
| | | }
|
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_DoorWindow)
|
| | | {
|
| | | //门窗
|
| | | if (ias.iASInfo?.Alarm1 == 1)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Open);
|
| | | }
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Close);
|
| | | }
|
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_CarbonMonoxide)
|
| | | {
|
| | | //燃气
|
| | | if (ias.iASInfo?.Alarm1 == 1)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.uGasLeakage);
|
| | | }
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Normal);
|
| | | }
|
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_Fire)
|
| | | {
|
| | | //烟雾
|
| | | if (ias.iASInfo?.Alarm1 == 1)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.uSmogAlarm);
|
| | | }
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Safe);
|
| | | }
|
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_Pir)
|
| | | {
|
| | | //pir
|
| | | if (ias.iASInfo?.Alarm1 == 1)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_HavePerson);
|
| | | }
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_NoPerson);
|
| | | }
|
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_Keyfob)
|
| | | {
|
| | | //钥匙扣
|
| | | if (ias.iASInfo?.Alarm1 == 1)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Alarm);
|
| | | }
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Normal);
|
| | | }
|
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_Motion)
|
| | | {
|
| | | //运动传感器
|
| | | if (ias.iASInfo?.Alarm1 == 1)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_HavePerson);
|
| | | }
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_NoPerson);
|
| | | }
|
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_EmergencyButton)
|
| | | {
|
| | | //紧急按钮
|
| | | if (ias.iASInfo?.Alarm1 == 1)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Alarm);
|
| | | }
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Normal);
|
| | | }
|
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_SphericalMotion)
|
| | | {
|
| | | //球型移动传感器
|
| | | if (ias.iASInfo?.Alarm1 == 1)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_HavePerson);
|
| | | }
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_NoPerson);
|
| | | }
|
| | | else
|
| | | {
|
| | | //其他传感器
|
| | | if (ias.iASInfo?.Alarm1 == 1)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Alarm);
|
| | | }
|
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Normal);
|
| | | }
|
| | | }
|
| | | else if (device.Type == DeviceType.TemperatureSensor)
|
| | | {
|
| | | var tempera = device as TemperatureSensor;
|
| | | if (tempera.SensorDiv == 1)
|
| | | {
|
| | | if (tempera.currentTemperature == 0)
|
| | | {
|
| | | return "0.0℃";
|
| | | }
|
| | | return $"{tempera.currentTemperature}℃";
|
| | | }
|
| | | else if (tempera.SensorDiv == 2)
|
| | | {
|
| | | if (tempera.currentHumidity == 0)
|
| | | {
|
| | | return "--%";
|
| | | }
|
| | | return $"{tempera.currentHumidity}%";
|
| | | }
|
| | | return null;
|
| | | }
|
| | | else
|
| | | {
|
| | | return null;
|
| | | }
|
| | | }
|
| | | #endregion
|
| | | }
|
| | | }
|
| | | using Shared.Common; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using ZigBee.Device; |
| | | |
| | | namespace Shared.Phone.UserCenter |
| | | { |
| | | /// <summary> |
| | | /// 设备的其他逻辑(目前用来存放郭雪城的代码) |
| | | /// </summary> |
| | | public class HdlDeviceOtherLogic |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 设备的其他逻辑 |
| | | /// </summary> |
| | | private static HdlDeviceOtherLogic m_Current = null; |
| | | /// <summary> |
| | | /// 设备的其他逻辑 |
| | | /// </summary> |
| | | public static HdlDeviceOtherLogic Current |
| | | { |
| | | get |
| | | { |
| | | if (m_Current == null) |
| | | { |
| | | m_Current = new HdlDeviceOtherLogic(); |
| | | } |
| | | return m_Current; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 显示控制设备是否成功的提示_________ |
| | | |
| | | /// <summary> |
| | | /// 显示控制设备是否成功的提示 |
| | | /// </summary> |
| | | /// <param name="r">The red component.</param> |
| | | public void ShowStatuTip(int r) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | string msg = Language.StringByID(r); |
| | | var tip = new ShowMsgControl(ShowMsgType.Tip, msg); |
| | | tip.Show(); |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 获取设备状态的翻译_________________ |
| | | |
| | | /// <summary> |
| | | /// GetDeviceStatu |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public string GetDeviceStatu(CommonDevice device) |
| | | { |
| | | if (device.Type == DeviceType.OnOffOutput) |
| | | { |
| | | //在网关没有回复之前,默认离线 |
| | | if (device.HadReadDeviceStatu == false) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.uOffLine); |
| | | } |
| | | if ((device as ToggleLight).OnOffStatus == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.uOpen1); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.Close); |
| | | } |
| | | else if (device.Type == DeviceType.AirSwitch) |
| | | { |
| | | //在网关没有回复之前,默认离线 |
| | | if (device.HadReadDeviceStatu == false) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.uOffLine); |
| | | } |
| | | if ((device as AirSwitch).OnOffStatus == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.uOpen1); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.Close); |
| | | } |
| | | else if (device.Type == DeviceType.DimmableLight) |
| | | { |
| | | //在网关没有回复之前,默认离线 |
| | | if (device.HadReadDeviceStatu == false) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.uOffLine); |
| | | } |
| | | if ((device as DimmableLight).OnOffStatus == 0) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Close); |
| | | } |
| | | return HdlDeviceCommonLogic.Current.CalculateLightLevelPersent((device as DimmableLight).Level) + "%"; |
| | | } |
| | | else if (device.Type == DeviceType.ColorTemperatureLight) |
| | | { |
| | | //在网关没有回复之前,默认离线 |
| | | if (device.HadReadDeviceStatu == false) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.uOffLine); |
| | | } |
| | | if ((device as ColorTemperatureLight).OnOffStatus == 0) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Close); |
| | | } |
| | | return HdlDeviceCommonLogic.Current.CalculateLightLevelPersent((device as ColorTemperatureLight).Level) + "%"; |
| | | } |
| | | else if (device.Type == DeviceType.WindowCoveringDevice) |
| | | { |
| | | //在网关没有回复之前,默认离线 |
| | | if (device.HadReadDeviceStatu == false) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.uOffLine); |
| | | } |
| | | if ((device as Rollershade).WcdCurrentPositionLiftPercentage == 0) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Close); |
| | | } |
| | | return $"{(device as Rollershade).WcdCurrentPositionLiftPercentage}%"; |
| | | } |
| | | else if (device.Type == DeviceType.FreshAir) |
| | | { |
| | | //在网关没有回复之前,默认离线 |
| | | if (device.HadReadDeviceStatu == false) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.uOffLine); |
| | | } |
| | | |
| | | //模式 |
| | | string wind = string.Empty; |
| | | var freshAir = device as FreshAir; |
| | | if (freshAir.currentFanStatus == 0) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Close); |
| | | } |
| | | if (freshAir.currentFanSpeed == 1) |
| | | { |
| | | wind = Language.StringByID(R.MyInternationalizationString.Fan_Low); |
| | | } |
| | | else if (freshAir.currentFanSpeed == 2) |
| | | { |
| | | wind = Language.StringByID(R.MyInternationalizationString.Fan_Middle); |
| | | } |
| | | else if (freshAir.currentFanSpeed == 3) |
| | | { |
| | | wind = Language.StringByID(R.MyInternationalizationString.Fan_Height); |
| | | } |
| | | return $"{wind}"; |
| | | } |
| | | else if (device.Type == DeviceType.PMSensor) |
| | | { |
| | | //空气质量 |
| | | string curQuality = ""; |
| | | //温度 |
| | | string temperature = string.Empty; |
| | | //湿度 |
| | | string humidity = string.Empty; |
| | | //PM2.5 |
| | | string pm = string.Empty; |
| | | var pMSensor = device as PMSensor; |
| | | if (pMSensor.currentPmData <= 35 && pMSensor.currentPmData >= 0) |
| | | { |
| | | curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality); |
| | | } |
| | | else if (pMSensor.currentPmData <= 75 && pMSensor.currentPmData > 35) |
| | | { |
| | | curQuality = Language.StringByID(R.MyInternationalizationString.GoodAirQuality); |
| | | } |
| | | else if (pMSensor.currentPmData <= 115 && pMSensor.currentPmData > 75) |
| | | { |
| | | curQuality = Language.StringByID(R.MyInternationalizationString.LightPollution); |
| | | } |
| | | else if (pMSensor.currentPmData <= 150 && pMSensor.currentPmData > 115) |
| | | { |
| | | curQuality = Language.StringByID(R.MyInternationalizationString.Moderatelyolluted); |
| | | } |
| | | else if (pMSensor.currentPmData <= 250 && pMSensor.currentPmData > 150) |
| | | { |
| | | curQuality = Language.StringByID(R.MyInternationalizationString.HeavyPollution); |
| | | } |
| | | else if (pMSensor.currentPmData > 250) |
| | | { |
| | | curQuality = Language.StringByID(R.MyInternationalizationString.SeriousPollution); |
| | | } |
| | | else |
| | | { |
| | | curQuality = "--"; |
| | | } |
| | | |
| | | humidity = $"{pMSensor.currentHumidity}%"; |
| | | temperature = $"{pMSensor.currentTemperature}℃"; |
| | | pm = $"{pMSensor.currentPmData}μg/m³"; |
| | | return $"{curQuality},{pm},{temperature},{humidity}"; |
| | | } |
| | | else if (device.Type == DeviceType.Airer) |
| | | { |
| | | //是否存在开的状态 |
| | | bool isOpen = false; |
| | | var airer = device as Airer; |
| | | if (airer.OnOffStatus == 1 || |
| | | airer.DryOnOffStatus == 1 || |
| | | airer.WindOnOffStatus == 1 || |
| | | airer.DisinfectOnOffStatus == 1) |
| | | { |
| | | isOpen = true; |
| | | } |
| | | //在网关没有回复之前,默认离线 |
| | | if (device.HadReadDeviceStatu == false) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.uOffLine); |
| | | } |
| | | if (isOpen) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.uOpen1); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.Close); |
| | | } |
| | | else if (device.Type == DeviceType.Thermostat) |
| | | { |
| | | //在网关没有回复之前,默认离线 |
| | | if (device.HadReadDeviceStatu == false) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.uOffLine); |
| | | } |
| | | //温度,模式,风速 |
| | | string tempareture = string.Empty; |
| | | string model = string.Empty; |
| | | string wind = string.Empty; |
| | | |
| | | var ac = device as AC; |
| | | |
| | | if (ac.currentSystemMode == 0) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Close); |
| | | } |
| | | else if (ac.currentSystemMode == 1) |
| | | { |
| | | model = Language.StringByID(R.MyInternationalizationString.Mode_Auto); |
| | | tempareture = $"{ac.currentAutoSetpoint} ℃"; |
| | | } |
| | | else if (ac.currentSystemMode == 3) |
| | | { |
| | | model = Language.StringByID(R.MyInternationalizationString.Mode_Cool); |
| | | tempareture = $"{ac.currentCoolingSetpoint} ℃"; |
| | | } |
| | | else if (ac.currentSystemMode == 4) |
| | | { |
| | | model = Language.StringByID(R.MyInternationalizationString.Mode_Heat); |
| | | tempareture = $"{ac.currentHeatingSetpoint} ℃"; |
| | | } |
| | | else if (ac.currentSystemMode == 7) |
| | | { |
| | | model = Language.StringByID(R.MyInternationalizationString.Mode_FanOnly); |
| | | } |
| | | else if (ac.currentSystemMode == 8) |
| | | { |
| | | model = Language.StringByID(R.MyInternationalizationString.Mode_Dry); |
| | | tempareture = $"{ac.currentCoolingSetpoint} ℃"; |
| | | } |
| | | |
| | | if (ac.currentFanMode == 1) |
| | | { |
| | | wind = Language.StringByID(R.MyInternationalizationString.Fan_Low); |
| | | } |
| | | else if (ac.currentFanMode == 2) |
| | | { |
| | | wind = Language.StringByID(R.MyInternationalizationString.Fan_Middle); |
| | | } |
| | | else |
| | | { |
| | | wind = Language.StringByID(R.MyInternationalizationString.Fan_Height); |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(tempareture)) |
| | | { |
| | | return $"{model},{wind}"; |
| | | } |
| | | return $"{model},{wind},{tempareture}"; |
| | | } |
| | | else if (device.Type == DeviceType.IASZone) |
| | | { |
| | | var ias = device as IASZone; |
| | | //区分传感器具体类型 |
| | | var info = LocalDevice.Current.GetNotHdlMyDeviceEnumInfo(new List<CommonDevice> { device }); |
| | | if (info.ConcreteType == DeviceConcreteType.Sensor_Infrared) |
| | | { |
| | | //红外 |
| | | if (ias.iASInfo?.Alarm1 == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_HavePerson); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_NoPerson); |
| | | } |
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_Water) |
| | | { |
| | | //水浸 |
| | | if (ias.iASInfo?.Alarm1 == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_HaveWater); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Normal); |
| | | } |
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_DoorWindow) |
| | | { |
| | | //门窗 |
| | | if (ias.iASInfo?.Alarm1 == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Open); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Close); |
| | | } |
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_CarbonMonoxide) |
| | | { |
| | | //燃气 |
| | | if (ias.iASInfo?.Alarm1 == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.uGasLeakage); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Normal); |
| | | } |
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_Fire) |
| | | { |
| | | //烟雾 |
| | | if (ias.iASInfo?.Alarm1 == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.uSmogAlarm); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Safe); |
| | | } |
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_Pir) |
| | | { |
| | | //pir |
| | | if (ias.iASInfo?.Alarm1 == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_HavePerson); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_NoPerson); |
| | | } |
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_Keyfob) |
| | | { |
| | | //钥匙扣 |
| | | if (ias.iASInfo?.Alarm1 == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Alarm); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Normal); |
| | | } |
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_Motion) |
| | | { |
| | | //运动传感器 |
| | | if (ias.iASInfo?.Alarm1 == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_HavePerson); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_NoPerson); |
| | | } |
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_EmergencyButton) |
| | | { |
| | | //紧急按钮 |
| | | if (ias.iASInfo?.Alarm1 == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Alarm); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Normal); |
| | | } |
| | | else if (info.ConcreteType == DeviceConcreteType.Sensor_SphericalMotion) |
| | | { |
| | | //球型移动传感器 |
| | | if (ias.iASInfo?.Alarm1 == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_HavePerson); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_NoPerson); |
| | | } |
| | | else |
| | | { |
| | | //其他传感器 |
| | | if (ias.iASInfo?.Alarm1 == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Alarm); |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.IASZone_Statu_Normal); |
| | | } |
| | | } |
| | | else if (device.Type == DeviceType.TemperatureSensor) |
| | | { |
| | | var tempera = device as TemperatureSensor; |
| | | |
| | | //空气质量传感器 |
| | | //获取设备类型 |
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device }); |
| | | //空气质量传感器 |
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor) |
| | | { |
| | | //空气质量 |
| | | string curQuality = ""; |
| | | //温度 |
| | | string temperature = string.Empty; |
| | | //湿度 |
| | | string humidity = string.Empty; |
| | | //PM2.5 |
| | | string pm = string.Empty; |
| | | //CO2 |
| | | string co2 = string.Empty; |
| | | |
| | | var tempAirQuality = tempera.AirQuality(tempera); |
| | | |
| | | if (tempAirQuality == 1) |
| | | { |
| | | curQuality = Language.StringByID(R.MyInternationalizationString.ExcellentAirQuality); |
| | | } |
| | | else if (tempAirQuality == 2) |
| | | { |
| | | curQuality = Language.StringByID(R.MyInternationalizationString.GoodAirQuality); |
| | | } |
| | | else if (tempAirQuality == 3) |
| | | { |
| | | curQuality = Language.StringByID(R.MyInternationalizationString.Pollution); |
| | | } |
| | | else |
| | | { |
| | | curQuality = ""; |
| | | } |
| | | |
| | | humidity = $"{tempera.currentHumidity}%"; |
| | | temperature = $"{tempera.currentTemperature}℃"; |
| | | pm = $"{tempera.currentPmData}μg/m³"; |
| | | //co2 = $"{tempera.currentCO2}ppm"; |
| | | return $"{curQuality},{pm},{temperature},{humidity}"; |
| | | } |
| | | else |
| | | { |
| | | if (tempera.SensorDiv == 1) |
| | | { |
| | | if (tempera.currentTemperature == 0) |
| | | { |
| | | return "0.0℃"; |
| | | } |
| | | return $"{tempera.currentTemperature}℃"; |
| | | } |
| | | else if (tempera.SensorDiv == 2) |
| | | { |
| | | if (tempera.currentHumidity == 0) |
| | | { |
| | | return "--%"; |
| | | } |
| | | return $"{tempera.currentHumidity}%"; |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |