wxr
2020-11-20 e2ffb5fce53119f5cb36e3b2466becbefa096842
HDL_ON/DriverLayer/Packet.cs
File was renamed from HDL_ON/DAL/DriverLayer/Packet.cs
@@ -8,7 +8,7 @@
namespace HDL_ON
{
    /// <summary>
    /// Udp数据包
    /// bus控制数据包
    /// </summary>
    public class Packet
    {
@@ -56,7 +56,7 @@
            try
            {
                //如果当前通讯方式不是本地bus udp则退出
                if(DriverLayer.Control.ins.communicationMode != DriverLayer.CommunicationMode.local_BusUdp)
                if(DriverLayer.Control.ins.communicationMode == DriverLayer.CommunicationMode.local_BusUdp)
                {
                    return;
                }
@@ -571,33 +571,12 @@
                            }
                        }
                        break;
                    case Command.ReadGatewayACK:
                        var mac = ByteToHex16(receiveBytes[5]) + "." + ByteToHex16(receiveBytes[6]) + "." + ByteToHex16(receiveBytes[7]) + "." + ByteToHex16(receiveBytes[8]) + "." + ByteToHex16(receiveBytes[9]) + "." + ByteToHex16(receiveBytes[10]) + "." + ByteToHex16(receiveBytes[11]) + "." + ByteToHex16(receiveBytes[12]);
                        if (DB_ResidenceData.residenceData.residenceGatewayMAC == mac)
                        {
                            DriverLayer.Control.ins.gatewayOnline = true;
                        }
                        break;
                }
            }
            catch (Exception ex)
            {
                MainPage.Log($"Bus Rev Erorr : {ex.Message}");
            }
        }
        /// <summary>
        /// byte转16进制字符串
        /// </summary>
        /// <param name="b"></param>
        /// <returns></returns>
        string ByteToHex16(byte b)
        {
            string s = Convert.ToString(b, 16).ToUpper();
            if(s.Length<=1)
            {
                return "0" +s;
            }
            return s;
        }