| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Globalization; |
| | | using ZigBee.Device;
|
| | | using static ZigBee.Device.Scene; |
| | | |
| | | namespace Shared.Common |
| | |
| | | /// 选择的设备 |
| | | /// Type=0 存在 |
| | | /// </summary> |
| | | public DeviceUI DeviceUI = new DeviceUI(); |
| | | public CommonDevice DeviceUI = new CommonDevice(); |
| | | |
| | | /// <summary> |
| | | /// Type=0、1、2 存在 |
| | |
| | | /// 唯一标识--HashCode |
| | | /// DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo) |
| | | /// </summary> |
| | | public string SceneTargetDeviceUIID |
| | | { |
| | | get |
| | | { |
| | | return GetHashCode().ToString(); |
| | | } |
| | | } |
| | | public string SceneTargetDeviceUIID = Guid.NewGuid().ToString(); |
| | | |
| | | /// <summary> |
| | | /// GetDeviceStatu |
| | |
| | | /// <returns></returns> |
| | | public string GetDeviceStatu() |
| | | { |
| | | if (DeviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.OnOffOutput) |
| | | if (DeviceUI.Type == ZigBee.Device.DeviceType.OnOffOutput) |
| | | { |
| | | if (TaskList.Count == 0) |
| | | { |
| | |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.Shut); |
| | | } |
| | | else if (DeviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.AirSwitch) |
| | | else if (DeviceUI.Type == ZigBee.Device.DeviceType.AirSwitch) |
| | | { |
| | | if (TaskList.Count == 0) |
| | | { |
| | |
| | | } |
| | | return Language.StringByID(R.MyInternationalizationString.Shut); |
| | | } |
| | | else if (DeviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.DimmableLight) |
| | | else if (DeviceUI.Type == ZigBee.Device.DeviceType.DimmableLight) |
| | | { |
| | | if (TaskList.Count == 0) |
| | | { |
| | |
| | | } |
| | | return $"{(int)(TaskList[0].Data1 * 1.0 / 254 * 100)}%"; |
| | | } |
| | | else if (DeviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.WindowCoveringDevice) |
| | | else if (DeviceUI.Type == ZigBee.Device.DeviceType.WindowCoveringDevice) |
| | | { |
| | | if (TaskList.Count == 0) |
| | | { |
| | | return null; |
| | | } |
| | | if (TaskList[0].Data1 == 0) |
| | | if (TaskList[0].Data1 == 1) |
| | | { |
| | | return Language.StringByID(R.MyInternationalizationString.Shut); |
| | | } |
| | | return $"{TaskList[0].Data1}%"; |
| | | return $"{TaskList[0].Data2}%"; |
| | | } |
| | | else if (DeviceUI.CommonDevice.Type == ZigBee.Device.DeviceType.Thermostat) |
| | | else if (DeviceUI.Type == ZigBee.Device.DeviceType.Thermostat) |
| | | { |
| | | //温度,模式,风速 |
| | | string tempareture = string.Empty; |
| | |
| | | } |
| | | else if(taskListInfo.Data1==4 || taskListInfo.Data1==5) |
| | | { |
| | | tempareture = $"{ taskListInfo.Data2} ℃"; |
| | | tempareture = $"{ taskListInfo.Data2/100} ℃"; |
| | | } |
| | | else if (taskListInfo.Data1 == 6) |
| | | { |
| | |
| | | } |
| | | return $"{tempareture},{model},{wind}"; |
| | | } |
| | | |
| | | else |
| | | { |
| | | return null; |