| | |
| | | { |
| | | foreach (var bd in oldTargetList) |
| | | { |
| | | var delDevice = new DelDeviceBindData(); |
| | | delDevice.DeviceAddr = curControlDev.DeviceAddr; |
| | | delDevice.Epoint = curControlDev.DeviceEpoint; |
| | | |
| | | var removeDevice = new RemoveBindListObj(); |
| | | removeDevice.BindType = 0; |
| | | switch (curDeviceBindType) |
| | | var delDevice = DelBindDevice(bd); |
| | | var delResult = new DelDeviceBindResponseAllData(); |
| | | delResult = await curControlDev.DelDeviceBindAsync(delDevice); |
| | | if (delResult != null && delResult.removeBindResultResponseData != null) |
| | | { |
| | | case 1: |
| | | removeDevice.BindCluster = 514; |
| | | break; |
| | | case 2: |
| | | removeDevice.BindCluster = 1026; |
| | | break; |
| | | case 3: |
| | | removeDevice.BindCluster = 1029; |
| | | break; |
| | | case 4: |
| | | //PM2.5 |
| | | break; |
| | | if (delResult.removeBindResultResponseData.Result != 0) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | removeDevice.BindMacAddr = bd.DeviceAddr; |
| | | removeDevice.BindEpoint = bd.DeviceEpoint; |
| | | delDevice.RemoveBindList.Add(removeDevice); |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //检测已经绑定的目标是否不在本地或者没有分配到任何房间中 |
| | | //此时需要删除已经被绑定到目标,才能继续绑定新目标 |
| | | if (curBindDevice != null) |
| | | { |
| | | var delDevice = DelBindDevice(curBindDevice); |
| | | var delResult = new DelDeviceBindResponseAllData(); |
| | | delResult = await curControlDev.DelDeviceBindAsync(delDevice); |
| | | if (delResult != null && delResult.removeBindResultResponseData != null) |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 检测已经绑定的目标是否不在本地或者没有分配到任何房间中 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private DelDeviceBindData DelBindDevice(CommonDevice bd) |
| | | { |
| | | var delDevice = new DelDeviceBindData(); |
| | | delDevice.DeviceAddr = curControlDev.DeviceAddr; |
| | | delDevice.Epoint = curControlDev.DeviceEpoint; |
| | | |
| | | var removeDevice = new RemoveBindListObj(); |
| | | removeDevice.BindType = 0; |
| | | switch (curDeviceBindType) |
| | | { |
| | | case 1: |
| | | removeDevice.BindCluster = 514; |
| | | break; |
| | | case 2: |
| | | removeDevice.BindCluster = 1026; |
| | | break; |
| | | case 3: |
| | | removeDevice.BindCluster = 1029; |
| | | break; |
| | | case 4: |
| | | //PM2.5 |
| | | break; |
| | | } |
| | | removeDevice.BindMacAddr = bd.DeviceAddr; |
| | | removeDevice.BindEpoint = bd.DeviceEpoint; |
| | | delDevice.RemoveBindList.Add(removeDevice); |
| | | return delDevice; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 能显示的房间列表 |
| | | /// </summary> |
| | | private List<Room> GetSupportRoomList() |