liurunyu
2025-03-21 fb50c6c8111fffd16091ce25d5d389ea3fcc560f
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
package com.dy.common.mw.protocol;
 
public class AnnotationPrefixedDataAvailableVo {
    /**
     * 处理完整性检查的类
     */
    public Class<?> clazz ;
    /**
     * 所属协议名称
     */
    public String protocolName ; 
    /**
     * 所属协议版本号
     */
    public short protocolVersion ;
    /**
     * 为优先级(从1开始,最小为1,各协议间优先级相差1),数字越小级别越高。
     * 若有多个协议,各个协议的上线处理类以优先级进行排序,优先级高的先处理上线数据。
     * 数值与AnnotationOnLine的priority相等
     */
    public int priority ; 
    /**
     * RTU上线数据(上线后第一包数据)最小长度,设置该属性以备进行完整性检查,
     * 即断包检查,使尽可能收全上线数据(取值范围1-100)
     */
    public int onLineDataMinLength ; 
    /**
     * RTU上报数据的头部最小长度,上报数据的这个最小长度的部分数据,
     * 一定包含数据长度,以备取出数据长度来,设置该属性以备进行完整性检查,
     * 即断包与粘包检查(取值范围0-100,其中取值为0时,表示headMinLength数据无作用,由协议实现来控制)
     */
    public int headMinLength ; 
    
    /**
     * 非法数据长度
     * 例如:数据头部是正确的,但合法数据结尾总不出现,认为此数据垃圾数据
     */
    public int errorMaxLength ;
    
    public AnnotationPrefixedDataAvailableVo(Class<?> clazz, String protocolName, short protocolVersion, int priority, int onLineDataMinLength, int headMinLength, int errorMaxLength){
        this.clazz = clazz ;
        this.protocolName = protocolName ;
        this.protocolVersion = protocolVersion ;
        this.priority = priority ;
        this.onLineDataMinLength = onLineDataMinLength ;
        this.headMinLength = headMinLength ;
        this.errorMaxLength = errorMaxLength ;
    }
 
}