File was renamed from HDL_ON/DAL/DriverLayer/Packet.cs |
| | |
| | | namespace HDL_ON |
| | | { |
| | | /// <summary> |
| | | /// Udp数据包 |
| | | /// bus控制数据包 |
| | | /// </summary> |
| | | public class Packet |
| | | { |
| | |
| | | try |
| | | { |
| | | //如果当前通讯方式不是本地bus udp则退出 |
| | | if(DriverLayer.Control.ins.communicationMode != DriverLayer.CommunicationMode.local_BusUdp) |
| | | if(DriverLayer.Control.ins.communicationMode == DriverLayer.CommunicationMode.local_BusUdp) |
| | | { |
| | | return; |
| | | } |
| | |
| | | } |
| | | } |
| | | 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; |
| | | } |
| | | |
| | | |