| | |
| | | /// </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, |
| | |
| | | { |
| | | b1 += (byte)(16 + wm); |
| | | } |
| | | if (commandDictionary.ContainsKey("temp")) |
| | | if (commandDictionary.ContainsKey("set_temp")) |
| | | { |
| | | var dicTempString = ""; |
| | | commandDictionary.TryGetValue("temp", out dicTempString); |
| | | commandDictionary.TryGetValue("set_temp", out dicTempString); |
| | | var dicTemp = Convert.ToByte(dicTempString); |
| | | var mode = function.GetAttrState(FunctionAttributeKey.Mode); |
| | | switch (mode) |
| | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //7 湿度设定 % |
| | | //8 室内温度值 ℃ |
| | | byte indoorTemp_airFrsh = 0; |
| | | if (commandDictionary.ContainsKey(FunctionAttributeKey.IndoorTemp) == true) |
| | | { |
| | | indoorTemp_airFrsh= Convert.ToByte(commandDictionary[FunctionAttributeKey.IndoorTemp]); |
| | | } |
| | | byte indoorHumidity_airFrsh = 0; |
| | | if (commandDictionary.ContainsKey(FunctionAttributeKey.IndoorHumidity) == true) |
| | | { |
| | | indoorHumidity_airFrsh = Convert.ToByte(commandDictionary[FunctionAttributeKey.IndoorHumidity]); |
| | | } |
| | | //9 室内湿度值 ℃ |
| | | //10 过滤网剩余 % |
| | | //11 过滤网使用超时 1 超时 0 无 |
| | | //11 过滤网使用超时 1 超时 0 无 |
| | | ControlBytesSend(Command.FreshAirControl_JinMao, subnetId, deviceId, new byte[] { |
| | | function.bus.LoopId,0, switchValue , |
| | | airFreshMode,airFreshEnergy, |
| | | airFreshFan, |
| | | Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Humidity)), |
| | | 0,0,0,0 |
| | | //Convert.ToByte( function.GetAttrState(FunctionAttributeKey.IndoorTemp)), |
| | | //Convert.ToByte( function.GetAttrState(FunctionAttributeKey.IndoorHumidity)), |
| | | indoorTemp_airFrsh, |
| | | indoorHumidity_airFrsh, |
| | | //Convert.ToByte( function.GetAttrState(FunctionAttributeKey.FilterRemain)), |
| | | //function.GetAttrState(FunctionAttributeKey.FilterTimeout) =="true"?1:0, |
| | | 0,0 |
| | | }); |
| | | break; |
| | | } |