| | |
| | | /// </summary> |
| | | public void ControlBytesSend(Command command, byte subnetID, byte deviceID, byte[] gatewayBytes, int sendCount = 3) |
| | | { |
| | | #if DEBUG |
| | | string ddd = ""; |
| | | foreach (var bb in gatewayBytes) |
| | | { |
| | | ddd += bb + ","; |
| | | } |
| | | MainPage.Log($"发送bus命令:" + ((int)command).ToString("X").PadLeft(4,'0') + " : 数据:" + ddd); |
| | | #endif |
| | | |
| | | var control = new Control_Udp(); |
| | | control.Send(new Target() |
| | | { |
| | |
| | | { |
| | | case SPK.LightCCT: |
| | | byte b0 = 100;//开关操作依据on_off字段,实际开关值依据brightness,当on_off为打开,brightness不能为0 |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | | if(commandDictionary.ContainsKey(FunctionAttributeKey.OnOff)) |
| | | { |
| | | b0 = 0; |
| | | if (function.trait_on_off.curValue.ToString() == "off") |
| | | { |
| | | b0 = 0; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | b0 = Convert.ToByte( function.GetAttrState(FunctionAttributeKey.Brightness)) == 0 ? (byte)100 : Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness)); |
| | | b0 = Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness));// == 0 ? (byte)100 : Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness)); |
| | | } |
| | | var bytes0 = new byte[] { function.bus.LoopId, |
| | | b0, |