| | |
| | | |
| | | switch (command) |
| | | { |
| | | case Command.ReadLightSingleLoopBrightnessACK: |
| | | case Command.SetSingleLightACK: |
| | | foreach (var light in DB_ResidenceData.residenceData.functionList.lights) |
| | | { |
| | |
| | | } |
| | | |
| | | break; |
| | | case Command.ReadLightAllLoopBrightnessACK: |
| | | for (int i = 0; i < receiveBytes[0]; i++) |
| | | { |
| | | var light = DB_ResidenceData.residenceData.functionList.lights.Find((obj) => obj.bus_Data.SubnetID == subnetID && obj.bus_Data.DeviceID == deviceID && obj.bus_Data.LoopID == i); |
| | | if (light != null) |
| | | { |
| | | if (light.functionType != FunctionType.RGB) |
| | | { |
| | | light.on_off = receiveBytes[2] == 0 ? "off" : "on"; |
| | | if (light.on_off == "on") |
| | | { |
| | | light.brightness = receiveBytes[2]; |
| | | light.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[2] + "%"; |
| | | } |
| | | HomePage.UpdataFunctionStates(light); |
| | | RoomPage.UpdataStates(light); |
| | | FunctionPage.UpdataStates(light); |
| | | ClassificationPage.UpdataInfo(light); |
| | | switch (light.functionType) |
| | | { |
| | | case FunctionType.Relay: |
| | | RelayPage.UpdataState(light); |
| | | break; |
| | | case FunctionType.Dimmer: |
| | | DimmerPage.UpdataStates(light); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var e = DB_ResidenceData.residenceData.functionList.electricals.Find((obj) => obj.bus_Data.SubnetID == subnetID && obj.bus_Data.DeviceID == deviceID && obj.bus_Data.LoopID == i); |
| | | if (e != null) |
| | | { |
| | | var fan = e as Fan; |
| | | fan.on_off = receiveBytes[2] == 0 ? "off" : "on"; |
| | | if (fan.on_off == "on") |
| | | { |
| | | fan.openLevel = receiveBytes[2]; |
| | | fan.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2]; |
| | | } |
| | | HomePage.UpdataFunctionStates(fan); |
| | | RoomPage.UpdataStates(fan); |
| | | FunctionPage.UpdataStates(fan); |
| | | ClassificationPage.UpdataInfo(fan); |
| | | switch (fan.functionType) |
| | | { |
| | | case FunctionType.Fan: |
| | | FanPage.UpdataState(fan); |
| | | break; |
| | | case FunctionType.Socket: |
| | | |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Command.SetLogicLoopColorACK: |
| | | case Command.ReadLogicLoopColorACK: |
| | | foreach (var rgb in DB_ResidenceData.residenceData.functionList.lights) |