兴趣是坚持一件事永不衰竭的动力
发布时间:2016-01-18 00:46:07
package com.dd.model.protocol;import java.util.HashMap;public class TypeLentMap{private static HashMap<DataTypeEnum, Integer> mapTable = new HashMap<DataTypeEnum, Integer>();public TypeLentMap(){mapTable.put(DataTypeEnum.BOOL, 1);mapTable.put(DataTypeEnum.INT8, 1);mapTable.put(Dat.........【阅读全文】
发布时间:2016-01-18 00:45:38
package com.dd.model.protocol;public class TTLDecoder{private TTL ttl;private DataTypeEnum type;private short len;String serialData;byte serialByte[];public TTLDecoder(byte serialByte[]){StringBuffer sb = new StringBuffer();for (int i = 0; i < serialByte.length; i++){sb.append(Strin.........【阅读全文】
发布时间:2016-01-18 00:45:16
package com.dd.model.protocol;public class TTL implements IProtocolBase{private short tag;private DataTypeEnum type;private short len;public TTL(){}public TTL(short tag, DataTypeEnum type){this.tag = tag;this.type = type;this.len = getLenByType(type);}private short getLenByType(D.........【阅读全文】
发布时间: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')).........【阅读全文】