兴趣是坚持一件事永不衰竭的动力
发布时间:2016-01-18 00:44:36
package com.dd.model.protocol;import java.util.Iterator;public class Test{public static void main(String[] args){//Field field = new Field(new TTL((short)1, DataTypeEnum.STRING), new Value("1234567890"));Field version = new Field(new TTL((short)1, DataTypeEnum.INT16), new Value<>((sh.........【阅读全文】
发布时间:2016-01-18 00:44:09
package com.dd.model.protocol;public class SerialDataDecoder{public static byte toHalfByte(String str){byte result = 0;String upperCaseString = null;if(str.length()==1){upperCaseString = str.toUpperCase();if((upperCaseString.charAt(0) >= '0') && (upperCaseString.charAt(0) <= '9')).........【阅读全文】
发布时间: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.........【阅读全文】