| | |
| | | } |
| | | break; |
| | | case Command.SetSingleLightACK: |
| | | Console.WriteLine ("Command.SetSingleLightACK"); |
| | | //Console.WriteLine ($"Command.SetSingleLightACK: subnetID:{subnetID} deviceID:{deviceID} 回路:{usefullBytes [0]}"); |
| | | //Console.WriteLine ("Command.SetSingleLightACK"); |
| | | foreach (var room in Room.Lists) { |
| | | var common = room.DeviceList.Find ((obj) => obj.CommonLoopID == subnetID.ToString () + "_" + deviceID.ToString () + "_" + usefullBytes [0].ToString ()); |
| | | if (common != null) { |
| | |
| | | hadBeUpdate = false; |
| | | (common as LightDimming).CurrentBrightness = usefullBytes [2]; |
| | | } else if (common.Type == DeviceType.FanModule) { |
| | | //if ((common as FanModule).Switch == usefullBytes [2]) { |
| | | // hadBeUpdate = false; |
| | | //} |
| | | (common as FanModule).Switch = usefullBytes [2]; |
| | | if (usefullBytes [2] != 0) |
| | | (common as FanModule).WindSpeed = usefullBytes [2]; |
| | | |
| | | //(common as FanModule).Switch = usefullBytes [2]; |
| | | } else if (common.Type == DeviceType.LightMixSwitch) { |
| | | if ((common as LightMixSwitch).CurrentBrightness == usefullBytes [2]) |
| | | hadBeUpdate = false; |
| | |
| | | if (!string.IsNullOrEmpty (room.Name)) |
| | | UserDeviceToLight.UpdateBrighingCount (updateFlag); |
| | | if (hadBeUpdate) { |
| | | |
| | | UserRoom.UpdataDeviceStatus (common); |
| | | UserLightPage.UpdateStatus (updateFlag, usefullBytes [2]); |
| | | UserDeviceToLight.UpdateStatus (updateFlag, usefullBytes [2]); |
| | |
| | | } |
| | | } |
| | | break; |
| | | case Command. ReadAnalogValueACK: |
| | | case Command.ReadAnalogValueACK: |
| | | foreach (var room in Room.Lists) { |
| | | foreach (var common in room.DeviceList) { |
| | | if (common.SubnetID != subnetID || common.DeviceID != deviceID || common.LoopID != usefullBytes [1]) { |
| | |
| | | |
| | | |
| | | |
| | | int dddd = usefullBytes [0] & 0x3F; |
| | | int dddd = usefullBytes [0] & 0x3F; |
| | | |
| | | // 0xXX:公司内部协议对应的序号 |
| | | // common.Type:对应的是编辑软件的序号(没有一一对应,是为了将相近的调整在一起,方便客户使用) |