| | |
| | | { |
| | | switch (command) |
| | | { |
| | | case Command.ReadLightSingleLoopBrightnessACK: |
| | | case Command.SetSingleLightACK: |
| | | foreach (var function in DB_ResidenceData.residenceData.functions) |
| | | foreach (var function in DB_ResidenceData.residenceData.functions.lights) |
| | | { |
| | | if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | if (function.funcType == FunctionType.Light) |
| | | if (function.functionCategory == FunctionType.Light) |
| | | { |
| | | var light = function as Light; |
| | | if (receiveBytes[2] == 0 && light.state == 0) |
| | |
| | | { |
| | | break; |
| | | } |
| | | if (function.bus_DeviceType == "Relay") |
| | | if (function.functionType == "Relay") |
| | | { |
| | | var relay = function as Light; |
| | | relay.state = receiveBytes[2] == 0 ? 0 : 1; |
| | | HomePage.UpdataLightView(relay); |
| | | //RoomPage. |
| | | } |
| | | else if (function.bus_DeviceType == "Dimmer") |
| | | else if (function.functionType == "brightness") |
| | | { |
| | | var dimmer = function as Dimmer; |
| | | var dimmer = function as Light; |
| | | dimmer.state = receiveBytes[2] == 0 ? 0 : 1; |
| | | dimmer.brightness = receiveBytes[1]; |
| | | dimmer.dicPropert["brightness"] = receiveBytes[1]; |
| | | //dimmer.brightness = receiveBytes[1]; |
| | | if (receiveBytes[2] > 0) |
| | | dimmer.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[2] + "%"; |
| | | HomePage.UpdataLightView(dimmer); |