| | |
| | | import com.dy.common.mw.protocol.*; |
| | | import com.dy.common.util.DateTime; |
| | | |
| | | @AnnotationDriver(enable = true, name= ProtocolConstantV206V2.protocolName) |
| | | @AnnotationDriver(enable = true, |
| | | name= ProtocolConstantV206V2.protocolName, |
| | | version= ProtocolConstantV206V2.protocolVer) |
| | | public class DriverV2 extends Driver { |
| | | |
| | | private static String scanRootPackage = "com.dy.common.mw.protocol.p206V2" ; |
| | |
| | | Short protocolVersion = null ; |
| | | try{ |
| | | CommonV2 cp = new CommonV2() ; |
| | | Boolean p206TrueUgFalse = cp.protocolType_p206TrueUgFalse(upBuffer) ; |
| | | //到此处了,p206TrueUgFalse不可能为空了 |
| | | cp.checkTail(upBuffer) ; |
| | | String crcStr = cp.checkCrc_str(upBuffer) ; |
| | | String crcStr = cp.checkCrc_str(upBuffer, p206TrueUgFalse) ; |
| | | if(crcStr != null){ |
| | | return new MidResult[]{(new MidResultError(ProtocolConstantV206V2.protocolName, rtuAddr, "严重错误,上行数据CRC检查失败," + crcStr, null))} ; |
| | | } |
| | | protocolVersion = cp.parseVersion(upBuffer) ; |
| | | upCode = cp.parseCode(upBuffer) ; |
| | | upCode = cp.parseCode(upBuffer, p206TrueUgFalse) ; |
| | | if(upCode == null){ |
| | | return new MidResult[]{(new MidResultError(ProtocolConstantV206V2.protocolName, rtuAddr, "严重错误,未能从上行数据中解析出功能码!", null))} ; |
| | | } |