Blame view

zteits-nbiot-fh/src/main/java/com/fh/party/CmdProcess.java 1.08 KB
2ceb8757   zhaowg   烽火-电信IOT插件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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;
      }
  
  }