From 2ceb875793ffa7ec3a4fd1db45acd1e8861f6252 Mon Sep 17 00:00:00 2001 From: zhaowg Date: Thu, 30 Aug 2018 14:49:47 +0800 Subject: [PATCH] 烽火-电信IOT插件 --- VehicleDetector_FH_FH/VehicleDetector-FH-FH.iml | 36 ++++++++++++++++++++++++++++++++++++ VehicleDetector_FH_FH/lib/com.huawei.m2m.cig.tup-1.3.1.jar | Bin 0 -> 1615 bytes VehicleDetector_FH_FH/package/package-info.json | 1 + VehicleDetector_FH_FH/package/package.zip | Bin 0 -> 152260 bytes VehicleDetector_FH_FH/package/preload/VehicleDetector-FH-FH-1.0.0.jar | Bin 0 -> 152176 bytes VehicleDetector_FH_FH/pom.xml | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ VehicleDetector_FH_FH/src/main/java/com/fh/party/CmdProcess.java | 44 ++++++++++++++++++++++++++++++++++++++++++++ VehicleDetector_FH_FH/src/main/java/com/fh/party/ProtocolAdapterImpl.java | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ VehicleDetector_FH_FH/src/main/java/com/fh/party/ReportProcess.java | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ VehicleDetector_FH_FH/src/main/java/com/fh/party/Utilty.java | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ VehicleDetector_FH_FH/src/main/resources/OSGI-INF/CodecProvideHandler.xml | 7 +++++++ VehicleDetector_FH_FH/src/test/java/com/fh/party/ProtocolServiceImplTest.java | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pom.xml | 1 + zteits-nbiot/package/package-info.json | 1 + zteits-nbiot/src/main/java/com/zteits/nbiot/decoder/ZteitsReportProcess.java | 6 ++++-- zteits-nbiot/src/test/java/com/thrid/party/codec/demo/ProtocolServiceImplTest.java | 8 +++++++- 16 files changed, 661 insertions(+), 3 deletions(-) create mode 100644 VehicleDetector_FH_FH/VehicleDetector-FH-FH.iml create mode 100644 VehicleDetector_FH_FH/lib/com.huawei.m2m.cig.tup-1.3.1.jar create mode 100644 VehicleDetector_FH_FH/package/package-info.json create mode 100644 VehicleDetector_FH_FH/package/package.zip create mode 100644 VehicleDetector_FH_FH/package/preload/VehicleDetector-FH-FH-1.0.0.jar create mode 100644 VehicleDetector_FH_FH/pom.xml create mode 100644 VehicleDetector_FH_FH/src/main/java/com/fh/party/CmdProcess.java create mode 100644 VehicleDetector_FH_FH/src/main/java/com/fh/party/ProtocolAdapterImpl.java create mode 100644 VehicleDetector_FH_FH/src/main/java/com/fh/party/ReportProcess.java create mode 100644 VehicleDetector_FH_FH/src/main/java/com/fh/party/Utilty.java create mode 100644 VehicleDetector_FH_FH/src/main/resources/OSGI-INF/CodecProvideHandler.xml create mode 100644 VehicleDetector_FH_FH/src/test/java/com/fh/party/ProtocolServiceImplTest.java create mode 100644 zteits-nbiot/package/package-info.json diff --git a/VehicleDetector_FH_FH/VehicleDetector-FH-FH.iml b/VehicleDetector_FH_FH/VehicleDetector-FH-FH.iml new file mode 100644 index 0000000..4d43525 --- /dev/null +++ b/VehicleDetector_FH_FH/VehicleDetector-FH-FH.iml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/VehicleDetector_FH_FH/lib/com.huawei.m2m.cig.tup-1.3.1.jar b/VehicleDetector_FH_FH/lib/com.huawei.m2m.cig.tup-1.3.1.jar new file mode 100644 index 0000000..389ffc0 Binary files /dev/null and b/VehicleDetector_FH_FH/lib/com.huawei.m2m.cig.tup-1.3.1.jar differ diff --git a/VehicleDetector_FH_FH/package/package-info.json b/VehicleDetector_FH_FH/package/package-info.json new file mode 100644 index 0000000..f121152 --- /dev/null +++ b/VehicleDetector_FH_FH/package/package-info.json @@ -0,0 +1 @@ +{"specVersion":"1.0","fileName":"package.zip","version":"1.0.0","deviceType":"VehicleDetector","manufacturerName":"FH","model":"FH","description":"CIG codec plugin auto-generated by sps.","platform":"linux","packageType":"CIGPlugin","date":"Wed Aug 29 03:47:49 GMT 2018","ignoreList":[],"bundles":[{"bundleName":"VehicleDetector-FH-FH","bundleVersion":"1.0.0","priority":5,"fileName":"VehicleDetector-FH-FH-1.0.0.jar","bundleDesc":"","versionDesc":""}]} \ No newline at end of file diff --git a/VehicleDetector_FH_FH/package/package.zip b/VehicleDetector_FH_FH/package/package.zip new file mode 100644 index 0000000..9fa2798 Binary files /dev/null and b/VehicleDetector_FH_FH/package/package.zip differ diff --git a/VehicleDetector_FH_FH/package/preload/VehicleDetector-FH-FH-1.0.0.jar b/VehicleDetector_FH_FH/package/preload/VehicleDetector-FH-FH-1.0.0.jar new file mode 100644 index 0000000..7f22bac Binary files /dev/null and b/VehicleDetector_FH_FH/package/preload/VehicleDetector-FH-FH-1.0.0.jar differ diff --git a/VehicleDetector_FH_FH/pom.xml b/VehicleDetector_FH_FH/pom.xml new file mode 100644 index 0000000..a50405c --- /dev/null +++ b/VehicleDetector_FH_FH/pom.xml @@ -0,0 +1,115 @@ + + 4.0.0 + + com.fh.party + + VehicleDetector-FH-FH + 1.0.0 + + bundle + + + UTF-8 + 4.11 + 2.7.4 + 2.5.4 + 2.4 + 1.3.1 + 1.7.6 + ./ + + + + + + junit + junit + ${junit.version} + + + + org.slf4j + slf4j-api + ${slf4j.api.version} + + + + com.fasterxml.jackson.core + jackson-databind + ${fasterxml.jackson.version} + + + + + com.huawei + protocal-jar + 1.3.1 + system + ${basedir}/lib/com.huawei.m2m.cig.tup-1.3.1.jar + + + + + net.sf.json-lib + json-lib + 2.4 + jdk15 + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + org.apache.felix + maven-bundle-plugin + ${felix.maven.plugin.version} + true + + ./target + + false + + + J2SE-1.5 + + OSGI-INF/* + + VehicleDetector-FH-FH + + + org.slf4j, + org.slf4j.spi, + org.apache.log4j.spi, + com.huawei.m2m.cig.tup.modules.protocol_adapter, + com.fasterxml.jackson.databind, + com.fasterxml.jackson.databind.node + + + + json-lib + + + + + + generate-resource + + manifest + + + + + + + \ No newline at end of file diff --git a/VehicleDetector_FH_FH/src/main/java/com/fh/party/CmdProcess.java b/VehicleDetector_FH_FH/src/main/java/com/fh/party/CmdProcess.java new file mode 100644 index 0000000..a396939 --- /dev/null +++ b/VehicleDetector_FH_FH/src/main/java/com/fh/party/CmdProcess.java @@ -0,0 +1,44 @@ +package com.fh.party; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; + +public class CmdProcess { + + //private String identifier = "123"; + private byte cmdid = 0x01; + private int pid; + private int tid; + private int eventcnt; + private int verno; + private int eventstate; + + + public CmdProcess() { + } + + public CmdProcess(ObjectNode input) { + try { + this.pid = (byte)input.get("pid").asInt(); + this.tid = (byte)input.get("tid").asInt(); + this.eventcnt = (byte)input.get("eventcnt").asInt(); + this.verno = (byte)input.get("verno").asInt(); + this.eventstate = (byte)input.get("eventstate").asInt(); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + public byte[] toByte() { + byte[] bytes = new byte[6]; + bytes[0] = cmdid; + bytes[1] = (byte)pid; + bytes[2] = (byte)tid; + bytes[3] = (byte)eventcnt; + bytes[4] = (byte)verno; + bytes[5] = (byte)eventstate; + return bytes; + } + +} diff --git a/VehicleDetector_FH_FH/src/main/java/com/fh/party/ProtocolAdapterImpl.java b/VehicleDetector_FH_FH/src/main/java/com/fh/party/ProtocolAdapterImpl.java new file mode 100644 index 0000000..d912eab --- /dev/null +++ b/VehicleDetector_FH_FH/src/main/java/com/fh/party/ProtocolAdapterImpl.java @@ -0,0 +1,61 @@ +package com.fh.party; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.huawei.m2m.cig.tup.modules.protocol_adapter.IProtocolAdapter; + + +public class ProtocolAdapterImpl implements IProtocolAdapter { + + private static final Logger logger = LoggerFactory.getLogger(ProtocolAdapterImpl.class); + // 厂商名称 + private static final String MANU_FACTURERID = "FH"; + // 设备型号 + private static final String MODEL = "FH"; + + @Override + public String getManufacturerId() { + return MANU_FACTURERID; + } + + @Override + public String getModel() { + return MODEL; + } + + public void activate() { + logger.info("Codec demo HttpMessageHander activated."); + } + + public void deactivate() { + logger.info("Codec demo HttpMessageHander deactivated."); + } + + public byte[] encode(ObjectNode input) throws Exception { + /*logger.info("dynamic lrbtest " + input.toString()); + try { + CmdProcess cmdProcess = new CmdProcess(input); + byte[] byteNode = cmdProcess.toByte(); + return byteNode; + } catch (Exception e) { + e.printStackTrace(); + return null; + }*/ + return null; + } + + public ObjectNode decode(byte[] binaryData) throws Exception { + try { + ReportProcess lightProcess = new ReportProcess(binaryData); + ObjectNode objectNode = lightProcess.toJsonNode(); + logger.info("dynamic lrbtest " + objectNode.toString()); + return objectNode; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + +} diff --git a/VehicleDetector_FH_FH/src/main/java/com/fh/party/ReportProcess.java b/VehicleDetector_FH_FH/src/main/java/com/fh/party/ReportProcess.java new file mode 100644 index 0000000..efece23 --- /dev/null +++ b/VehicleDetector_FH_FH/src/main/java/com/fh/party/ReportProcess.java @@ -0,0 +1,111 @@ +package com.fh.party; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +public class ReportProcess { + private byte cmdid = 0x01; + private int pid; + private int tid; + private int eventcnt; + private int verno; + private byte eventstate; + + // + private String factoryCode = "fh"; + private String model = "fh"; + private int reportType; + private int reportTime; + private int state; + private int packCount; + private int voltage; + private int magId; + private int rssi; + private int version; + + public ReportProcess(byte[] binaryData) throws ParseException { + pid = binaryData[1]; + tid = binaryData[2]; + eventcnt = binaryData[3]; + verno = binaryData[4]; + eventstate = binaryData[5]; + if((eventstate & 1) == 1){ + reportType = 33; + } + if((eventstate & 2) == 2){ + reportType = 32; + } + if((eventstate & 3) == 3){ + reportType = 32; + } + magId = tid; + reportTime = calLastedTime(); + if((eventstate & 32) == 32){ + state = 1; + }else{ + state = 0; + } + } + + public ObjectNode toJsonNode() { + try { + //组装body体 + ObjectMapper mapper = new ObjectMapper(); + ObjectNode root = mapper.createObjectNode(); + // root.put("identifier", this.identifier); + root.put("factoryCode", this.factoryCode); + root.put("model", this.model); + root.put("reportType", this.reportType); + root.put("reportTime", this.reportTime); + root.put("state", this.state); + root.put("magId", this.magId); + return root; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 1970-1-1 经过的秒总数 + * @return + */ + public static int calLastedTime() throws ParseException { + long a = new Date().getTime(); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + Date startDate = dateFormat.parse("1970-01-01"); + long b = startDate.getTime(); + return (int)((a - b) / 1000); + } + + /** + * 将byte转换为一个长度为8的byte数组,数组每个值代表bit + */ + public static byte[] byteToArray(byte b) { + byte[] array = new byte[8]; + for (int i = 7; i >= 0; i--) { + array[i] = (byte)(b & 1); + b = (byte) (b >> 1); + } + return array; + } + + /** + * 把byte转为字符串的bit + */ + public static String byteToBit(byte b) { + return "" + + (byte) ((b >> 7) & 0x1) + (byte) ((b >> 6) & 0x1) + + (byte) ((b >> 5) & 0x1) + (byte) ((b >> 4) & 0x1) + + (byte) ((b >> 3) & 0x1) + (byte) ((b >> 2) & 0x1) + + (byte) ((b >> 1) & 0x1) + (byte) ((b >> 0) & 0x1); + } + + public static void main(String[] args) throws ParseException { + } +} \ No newline at end of file diff --git a/VehicleDetector_FH_FH/src/main/java/com/fh/party/Utilty.java b/VehicleDetector_FH_FH/src/main/java/com/fh/party/Utilty.java new file mode 100644 index 0000000..dde0641 --- /dev/null +++ b/VehicleDetector_FH_FH/src/main/java/com/fh/party/Utilty.java @@ -0,0 +1,59 @@ +package com.fh.party; + + +public class Utilty { + + private static Utilty instance = new Utilty(); + + public static Utilty getInstance() { + return instance; + } + + public static final int MIN_MID_VALUE = 1; + + public static final int MAX_MID_VALUE = 65535; + + + public int bytes2Int(byte[] b, int start, int length) { + int sum = 0; + int end = start + length; + for (int k = start; k < end; k++) { + int n = ((int) b[k]) & 0xff; + n <<= (--length) * 8; + sum += n; + } + return sum; + } + + public byte[] int2Bytes(int value, int length) { + byte[] b = new byte[length]; + for (int k = 0; k < length; k++) { + b[length - k - 1] = (byte) ((value >> 8 * k) & 0xff); + } + return b; + } + + public boolean isValidofMid(int mId) { + if (mId < MIN_MID_VALUE || mId > MAX_MID_VALUE) { + return false; + } + return true; + } + + + public static String parseByte2HexStr(byte[] buf) { + if (null == buf) { + return null; + } + + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < buf.length; i++) { + String hex = Integer.toHexString(buf[i] & 0xFF); + if (hex.length() == 1) { + hex = '0' + hex; + } + sb.append(hex.toUpperCase()); + } + return sb.toString(); + } +} diff --git a/VehicleDetector_FH_FH/src/main/resources/OSGI-INF/CodecProvideHandler.xml b/VehicleDetector_FH_FH/src/main/resources/OSGI-INF/CodecProvideHandler.xml new file mode 100644 index 0000000..615f98e --- /dev/null +++ b/VehicleDetector_FH_FH/src/main/resources/OSGI-INF/CodecProvideHandler.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/VehicleDetector_FH_FH/src/test/java/com/fh/party/ProtocolServiceImplTest.java b/VehicleDetector_FH_FH/src/test/java/com/fh/party/ProtocolServiceImplTest.java new file mode 100644 index 0000000..a93962c --- /dev/null +++ b/VehicleDetector_FH_FH/src/test/java/com/fh/party/ProtocolServiceImplTest.java @@ -0,0 +1,214 @@ +package com.fh.party; + +import org.junit.Before; +import org.junit.Test; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.huawei.m2m.cig.tup.modules.protocol_adapter.IProtocolAdapter; + +/** + * Unit test for simple App. + */ +public class ProtocolServiceImplTest { + + private IProtocolAdapter protocolAdapter; + + @Before + public void setProtocolAdapter() { + this.protocolAdapter = new ProtocolAdapterImpl(); + } + + /** + * 测试用例1:设备向平台上报数据。 + *

+ *

+     * 设备上报数据:AA72000032088D0320623399
+     * 
+ * + * @throws Exception + */ + @Test + public void testDecodeDeviceReportData() throws Exception { + byte[] deviceReqByte = getArray(); + ObjectNode objectNode = protocolAdapter.decode(deviceReqByte); + String str = objectNode.toString(); + System.out.println(str); + } + + /** + * 测试用例2:平台向设备下发控制命令: + *

+ *

+     * {
+     * //"identifier": "123",
+     * "msgType": "cloudReq",
+     * "cmd": "SET_DEVICE_LEVEL",
+     * "mid": 2016,
+     * "paras": { "value": "10" },
+     * "hasMore": 0
+     * }
+     * 
+ */ + //@Test + public byte[] testEncodeIoTSendCommand() throws Exception { + ObjectNode CloudReqObjectNode = initCloudReqObjectNode(); + byte[] outputByte = protocolAdapter.encode(CloudReqObjectNode); + System.out.println("cloudReq output:" + parseByte2HexStr(outputByte)); + return outputByte; + } + + /** + * 测试用例3:设备对平台命令的应答消息 有命令短id + *

+ *

+     * 设备应答消息:AA7201000107E0
+     *
+     * 
+     *
+     * @throws Exception
+     */
+    //@Test
+    public void testDecodeDeviceResponseIoT() throws Exception {
+        byte[] deviceRspByte = initDeviceRspByte();
+        ObjectNode objectNode = protocolAdapter.decode(deviceRspByte);
+        String str = objectNode.toString();
+        System.out.println(str);
+    }
+
+    /**
+     * 测试用例4:平台收到设备的上报数据后对设备的应答,如果不需要应答则返回null即可
+     * 
+     * {
+     * "identifier": "0",
+     * "msgType": "cloudRsp",
+     * "request": [AA,72,00,00,32,08,8D,03,20,62,33,99],
+     * "errcode": 0,
+     * "hasMore": 0
+     * }
+     *
+     * 
+     *
+     * @throws Exception
+     */
+    //@Test
+    public void testEncodeIoTResponseDevice() throws Exception {
+        byte[] deviceReqByte = initDeviceReqByte();
+        ObjectNode cloudRspObjectNode = initCloudRspObjectNode(deviceReqByte);
+        byte[] outputByte2 = protocolAdapter.encode(cloudRspObjectNode);
+        System.out.println("cloudRsp output:" + parseByte2HexStr(outputByte2));
+    }
+
+    public static String parseByte2HexStr(byte[] buf) {
+        if (null == buf) {
+            return null;
+        }
+
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < buf.length; i++) {
+            String hex = Integer.toHexString(buf[i] & 0xFF);
+            if (hex.length() == 1) {
+                hex = '0' + hex;
+            }
+            sb.append(hex.toUpperCase());
+        }
+        return sb.toString();
+    }
+
+    /*
+     * 初始化:设备数据上报码流
+     */
+    private static byte[] initDeviceReqByte() {
+        /**
+         * 本例入参: AA 72 00 00 32 08 8D 03 20 62 33 99
+         */
+        byte[] byteDeviceReq = new byte[12];
+        byteDeviceReq[0] = (byte) 0xAA;
+        byteDeviceReq[1] = (byte) 0x72;
+        byteDeviceReq[2] = (byte) 0x00;
+        byteDeviceReq[3] = (byte) 0x00;
+        byteDeviceReq[4] = (byte) 0x32;
+        byteDeviceReq[5] = (byte) 0x08;
+        byteDeviceReq[6] = (byte) 0x8D;
+        byteDeviceReq[7] = (byte) 0x03;
+        byteDeviceReq[8] = (byte) 0x20;
+        byteDeviceReq[9] = (byte) 0x62;
+        byteDeviceReq[10] = (byte) 0x33;
+        byteDeviceReq[11] = (byte) 0x99;
+        System.out.println(byteDeviceReq[5]);
+        return byteDeviceReq;
+    }
+
+    /*
+     * 初始化:平台向设备命令下发数据
+     */
+    private static ObjectNode initCloudReqObjectNode() {
+        ObjectMapper mapper = new ObjectMapper();
+        ObjectNode cloudReqObjectNode = mapper.createObjectNode();
+        ObjectNode paras = mapper.createObjectNode();
+        paras.put("value", "10");
+        cloudReqObjectNode.put("identifier", "123");
+        cloudReqObjectNode.put("msgType", "cloudReq");
+        cloudReqObjectNode.put("cmd", "SET_DEVICE_LEVEL");
+        cloudReqObjectNode.put("paras", paras);
+        cloudReqObjectNode.put("hasMore", 0);
+        cloudReqObjectNode.put("mid", 2016);
+        return cloudReqObjectNode;
+    }
+
+    private static byte[] getArray() {
+        byte[] input = new byte[9];
+        input[0] = 0x01;
+        input[1] = 0x27;
+        input[2] = 0x02;
+        input[3] = 0x12;
+        input[4] = 0x01;
+        input[5] = 0x31;
+        input[6] = 0x44;
+        input[7] = 0x55;
+        input[8] = 0x01;
+        /*cloudReqObjectNode.put("cmdid", (byte)0x01);
+        cloudReqObjectNode.put("pid", (byte) 0xAA);
+        cloudReqObjectNode.put("tid", (byte) 0x01);
+        cloudReqObjectNode.put("eventcnt", (byte) 0x01);
+        cloudReqObjectNode.put("verno", (byte) 0x01);
+        cloudReqObjectNode.put("eventstate", (byte) 0xE0);*/
+        return input;
+    }
+
+
+
+    /*
+     * 初始化:设备对平台的响应码流
+     */
+    private static byte[] initDeviceRspByte() {
+        /*
+         * 测试用例:有命令短mid 设备应答消息:AA7201000107E0
+         */
+        byte[] byteDeviceRsp = new byte[12];
+        byteDeviceRsp[0] = (byte) 0xAA;
+        byteDeviceRsp[1] = (byte) 0x72;
+        byteDeviceRsp[2] = (byte) 0x01;
+        byteDeviceRsp[3] = (byte) 0x00;
+        byteDeviceRsp[4] = (byte) 0x01;
+        byteDeviceRsp[5] = (byte) 0x07;
+        byteDeviceRsp[6] = (byte) 0xE0;
+        return byteDeviceRsp;
+    }
+
+    /*
+     * 初始化:平台对设备的应答数据
+     */
+    private static ObjectNode initCloudRspObjectNode(byte[] device2CloudByte) {
+
+        ObjectMapper mapper = new ObjectMapper();
+        ObjectNode cloudRspObjectNode = mapper.createObjectNode();
+        cloudRspObjectNode.put("identifier", "123");
+        cloudRspObjectNode.put("msgType", "cloudRsp");
+        // 设备上报的码流
+        cloudRspObjectNode.put("request", device2CloudByte);
+        cloudRspObjectNode.put("errcode", 0);
+        cloudRspObjectNode.put("hasMore", 0);
+        return cloudRspObjectNode;
+    }
+}
diff --git a/pom.xml b/pom.xml
index 6a1bd5a..4570ec0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,6 +11,7 @@
     
         zteits-job
         zteits-nbiot
+        VehicleDetector_FH_FH
     
 
 
\ No newline at end of file
diff --git a/zteits-nbiot/package/package-info.json b/zteits-nbiot/package/package-info.json
new file mode 100644
index 0000000..c7edb19
--- /dev/null
+++ b/zteits-nbiot/package/package-info.json
@@ -0,0 +1 @@
+{"specVersion":"1.0","fileName":"package.zip","version":"1.0.0","deviceType":"VehicleDetector","manufacturerName":"ZTEITS","model":"ZTEITS","description":"CIG codec plugin auto-generated by sps.","platform":"linux","packageType":"CIGPlugin","date":"Wed Aug 29 03:47:49 GMT 2018","ignoreList":[],"bundles":[{"bundleName":"VehicleDetector-ZTEITS-ZTEITS","bundleVersion":"1.0.0","priority":5,"fileName":"VehicleDetector-ZTEITS-ZTEITS-1.0.0.jar","bundleDesc":"","versionDesc":""}]}
\ No newline at end of file
diff --git a/zteits-nbiot/src/main/java/com/zteits/nbiot/decoder/ZteitsReportProcess.java b/zteits-nbiot/src/main/java/com/zteits/nbiot/decoder/ZteitsReportProcess.java
index 84d52f7..e22bc36 100644
--- a/zteits-nbiot/src/main/java/com/zteits/nbiot/decoder/ZteitsReportProcess.java
+++ b/zteits-nbiot/src/main/java/com/zteits/nbiot/decoder/ZteitsReportProcess.java
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 
+import java.io.UnsupportedEncodingException;
 import java.util.Arrays;
 
 public class ZteitsReportProcess {
@@ -306,8 +307,9 @@ public class ZteitsReportProcess {
     this.crc = paramInt;
   }
 
-  public ZteitsReportProcess(byte[] binaryData) {
-    this.factoryCode = Utilty.hexStringToString(binaryData, 0, 4);
+  public ZteitsReportProcess(byte[] binaryData) throws UnsupportedEncodingException {
+    this.factoryCode = new String(Arrays.copyOfRange(binaryData,0,4),"UTF-8");
+    //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);
diff --git a/zteits-nbiot/src/test/java/com/thrid/party/codec/demo/ProtocolServiceImplTest.java b/zteits-nbiot/src/test/java/com/thrid/party/codec/demo/ProtocolServiceImplTest.java
index 9cb91cd..5c8b5db 100644
--- a/zteits-nbiot/src/test/java/com/thrid/party/codec/demo/ProtocolServiceImplTest.java
+++ b/zteits-nbiot/src/test/java/com/thrid/party/codec/demo/ProtocolServiceImplTest.java
@@ -40,9 +40,15 @@ public class ProtocolServiceImplTest {
     public static void main(String[] args) throws Exception {
         IProtocolAdapter protocolAdapter = new ProtocolAdapterImpl();
         byte[] deviceReqByte = initDeviceReqByte();
+        ObjectNode objectNode = protocolAdapter.decode(deviceReqByte);
+        String str = objectNode.toString();
+        System.out.println(str);
+
+
+        /*byte[] deviceReqByte = initDeviceReqByte();
         ObjectNode cloudRspObjectNode = initCloudRspObjectNode(deviceReqByte);
         byte[] outputByte2 = protocolAdapter.encode(cloudRspObjectNode);
-        System.out.println("cloudRsp output:" + parseByte2HexStr(outputByte2));
+        System.out.println("cloudRsp output:" + parseByte2HexStr(outputByte2));*/
     }
 
     /**
--
libgit2 0.21.4