wxr
2022-07-19 bb4bcd1b320502b36d19aacec52ed886a975249a
HDL_ON/DAL/DriverLayer/Packet.cs
@@ -53,8 +53,11 @@
        /// </summary>
        public virtual void Manager()
        {
#if DEBUG
#else
            try
            {
            {
#endif
                //对于操作数据库的时间比较长的,可以创建另一个线程处理
                if (!"HDLMIRACLE".Equals(Encoding.ASCII.GetString(Bytes, 4, 10)))
                {
@@ -102,11 +105,15 @@
#endif
                //处理是否要重发数据
                ManagerReceive(subnetID, deviceID, command, usefulBytes);
            }
#if DEBUG
#else
              }
            catch (Exception ex)
            {
                MainPage.Log($"packet {ex.Message} ");
            }
#endif
        }
        /// <summary>
@@ -118,8 +125,11 @@
        /// <param name="receiveBytes"></param>
        void UdpPacket_DataProcessing(byte subnetID, byte deviceID, Command command, byte[] receiveBytes)
        {
#if DEBUG
#else
            try
            {
#endif
                switch (command)
                {
                    case Command.SetSingleLightACK:
@@ -329,11 +339,18 @@
                        break;
                    case Command.SetACModeACK:
                    case Command.ReadACModeACK:
                        foreach (var function in FunctionList.List.GetAcList())
                        foreach (var function in FunctionList.List.Functions)
                        {
                        if (function.bus == null || function.spk != SPK.AcStandard)
                        {
                            continue;
                        }
                            var acFunction = new AC();
                            if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
                            if (function.bus.SubnetID == subnetID &&
                                function.bus.DeviceID ==  deviceID &&
                                function.bus.LoopId == receiveBytes[0])
                            {
                            Console.WriteLine(function.GetBusId());
                                function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[1].ToString());
                                function.SetAttrState(FunctionAttributeKey.RoomTemp, receiveBytes[2].ToString());
                                function.SetAttrState(FunctionAttributeKey.OnOff,  receiveBytes[8] == 1 ? "on" : "off");
@@ -379,7 +396,7 @@
                                FunctionPage.UpdataStates(function);
                                HomePage.UpdataFunctionStates(function);
                                ClassificationPage.UpdataInfo(function);
                                Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(function.sid, function.status);
                                Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(function);
                            }
                        }
@@ -652,7 +669,9 @@
                                }
                                function.lastState = "";
                                function.lastState += " " + function.GetAttrState(FunctionAttributeKey.SetTemp) + acFunction.GetTempUnitString(function);
                                function.lastState += acFunction.GetModeAttrText(function.GetAttrState(FunctionAttributeKey.Mode)) +
                                    acFunction.GetModeAttrText(function.GetAttrState(FunctionAttributeKey.FanSpeed)) +
                                    " " + function.GetAttrState(FunctionAttributeKey.SetTemp) + acFunction.GetTempUnitString(function);
                                RoomPage.UpdataStates(function);
                                FunctionPage.UpdataStates(function);
                                HomePage.UpdataFunctionStates(function);
@@ -726,11 +745,16 @@
                        }
                        break;
                }
            }
#if DEBUG
#else
              }
            catch (Exception ex)
            {
                MainPage.Log($"Bus Rev Erorr : {ex.Message}");
            }
#endif
        }
        /// <summary>
        /// byte转16进制字符串