package com.zteits.nbiot.decoder; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import java.util.Arrays; public class ZteitsReportProcess { private String factoryCode; private String model; private int reportType; private int nowTime1; private int nowTime2; private int state; private int packCount; private int voltage; private int magId; private int magRssi; private int x; private int y; private int z; private int version; private int parkCnt; private int sendCnt; private int baseX; private int baseY; private int baseZ; private int alarmInfo; private int reserverd1; private int reserverd2; private int reserverd3; private int reserverd4; private int reserverd5; private int reserverd6; private int crc; public String getFactoryCode() { return this.factoryCode; } public void setFactoryCode(String paramString) { this.factoryCode = paramString; } public String getModel() { return this.model; } public void setModel(String paramString) { this.model = paramString; } public int getReportType() { return this.reportType; } public void setReportType(int paramInt) { this.reportType = paramInt; } public int getNowTime1() { return this.nowTime1; } public void setNowTime1(int paramInt) { this.nowTime1 = paramInt; } public int getNowTime2() { return this.nowTime2; } public void setNowTime2(int paramInt) { this.nowTime2 = paramInt; } public int getState() { return this.state; } public void setState(int paramInt) { this.state = paramInt; } public int getPackCount() { return this.packCount; } public void setPackCount(int paramInt) { this.packCount = paramInt; } public int getVoltage() { return this.voltage; } public void setVoltage(int paramInt) { this.voltage = paramInt; } public int getMagId() { return this.magId; } public void setMagId(int paramInt) { this.magId = paramInt; } public int getMagRssi() { return this.magRssi; } public void setMagRssi(int paramInt) { this.magRssi = paramInt; } public int getX() { return this.x; } public void setX(int paramInt) { this.x = paramInt; } public int getY() { return this.y; } public void setY(int paramInt) { this.y = paramInt; } public int getZ() { return this.z; } public void setZ(int paramInt) { this.z = paramInt; } public int getVersion() { return this.version; } public void setVersion(int paramInt) { this.version = paramInt; } public int getParkCnt() { return this.parkCnt; } public void setParkCnt(int paramInt) { this.parkCnt = paramInt; } public int getSendCnt() { return this.sendCnt; } public void setSendCnt(int paramInt) { this.sendCnt = paramInt; } public int getBaseX() { return this.baseX; } public void setBaseX(int paramInt) { this.baseX = paramInt; } public int getBaseY() { return this.baseY; } public void setBaseY(int paramInt) { this.baseY = paramInt; } public int getBaseZ() { return this.baseZ; } public void setBaseZ(int paramInt) { this.baseZ = paramInt; } public int getAlarmInfo() { return this.alarmInfo; } public void setAlarmInfo(int paramInt) { this.alarmInfo = paramInt; } public int getReserverd1() { return this.reserverd1; } public void setReserverd1(int paramInt) { this.reserverd1 = paramInt; } public int getReserverd2() { return this.reserverd2; } public void setReserverd2(int paramInt) { this.reserverd2 = paramInt; } public int getReserverd3() { return this.reserverd3; } public void setReserverd3(int paramInt) { this.reserverd3 = paramInt; } public int getReserverd4() { return this.reserverd4; } public void setReserverd4(int paramInt) { this.reserverd4 = paramInt; } public int getReserverd5() { return this.reserverd5; } public void setReserverd5(int paramInt) { this.reserverd5 = paramInt; } public int getReserverd6() { return this.reserverd6; } public void setReserverd6(int paramInt) { this.reserverd6 = paramInt; } public int getCrc() { return this.crc; } public void setCrc(int paramInt) { this.crc = paramInt; } public ZteitsReportProcess(byte[] binaryData) { this.factoryCode = Utilty.hexStringToString(binaryData, 0, 4); this.model = Utilty.hexStringToString(binaryData,4,8); this.reportType = Utilty.hexStringToInteger(binaryData,8,9); this.nowTime1 = Utilty.hexStringToInteger(binaryData,9,13); this.nowTime2 = Utilty.hexStringToInteger(binaryData,13,17); this.state = Utilty.hexStringToInteger(binaryData,17,18); this.packCount = Utilty.hexStringToInteger(binaryData,18,20); this.voltage = Utilty.hexStringToInteger(binaryData,20,22); this.magId = Utilty.hexStringToInteger(binaryData,22,26); this.magRssi = Utilty.hexStringToInteger(binaryData,26,27); this.x = Utilty.hexStringToInteger(binaryData,27,29); this.y = Utilty.hexStringToInteger(binaryData,29,31); this.z = Utilty.hexStringToInteger(binaryData,31,33); this.version = Utilty.hexStringToInteger(binaryData,33,35); this.parkCnt = Utilty.hexStringToInteger(binaryData,35,37); this.sendCnt = Utilty.hexStringToInteger(binaryData,37,40); this.baseX = Utilty.hexStringToInteger(binaryData,40,42); this.baseY = Utilty.hexStringToInteger(binaryData,42,44); this.baseZ = Utilty.hexStringToInteger(binaryData,44,46); this.alarmInfo = Utilty.hexStringToInteger(binaryData,46,47); this.reserverd1 = Utilty.hexStringToInteger(binaryData,47,48); this.reserverd2 = Utilty.hexStringToInteger(binaryData,48,49); this.reserverd3 = Utilty.hexStringToInteger(binaryData,49,50); this.reserverd4 = Utilty.hexStringToInteger(binaryData,50,52); this.reserverd5 = Utilty.hexStringToInteger(binaryData,52,54); this.reserverd6 = Utilty.hexStringToInteger(binaryData,54,58); this.crc = Utilty.hexStringToInteger(binaryData,58,60); } public ObjectNode toJsonNode() { ObjectMapper localObjectMapper = new ObjectMapper(); ObjectNode localObjectNode1 = localObjectMapper.createObjectNode(); localObjectNode1.put("msgType", "deviceReq"); ArrayNode localArrayNode = localObjectMapper.createArrayNode(); ObjectNode localObjectNode2 = localObjectMapper.createObjectNode(); localObjectNode2 = localObjectMapper.createObjectNode(); localObjectNode2.put("factoryCode", getFactoryCode()); localObjectNode2.put("model", getModel()); localObjectNode2.put("reportType", getReportType()); localObjectNode2.put("reportTime1", getNowTime1()); localObjectNode2.put("reportTime", getNowTime2()); localObjectNode2.put("state", getState()); localObjectNode2.put("packCount", getPackCount()); localObjectNode2.put("voltage", getVoltage()); localObjectNode2.put("magId", getMagId()); localObjectNode2.put("deviceId", getMagId()); localObjectNode2.put("rssi", getMagRssi()); localObjectNode2.put("x", getX()); localObjectNode2.put("y", getY()); localObjectNode2.put("z", getZ()); localObjectNode2.put("version", getVersion()); localObjectNode2.put("parkCnt", getParkCnt()); localObjectNode2.put("sendCnt", getSendCnt()); localObjectNode2.put("baseX", getBaseX()); localObjectNode2.put("baseY", getBaseY()); localObjectNode2.put("baseZ", getBaseZ()); localObjectNode2.put("alarmInfo", getAlarmInfo()); localObjectNode2.put("reserverd1", getReserverd1()); localObjectNode2.put("reserverd2", getReserverd2()); localObjectNode2.put("reserverd3", getReserverd3()); localObjectNode2.put("reserverd4", getReserverd4()); localObjectNode2.put("reserverd5", getReserverd5()); localObjectNode2.put("reserverd6", getReserverd6()); localObjectNode2.put("crc", getCrc()); ObjectNode localObjectNode3 = localObjectMapper.createObjectNode(); localObjectNode3.put("serviceId", "VehicleDetectorInfo"); localObjectNode3.set("serviceData", localObjectNode2); localArrayNode.add(localObjectNode3); localObjectNode1.set("data", localArrayNode); return localObjectNode1; } }