兴趣是坚持一件事永不衰竭的动力
发布时间:2016-01-18 00:43:39
package com.dd.model.protocol;public interface IProtocolBase{public int getTotalLen();public int getSerialTotalLen();public String toString();public byte [] serial();}......【阅读全文】
发布时间:2016-01-18 00:42:10
package com.dd.model.protocol;public class FieldDecoder{Field field;private String serialData;private byte serialByte[];public FieldDecoder(byte serialByte[]){StringBuffer sb = new StringBuffer();for (int i = 0; i < serialByte.length; i++){sb.append(String.format("%02x", serialByte[.........【阅读全文】
发布时间:2016-01-18 00:41:36
package com.dd.model.protocol;public class Field implements IProtocolBase{TTL ttl;Value value;public Field(){}public Field(TTL ttl, Value value){super();this.ttl = ttl;this.value = value;ttl.setLen((short)value.getTotalLen());}@Overridepublic int getTotalLen(){if((ttl == nu.........【阅读全文】
发布时间:2016-01-18 00:41:09
package com.dd.model.protocol;public enum DataTypeEnum{BOOL, // ?????INT8, // ?????????????INT16, // 16λ?з???????INT32, // 32λ?з???????FLOAT,//STRING, // ????????????????STRUCT, // ???????????????LIST, // ?????б.........【阅读全文】
发布时间:2016-01-18 00:40:34
package com.dd.model.protocol;public class CmdLoginDecoder{Field version = new Field(new TTL((short)1, DataTypeEnum.INT16), new Value<>((short)1));Field cmd = new Field(new TTL((short)2, DataTypeEnum.INT32), new Value<>(1));Field handle = new Field(new TTL((short)3, DataTypeEnum.FLOAT), new V.........【阅读全文】