wxr
2021-07-01 43b0d5870d528f23ecd6aeceb6cfd4325188b46f
HDL_ON/DAL/DriverLayer/Control_Udp.cs
@@ -646,10 +646,10 @@
                                        {
                                            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)
@@ -711,7 +711,7 @@
                                //4   运行模式    1 - 通风,2 - 加湿
                                byte airFreshMode = 1;
                                if (commandDictionary.ContainsKey(FunctionAttributeKey.Mode) == true
                                    && commandDictionary[FunctionAttributeKey.Mode] == "fan")
                                    && commandDictionary[FunctionAttributeKey.Mode] == "humidification")
                                {
                                    airFreshMode = 2;
                                }
@@ -742,22 +742,31 @@
                                            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;
                        }
@@ -984,7 +993,7 @@
            try
            {
                //MainPage.Log("发送数据:" + SendFlag);
                MainPage.Log("发送数据:" + SendFlag);
                UdpSocket._BusSocket.AsyncBeginSend(packet);
                packet.HaveSendCount--;
@@ -1107,11 +1116,22 @@
                var sendBytes = Control.Ins.ConvertSendBodyData(CommunicationTopic.SearchLoaclGateway, bodyString);
                //组播发送
                packet = new Packet(sendBytes, new System.Net.IPEndPoint(System.Net.IPAddress.Parse("239.0.168.188"), 8585));
                packet.HaveSendCount = 4;//ps:没有重发,后期有时间可以增加重发判断
                packet.HaveSendCount = 4;
                System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(managerSendCount));
                thread.IsBackground = true;
                thread.Start(packet);
                //wait();不需要等待
                //hjSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                //hjSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
                //EndPoint ipep = new IPEndPoint(IPAddress.Parse(CsConst.myLocalIP), HDLUDP.UDPPort);
                //hjSocket.Bind(ipep);
            }
            catch (Exception ex)
            {