| | |
| | | @Override |
| | | public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback) throws Exception { |
| | | ParseParamsForDownV1_0_1 para = (ParseParamsForDownV1_0_1) params ; |
| | | byte[] bs = this.doParse(para) ; |
| | | |
| | | MidResultToRtu midRs = new MidResultToRtu() ; |
| | | byte[] bs = this.doParse(midRs, para) ; |
| | | |
| | | midRs.rtuResultSendWebUrl = para.rtuResultSendWebUrl ;//rtu返回命令结果 发向目的地web URL |
| | | midRs.protocolName = para.protocolName ;//协议名称 |
| | | midRs.rtuAddr = para.rtuAddr ;//Rtu地址 |
| | |
| | | |
| | | /** |
| | | * 构造下行数据 |
| | | * @param midRs 参数 |
| | | * @param para 参数 |
| | | * @return 字节数组 |
| | | * @throws Exception 异常 |
| | | */ |
| | | public byte[] doParse(ParseParamsForDownV1_0_1 para) throws Exception { |
| | | public byte[] doParse(MidResultToRtu midRs, ParseParamsForDownV1_0_1 para) throws Exception { |
| | | CommonV1_0_1 commonV1_0_1 = new CommonV1_0_1() ; |
| | | byte[] bytes ; |
| | | byte[] bsHead = new byte[ProtocolConstantV206V1_0_0.lenHead2Code] ; |
| | |
| | | if(cvo.icCardNo == null){ |
| | | throw new Exception("虚拟IC卡编号不能为空") ; |
| | | } |
| | | String icCardNo = null ; |
| | | if(cvo.icCardNo.length() > 10){ |
| | | icCardNo = cvo.icCardNo.substring(cvo.icCardNo.length() - 10) ; |
| | | } |
| | | |
| | | String[] icCardNoGrp = CommonV1_0_1.dealIcCardNo(cvo.icCardNo) ; |
| | | if(icCardNoGrp[0] != null){ |
| | | midRs.param = icCardNoGrp[0] ; |
| | | } |
| | | byte[] bs = new byte[5] ; |
| | | ByteUtil.string2BCD_LE(bs, icCardNo, 0) ; |
| | | ByteUtil.string2BCD_LE(bs, icCardNoGrp[1], 0) ; |
| | | |
| | | bytes = ByteUtil.bytesMerge(bsHead, bs) ; |
| | | |
| | | GlCreate.createLen(bytes);//长度放字节数组中 |