| | |
| | | |
| | | System.Threading.Tasks.Task.Run (() => { |
| | | try { |
| | | int mSendCount = 0; |
| | | foreach (var room in Room.Lists) { |
| | | if (room == null) |
| | | continue; |
| | |
| | | continue; |
| | | } |
| | | foreach (var common in room.DeviceList) { |
| | | |
| | | byte [] returnBytes = null; |
| | | if (common.Type == DeviceType.LightDimming || common.Type == DeviceType.LightSwitch || common.Type == DeviceType.LightRGB || common.Type == DeviceType.LightEnergySwitch |
| | | || common.Type == DeviceType.LightMixDimming || common.Type == DeviceType.LightMixSwitch || common.Type == DeviceType.LightDALI) { |
| | | |
| | | new System.Threading.Thread (() => { |
| | | mSendCount++; |
| | | |
| | | if (common.Type == DeviceType.LightDimming || common.Type == DeviceType.LightDALI) { |
| | | var light = (LightDimming)common; |
| | | if (b == 100) { |
| | |
| | | var light = (LightMixSwitch)common; |
| | | returnBytes = Control.ControlBytesSendHasReturn (Command.SetSingleLight, common.SubnetID, common.DeviceID, new byte [] { light.PhysicsLoopID, b, light.DelayTimeHeight, light.DelayTimeLow }); |
| | | } else { |
| | | continue; |
| | | returnBytes = new byte [] { 0x00 }; |
| | | } |
| | | if (showTip) { |
| | | if (returnBytes == null) { |
| | |
| | | }); |
| | | } |
| | | } |
| | | |
| | | mSendCount--; |
| | | }) { IsBackground = true }.Start(); |
| | | |
| | | //等待100ms再发送第二个设备数据 |
| | | System.Threading.Thread.Sleep (100); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | while (mSendCount > 0) { |
| | | System.Threading.Thread.Sleep (100); |
| | | } |
| | | |
| | | |
| | | } catch { |
| | | Console.WriteLine ("controlAllLight catch"); |
| | | } finally { |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过设备类型方式选择设备 |
| | | /// </summary> |