| package com.dy.common.mw.protocol.p206V2; | 
|   | 
| import com.dy.common.mw.protocol.AnnotationOnLine; | 
| import com.dy.common.mw.protocol.OnLine; | 
| import com.dy.common.mw.protocol.p206V1.ProtocolConstantV206V1; | 
|   | 
| @AnnotationOnLine( | 
|         enable = true, | 
|         protocolName = ProtocolConstantV206V2.protocolName, | 
|         priority = ProtocolConstantV206V2.priority) | 
| @SuppressWarnings("unused") | 
| public class OnLineV2 implements OnLine{ | 
|   | 
|     /** | 
|      * 对上线数据进行分析  | 
|      * @param upBuf 上行数据 | 
|      * @return | 
|      */ | 
|     @Override | 
|     public OnLineResult parse(byte[] upBuf)throws Exception { | 
|         OnLineResult olr = new OnLineResult() ; | 
|         CommonV2 cp = new CommonV2() ; | 
|         Boolean[] isThis_p206Pgu = cp.isThisProtocolHead(upBuf) ; | 
|         if(isThis_p206Pgu == null || isThis_p206Pgu.length != 2){ | 
|             //出错 | 
|             olr.result = OnLine.OnLineAction_fail ; | 
|             olr.rtuAddr = null ; | 
|         }else if(!isThis_p206Pgu[0].booleanValue()){ | 
|             //不是本协议数据 | 
|             olr.result = OnLine.OnLineAction_success_noMe ; | 
|             olr.rtuAddr = null ; | 
|         }else{ | 
|             //是本协议数据 | 
|             olr.result = OnLine.OnLineAction_success ; | 
|             olr.rtuAddr = cp.parseRtuAddr(upBuf) ; | 
|             olr.protocolName = ProtocolConstantV206V2.protocolName ; | 
|             olr.protocolVersion = cp.parseVersion(upBuf) ; | 
|         } | 
|         return olr; | 
|     } | 
|   | 
| } |