liurunyu
2023-11-18 c1ddfd71223c1a7d704b6f21b669fbfcb37adc82
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
48
49
50
51
52
53
54
package com.dy.common.mw.protocol.pMeterV1_0_1;
 
public class ProtocolConstantV1_0_1 {
 
    public static final String version = "1.0.1" ;
    public static final Byte versionByte = 101 ;
    
    /**
     * 注解相关
     */
    public static final String protocolName = "meterV1_0_1" ;
    public static final int priority = 1 ;//优先级
    /**
     * RTU上线数据(上线后第一包数据)最小长度,设置该属性以备进行完整性检查,
     * 即断包检查,使尽可能收全上线数据(取值范围1-100)
     */
    public static final int onLineDataMinLength = 30 ;//采用阀控回执(其长度最短)的字节数
 
    /**
     * RTU上报数据的头部最小长度,上报数据中,取这个最小长度的部分数据中,
     * 要一定包含数据帧长度,以备取出数据帧长度来,进行完整性检查,
     * 即断包与粘包检查(取值范围0-100,其中取值为0时,表示headMinLength数据无作用,由协议实现来控制)
     */
    public static final int headMinLength = 3 ;
    
    
    //帧起始
    public static final byte P_Head_Byte = (byte)0x68 ; 
    public static final byte P_Tail_Byte = (byte)0x16 ; 
    
    public static final String P_Head_Hex = "68" ; 
    public static final String P_Tail_Hex = "16" ; 
    
    public static final byte downBsHeadLen = 21 ;//下行数据头部(开始至功能码所在字节)
    public static final byte downBsTailLen = 2 ;//下行数据尾部(校验和所在字节至最后)
 
    /**
     * 所在字节数组的位置(下标)
     */
    public static final int dataLenIndex_start = 1 ;//帧长度所在 字节数组起始下标
    public static final int dataLenIndex_end = 2 ;//帧长度所在 字节数组截止下标
    public static final int versionIndex = 3 ;//版本号字节数组下标
    public static final int rtuAddrIndex_start = 4 ;//通讯模块 IMEI 起始字节数组下标
    public static final int rtuAddrIndex_end = 11 ;//通讯模块 IMEI 截止字节数组下标
    public static final int meterNoIndex_start = 12 ;//表号起始字节数组下标
    public static final int meterNoIndex_end = 19 ;//表号截止字节数组下标
    public static final int codeIndex = 20 ;//功能码字节数组下标
    //public static final int dtIndex_start = 13 ;////日期开始字节数组下标
    //public static final int dtIndex_end = 18 ;////日期截止字节数组下标
    //public static final int signalIndex_start = 28 ;//信号强度开始字节数组下标
    //public static final int signalIndex_end = 29 ;//信号强度截止字节数组下标
 
 
}