| | |
| | | using System.Collections.Generic; |
| | | using System.Threading.Tasks; |
| | | using Shared.Common; |
| | | using Shared.Phone.Device.Category; |
| | | using Shared.Phone.UserCenter.Device; |
| | | using ZigBee.Device; |
| | | using static ZigBee.Device.Panel; |
| | |
| | | /// 记录旧的目标列表 |
| | | /// </summary> |
| | | public static List<CommonDevice> oldTargetList = new List<CommonDevice>(); |
| | | |
| | | //public static async System.Threading.Tasks.Task<int> RemoveTargets(BindObj.BindListResponseObj bindDevice, Panel currentKey) |
| | | //{ |
| | | // var delDevice = new BindObj.DelDeviceBindData(); |
| | | // delDevice.DeviceAddr = currentKey.DeviceAddr; |
| | | // delDevice.Epoint = currentKey.DeviceEpoint; |
| | | |
| | | // if (bindDevice.BindType == 0 || bindDevice.BindType == 1) |
| | | // { |
| | | // var removeDevice = new BindObj.RemoveBindListObj(); |
| | | // removeDevice.BindCluster = bindDevice.BindCluster; |
| | | // removeDevice.BindType = 0; |
| | | // removeDevice.BindMacAddr = bindDevice.BindMacAddr; |
| | | // removeDevice.BindEpoint = bindDevice.BindEpoint; |
| | | // delDevice.RemoveBindList.Add(removeDevice); |
| | | // } |
| | | // else if (bindDevice.BindType == 2) |
| | | // { |
| | | // var removeDevice = new BindObj.RemoveBindListObj(); |
| | | // removeDevice.BindCluster = bindDevice.BindCluster; |
| | | // removeDevice.BindType = 1; |
| | | // removeDevice.BindScenesId = bindDevice.BindScenesId; |
| | | // delDevice.RemoveBindList.Add(removeDevice); |
| | | // } |
| | | // var delResult = await currentKey.DelDeviceBindAsync(delDevice); |
| | | // foreach (var re in delResult.delDeviceBindResponseData.RemoveBindList) |
| | | // { |
| | | // switch (re.Result) |
| | | // { |
| | | // case 0: |
| | | // return 0; |
| | | // break; |
| | | // case 4: |
| | | |
| | | // if (delResult.removeBindResultResponseData != null) |
| | | // { |
| | | // if (delResult.removeBindResultResponseData.Result == 0) |
| | | // { |
| | | // return 0; |
| | | // } |
| | | // } |
| | | // break; |
| | | // } |
| | | // } |
| | | // return -1; |
| | | //} |
| | | |
| | | public static async System.Threading.Tasks.Task<int> RemoveTargets(BindObj.BindListResponseObj bindDevice, Panel currentKey) |
| | | { |
| | | var delDevice = new BindObj.DelDeviceBindData(); |
| | | delDevice.DeviceAddr = currentKey.DeviceAddr; |
| | | delDevice.Epoint = currentKey.DeviceEpoint; |
| | | |
| | | if (bindDevice.BindType == 0 || bindDevice.BindType == 1) |
| | | { |
| | | var removeDevice = new BindObj.RemoveBindListObj(); |
| | | removeDevice.BindCluster = bindDevice.BindCluster; |
| | | removeDevice.BindType = 0; |
| | | removeDevice.BindMacAddr = bindDevice.BindMacAddr; |
| | | removeDevice.BindEpoint = bindDevice.BindEpoint; |
| | | delDevice.RemoveBindList.Add(removeDevice); |
| | | } |
| | | else if (bindDevice.BindType == 2) |
| | | { |
| | | var removeDevice = new BindObj.RemoveBindListObj(); |
| | | removeDevice.BindCluster = bindDevice.BindCluster; |
| | | removeDevice.BindType = 1; |
| | | removeDevice.BindScenesId = bindDevice.BindScenesId; |
| | | delDevice.RemoveBindList.Add(removeDevice); |
| | | } |
| | | var delResult = await currentKey.DelDeviceBindAsync(delDevice); |
| | | if (delResult != null && delResult.removeBindResultResponseData != null) |
| | | { |
| | | if (delResult.removeBindResultResponseData.Result == 0) |
| | | { |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance); |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 检测该设备能否显示 |
| | |
| | | /// <returns></returns> |
| | | public static bool CheckCanShowRoom(Common.Room room, string curDeviceBindType = "AddSwitch") |
| | | { |
| | | if (room.DeviceUIList.Count == 0) |
| | | if (room.ListDevice.Count == 0) |
| | | { |
| | | return false; |
| | | } |
| | |
| | | { |
| | | return false; |
| | | } |
| | | foreach (var deviceUi in room.DeviceUIList) |
| | | foreach (var deviceKeys in room.ListDevice) |
| | | { |
| | | var device = Common.LocalDevice.Current.GetDevice(deviceKeys); |
| | | //检测该设备能否显示 |
| | | if (CheckCanShowDevice(deviceUi.CommonDevice, curDeviceBindType) == false) |
| | | if (CheckCanShowDevice(device, curDeviceBindType) == false) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public static string GetCurrentKeyAllRoomList() |
| | | { |
| | | var dicFloor = Common.Room.CurrentRoom.GetFloorSortList(); |
| | | var dicFloor = HdlRoomLogic.Current.GetFloorSortList(); |
| | | foreach (var floorId in dicFloor.Keys) |
| | | { |
| | | //第一个楼层 |
| | | return dicFloor[floorId]; |
| | | break; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public static string GetCurrentSelectFloorId() |
| | | { |
| | | var dicFloor = Common.Room.CurrentRoom.GetFloorSortList(); |
| | | var dicFloor = HdlRoomLogic.Current.GetFloorSortList();// |
| | | foreach (var floorId in dicFloor.Keys) |
| | | { |
| | | //第一个楼层 |
| | | return floorId; |
| | | break; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public static string GetCurrentSelectFloorIdName() |
| | | { |
| | | var dicFloor = Common.Room.CurrentRoom.GetFloorSortList(); |
| | | var dicFloor = HdlRoomLogic.Current.GetFloorSortList(); |
| | | foreach (var floorId in dicFloor.Keys) |
| | | { |
| | | //第一个楼层 |
| | | return dicFloor[floorId]; |
| | | break; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取当前楼层名称 |
| | | /// fllodID:楼层ID |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static string GetBindTargetsFloorIdName(string curFllodID) |
| | | { |
| | | var dicFloor = HdlRoomLogic.Current.GetFloorSortList(); |
| | | foreach (var floorId in dicFloor.Keys) |
| | | { |
| | | //当前楼层 |
| | | if (curFllodID == floorId) |
| | | { |
| | | return dicFloor[floorId]; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | return dicCheck; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |