Blame view

C5/xpadprotocal/src/main/java/com/sunvote/cmd/upload/UploadBaseCmd.java 1.19 KB
fac86401   孙向锦   初始化C5 Vote
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
45
46
47
  package com.sunvote.cmd.upload;
  
  import com.sunvote.cmd.BaseCmd;
  
  /**
   * Created by Elvis on 2017/8/14.
   * Email:Eluis@psunsky.com
   * Description:
   */
  
  public abstract class UploadBaseCmd extends BaseCmd {
  
      public static final byte REQUEST_CMD = 0x73 ;
      /**
       * TODO
       * @param bytes
       * @param length
       * @return
       */
      public static UploadBaseCmd parseRequest(byte[] bytes, int length){
          if(bytes[2] == 0x01){
              NumberingModeResult numberingModeResult = new NumberingModeResult();
              numberingModeResult.parseCmd(bytes);
              return numberingModeResult;
          }
          if(bytes[2] == 0x02) {
              SequenceFormatResult sequenceFormatResult = new SequenceFormatResult();
              sequenceFormatResult.parseCmd(bytes);
              return sequenceFormatResult;
          }
          return null;
      }
  
      public static final byte RESPONSE_CMD = (byte) 0xF3;
  
      /**
       * TODO
       * @param bytes
       * @param length
       * @return
       */
      public static UploadBaseCmd parseResponse(byte[] bytes, int length){
          TransferResult transferResult = new TransferResult();
          transferResult.parseCmd(bytes);
          return transferResult;
      }
  }