| | |
| | | { |
| | | ddd += bb + ","; |
| | | } |
| | | MainPage.Log($"bus命令:"+ ((int)command) + " : 数据:" + ddd); |
| | | MainPage.Log($"bus命令:" + ((int)command).ToString("X").PadLeft(4, '0') + " : 数据:" + ddd); |
| | | //MainPage.Log($"bus命令:"+ ((int)command) + " : 数据:" + ddd); |
| | | #endif |
| | | //处理是否要重发数据 |
| | | ManagerReceive(subnetID, deviceID, command, usefulBytes); |
| | |
| | | break; |
| | | case Command.SetLogicLoopColorACK: |
| | | case Command.ReadLogicLoopColorACK: |
| | | foreach (var rgb in FunctionList.List.GetLightList()) |
| | | foreach (var lightTeme in FunctionList.List.GetLightList()) |
| | | { |
| | | if (rgb.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | if (lightTeme.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | if (rgb.spk == SPK.LightRGB) |
| | | if (lightTeme.spk == SPK.LightRGB) |
| | | { |
| | | rgb.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off"; |
| | | lightTeme.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off"; |
| | | if (receiveBytes[1] > 0) |
| | | { |
| | | rgb.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString()); |
| | | rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%"; |
| | | lightTeme.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString()); |
| | | lightTeme.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%"; |
| | | } |
| | | new Light().SetRGBcolor(new byte[] { receiveBytes[6], receiveBytes[7], receiveBytes[8] }, rgb); |
| | | new Light().SetRGBcolor(new byte[] { receiveBytes[6], receiveBytes[7], receiveBytes[8] }, lightTeme); |
| | | |
| | | HomePage.UpdataFunctionStates(rgb); |
| | | RoomPage.UpdataStates(rgb); |
| | | FunctionPage.UpdataStates(rgb); |
| | | ClassificationPage.UpdataInfo(rgb); |
| | | RGBPage.UpdataStates(rgb); |
| | | HomePage.UpdataFunctionStates(lightTeme); |
| | | RoomPage.UpdataStates(lightTeme); |
| | | FunctionPage.UpdataStates(lightTeme); |
| | | ClassificationPage.UpdataInfo(lightTeme); |
| | | RGBPage.UpdataStates(lightTeme); |
| | | }else if(lightTeme.spk == SPK.LightCCT) |
| | | { |
| | | lightTeme.trait_on_off.curValue = receiveBytes[1] > 0 ? "on" : "off"; |
| | | if (receiveBytes[1] > 0) |
| | | { |
| | | lightTeme.SetAttrState(FunctionAttributeKey.Brightness, receiveBytes[1].ToString()); |
| | | lightTeme.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%"; |
| | | } |
| | | new Light().SetCCT(new byte[] { receiveBytes[6], receiveBytes[7] }, lightTeme); |
| | | |
| | | HomePage.UpdataFunctionStates(lightTeme); |
| | | RoomPage.UpdataStates(lightTeme); |
| | | FunctionPage.UpdataStates(lightTeme); |
| | | ClassificationPage.UpdataInfo(lightTeme); |
| | | ColorTureLampPage.UpdataStatus(lightTeme); |
| | | } |
| | | } |
| | | } |