zhubaomin
2025-04-07 1a2b07f01ba4616fd9e894dddf474b56d020158c
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
package com.dy.common.mw.protocol;
 
public interface OnLine {
 
    /**
     * 对上线数据进行分析 
     * @param upBuf 上行数据
     * @return OnLineResult
     */
    OnLineResult parse(byte[] upBuf)throws Exception ;
    
    /**
     * 分析结果
     * @author Administrator
     */
    class OnLineResult{
        public int result ;//分析结果
        public String protocolName ;//协议名称
        public Short protocolVersion ;//协议版本号
        public String rtuAddr ;//Rtu地址
        public byte[] remoteData;//需要向Rtu回写的数据
        public OnLineResult(){
            result = OnLineAction_fail ;
            rtuAddr = null ;
            remoteData = null ;
        }
    }
    
    int OnLineAction_fail = 0; //分析上线数据失败,如提供的数据为null等原因
    int OnLineAction_success = 1; //分析上线数据成功,并能得到Rtu地址
    int OnLineAction_success_noMe = 2; //分析上线数据成功,识别出不是本协议数据
    int OnLineAction_success_response = 3; //分析上线数据成功,并需要向Rtu回写数据
    
}