| | |
| | | var tempList = new List<BindListAllInfo>(); |
| | | int count1 = 0; |
| | | int count2 = 0; |
| | | |
| | | switch (curBindType) |
| | | { |
| | | case 1: |
| | | curSwitchCount = 0; |
| | | break; |
| | | case 2: |
| | | curSocketCount = 0; |
| | | break; |
| | | case 3: |
| | | curLightFromRelayCount = 0; |
| | | curLightCount = 0; |
| | | break; |
| | | } |
| | | |
| | | foreach (var key in bindTargetsFromMutilfunctionPanelList.Keys) |
| | | { |
| | | var bList = bindTargetsFromMutilfunctionPanelList[key]; |
| | | foreach (var bDev in bList) |
| | | { |
| | | if (curBindType == 0) |
| | | { |
| | | if (bDev.KeyEpoint >= 32 && bDev.KeyEpoint <= 51) |
| | | { |
| | | tempList.Add(bDev); |
| | | } |
| | | } |
| | | |
| | | var device = LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint); |
| | | if (device == null) |
| | | { |
| | | continue; |
| | | } |
| | | switch (curBindType) |
| | | { |
| | | case 0: |
| | | if (bDev.KeyEpoint >= 32 && bDev.KeyEpoint <= 51) |
| | | { |
| | | tempList.Add(bDev); |
| | | } |
| | | break; |
| | | case 1: |
| | | if (bDev.KeyEpoint >= 52 && bDev.KeyEpoint <= 61) |
| | | { |
| | |
| | | //空调绑定类型 |
| | | if (device.Type == DeviceType.Thermostat && bDev.BindCluster == 513) |
| | | { |
| | | //Thermostat是空调 |
| | | tempList.Add(bDev); |
| | | } |
| | | } |
| | |
| | | } |
| | | return tempList; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 调光灯和继电器特殊处理方法 |
| | | /// <param name="curBindType">当前类型 0:场景 1:开关 2:插座 3:灯光 4:遮阳 5:空调 6:新风</param> |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static void UpdateLightCount(int curBindType) |
| | | { |
| | | |
| | | if (curBindType == 1 || curBindType == 2 || curBindType == 3) |
| | | { |
| | | curSwitchCount = 0; |
| | | curSocketCount = 0; |
| | | curLightFromRelayCount = 0; |
| | | curLightCount = 0; |
| | | |
| | | foreach (var key in bindTargetsFromMutilfunctionPanelList.Keys) |
| | | { |
| | | var bList = bindTargetsFromMutilfunctionPanelList[key]; |
| | | foreach (var bDev in bList) |
| | | { |
| | | var device = LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint); |
| | | if (device == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (bDev.KeyEpoint >= 52 && bDev.KeyEpoint <= 61) |
| | | { |
| | | if (device != null) |
| | | { |
| | | if (device.DfunctionType == DeviceFunctionType.A开关) |
| | | { |
| | | curSwitchCount++; |
| | | } |
| | | else if (device.DfunctionType == DeviceFunctionType.A插座) |
| | | { |
| | | curSocketCount++; |
| | | } |
| | | else if (device.DfunctionType == DeviceFunctionType.A灯光) |
| | | { |
| | | curLightFromRelayCount++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (bDev.KeyEpoint >= 22 && bDev.KeyEpoint <= 28) |
| | | { |
| | | if (device != null) |
| | | { |
| | | if (device.Type == DeviceType.DimmableLight && bDev.BindCluster == 8) |
| | | { |
| | | curLightCount++; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 支持匹配的端点个数 |
| | |
| | | var bList = bindTargetsFromMutilfunctionPanelList[key]; |
| | | foreach (var bDev in bList) |
| | | { |
| | | if (curBindType == 0) |
| | | { |
| | | if (bDev.KeyEpoint >= 32 && bDev.KeyEpoint <= 51) |
| | | { |
| | | tempList.Remove(bDev.KeyEpoint); |
| | | } |
| | | } |
| | | |
| | | var device = LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint); |
| | | if (device == null) |
| | | { |
| | | continue; |
| | | } |
| | | switch (curBindType) |
| | | { |
| | | case 0: |
| | | if (bDev.KeyEpoint >= 32 && bDev.KeyEpoint <= 51) |
| | | { |
| | | tempList.Remove(bDev.KeyEpoint); |
| | | } |
| | | break; |
| | | case 1: |
| | | case 2: |
| | | if (bDev.KeyEpoint >= 52 && bDev.KeyEpoint <= 61) |
| | |
| | | //空调绑定类型 |
| | | if (device.Type == DeviceType.Thermostat && bDev.BindCluster == 513) |
| | | { |
| | | //Thermostat是空调 |
| | | tempList.Remove(bDev.KeyEpoint); |
| | | } |
| | | } |
| | |
| | | roomIncludeMatchDevice.Add(device); |
| | | } |
| | | } |
| | | if (device.Type == DeviceType.DimmableLight) |
| | | { |
| | | roomIncludeMatchDevice.Add(device); |
| | | } |
| | | //if (device.Type == DeviceType.DimmableLight) |
| | | //{ |
| | | // roomIncludeMatchDevice.Add(device); |
| | | //} |
| | | break; |
| | | case 4: |
| | | if (device.Type == DeviceType.WindowCoveringDevice) |
| | |
| | | case 5: |
| | | if (device.Type == DeviceType.Thermostat) |
| | | { |
| | | //Thermostat是空调 |
| | | if (BindInfo.checkRealAcDevice(device) == false) |
| | | { |
| | | continue; |
| | | } |
| | | roomIncludeMatchDevice.Add(device); |
| | | } |
| | | break; |
| | |
| | | { |
| | | currentPanelBindSupportDeviceListTemp.Add(device); |
| | | } |
| | | if (device.Type == DeviceType.DimmableLight) |
| | | { |
| | | currentPanelBindSupportDeviceListTemp.Add(device); |
| | | } |
| | | //if (device.Type == DeviceType.DimmableLight) |
| | | //{ |
| | | // currentPanelBindSupportDeviceListTemp.Add(device); |
| | | //} |
| | | break; |
| | | case 4: |
| | | if (device.Type == DeviceType.WindowCoveringDevice) |
| | |
| | | case 5: |
| | | if (device.Type == DeviceType.Thermostat) |
| | | { |
| | | //Thermostat是空调 |
| | | if (BindInfo.checkRealAcDevice(device) == false) |
| | | { |
| | | continue; |
| | | } |
| | | currentPanelBindSupportDeviceListTemp.Add(device); |
| | | } |
| | | break; |
| | |
| | | undistruibuteDevList.Add(device); |
| | | } |
| | | } |
| | | if (device.Type == DeviceType.DimmableLight) |
| | | { |
| | | undistruibuteDevList.Add(device); |
| | | } |
| | | break; |
| | | case 4: |
| | | if (device.Type == DeviceType.WindowCoveringDevice) |
| | |
| | | case 5: |
| | | if (device.Type == DeviceType.Thermostat) |
| | | { |
| | | //Thermostat是空调 |
| | | if (BindInfo.checkRealAcDevice(device) == false) |
| | | { |
| | | continue; |
| | | } |
| | | undistruibuteDevList.Add(device); |
| | | } |
| | | break; |
| | |
| | | curRoomDeviceListTemp.Add(device); |
| | | } |
| | | } |
| | | if (device.Type == DeviceType.DimmableLight) |
| | | { |
| | | if (deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.ButtonPanel_SimpleMultifunction) |
| | | { |
| | | //Thermostat是空调 |
| | | curRoomDeviceListTemp.Add(device); |
| | | } |
| | | } |
| | | break; |
| | | case 4: |
| | | if (device.Type == DeviceType.WindowCoveringDevice) |
| | | { |
| | | if (deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.ButtonPanel_SimpleMultifunction) |
| | | { |
| | | //Thermostat是空调 |
| | | curRoomDeviceListTemp.Add(device); |
| | | } |
| | | } |
| | |
| | | case 5: |
| | | if (device.Type == DeviceType.Thermostat) |
| | | { |
| | | if (deviceEnumInfo.ConcreteType != Common.DeviceConcreteType.ButtonPanel_SimpleMultifunction) |
| | | if (BindInfo.checkRealAcDevice(device) == false) |
| | | { |
| | | //Thermostat是空调 |
| | | curRoomDeviceListTemp.Add(device); |
| | | continue; |
| | | } |
| | | curRoomDeviceListTemp.Add(device); |
| | | } |
| | | break; |
| | | case 6: |