@Test public void test() { byte[] headerPacket = { (byte) 0x00, (byte) 0x02, (byte) 0xf7, (byte) 0xf0, (byte) 0xc0, (byte) 0x99, (byte) 0x0a, (byte) 0x49, (byte) 0x26, (byte) 0xa6, (byte) 0x02, (byte) 0x01, (byte) 0x02, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0xe1, (byte) 0xf5, (byte) 0x05, (byte) 0x08, (byte) 0x01, (byte) 0x32, (byte) 0x00, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff }; DeviceHeader deviceHeader = new DeviceHeader(Arrays.copyOfRange( headerPacket, 0, 24)); assertEquals("PIXELPUSHER: MAC(00:02:f7:f0:c0:99), IP(/10.73.38.166), " + "Protocol Ver(1), Vendor ID(2), Product ID(1), " + "HW Rev(2), SW Rev(3), Link Spd(100000000), ", deviceHeader.toString()); }
@Override public String toString() { StringBuffer outBuf = new StringBuffer(); outBuf.append(this.DeviceType.name()); outBuf.append(": MAC(" + this.GetMacAddressString() + "), "); outBuf.append("IP(" + this.IpAddress.toString() + "), "); outBuf.append("Protocol Ver(" + this.ProtocolVersion + "), "); outBuf.append("Vendor ID(" + this.VendorId + "), "); outBuf.append("Product ID(" + this.ProductId + "), "); outBuf.append("HW Rev(" + this.HardwareRevision + "), "); outBuf.append("SW Rev(" + this.SoftwareRevision + "), "); outBuf.append("Link Spd(" + this.LinkSpeed + "), "); return outBuf.toString(); }
DeviceHeader { @Override public String toString() { StringBuffer outBuf = new StringBuffer(); outBuf.append(this.DeviceType.name()); outBuf.append(": MAC(" + this.GetMacAddressString() + "), "); outBuf.append("IP(" + this.IpAddress.toString() + "), "); outBuf.append("Protocol Ver(" + this.ProtocolVersion + "), "); outBuf.append("Vendor ID(" + this.VendorId + "), "); outBuf.append("Product ID(" + this.ProductId + "), "); outBuf.append("HW Rev(" + this.HardwareRevision + "), "); outBuf.append("SW Rev(" + this.SoftwareRevision + "), "); outBuf.append("Link Spd(" + this.LinkSpeed + "), "); return outBuf.toString(); } }
DeviceHeader { @Override public String toString() { StringBuffer outBuf = new StringBuffer(); outBuf.append(this.DeviceType.name()); outBuf.append(": MAC(" + this.GetMacAddressString() + "), "); outBuf.append("IP(" + this.IpAddress.toString() + "), "); outBuf.append("Protocol Ver(" + this.ProtocolVersion + "), "); outBuf.append("Vendor ID(" + this.VendorId + "), "); outBuf.append("Product ID(" + this.ProductId + "), "); outBuf.append("HW Rev(" + this.HardwareRevision + "), "); outBuf.append("SW Rev(" + this.SoftwareRevision + "), "); outBuf.append("Link Spd(" + this.LinkSpeed + "), "); return outBuf.toString(); } DeviceHeader(byte[] packet); }
DeviceHeader { @Override public String toString() { StringBuffer outBuf = new StringBuffer(); outBuf.append(this.DeviceType.name()); outBuf.append(": MAC(" + this.GetMacAddressString() + "), "); outBuf.append("IP(" + this.IpAddress.toString() + "), "); outBuf.append("Protocol Ver(" + this.ProtocolVersion + "), "); outBuf.append("Vendor ID(" + this.VendorId + "), "); outBuf.append("Product ID(" + this.ProductId + "), "); outBuf.append("HW Rev(" + this.HardwareRevision + "), "); outBuf.append("SW Rev(" + this.SoftwareRevision + "), "); outBuf.append("Link Spd(" + this.LinkSpeed + "), "); return outBuf.toString(); } DeviceHeader(byte[] packet); @Override String toString(); String GetMacAddressString(); }
DeviceHeader { @Override public String toString() { StringBuffer outBuf = new StringBuffer(); outBuf.append(this.DeviceType.name()); outBuf.append(": MAC(" + this.GetMacAddressString() + "), "); outBuf.append("IP(" + this.IpAddress.toString() + "), "); outBuf.append("Protocol Ver(" + this.ProtocolVersion + "), "); outBuf.append("Vendor ID(" + this.VendorId + "), "); outBuf.append("Product ID(" + this.ProductId + "), "); outBuf.append("HW Rev(" + this.HardwareRevision + "), "); outBuf.append("SW Rev(" + this.SoftwareRevision + "), "); outBuf.append("Link Spd(" + this.LinkSpeed + "), "); return outBuf.toString(); } DeviceHeader(byte[] packet); @Override String toString(); String GetMacAddressString(); public byte[] MacAddress; public InetAddress IpAddress; public DeviceType DeviceType; public int ProtocolVersion; public int VendorId; public int ProductId; public int HardwareRevision; public int SoftwareRevision; public long LinkSpeed; public byte[] PacketRemainder; }