| | |
| | | @Override |
| | | public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { |
| | | ParseParamsForUpV2 para = (ParseParamsForUpV2)params ; |
| | | int bsLen = new CommonV2().parseDataLen(para.upBuffer) ; |
| | | int bsLen = new CommonV2().parseDataLen4P206(para.upBuffer) ; |
| | | if(bsLen > 0){ |
| | | this.doParse(para.upBuffer, |
| | | bsLen, |
| | |
| | | confirmCommand.isQuickSend = true ; |
| | | } |
| | | |
| | | callback.callback(midRs.reportOrResponse_trueOrFalse); |
| | | callback.callback(midRs.reportOrResponse_trueOrFalse, para.data.subData==null?null:((DataV2)(para.data.subData)).subData); |
| | | if(para.data != null && para.data.getSubData() != null){ |
| | | Object subData = para.data.getSubData() ; |
| | | Object subData = ((DataV2)para.data.getSubData()).subData ; |
| | | if(subData instanceof DataCd83OpenVo){ |
| | | callback.notify(new ValveStateInfo(true)); |
| | | }else if(subData instanceof DataCd83CloseVo){ |
| | | callback.notify(new ValveStateInfo(false)); |
| | | } |
| | | } |
| | | return new MidResult[]{midRs, confirmCommand} ; |
| | | return new MidResult[]{confirmCommand, midRs} ; |
| | | } |
| | | /** |
| | | * 执行分析 |
| | |
| | | |
| | | short index = ProtocolConstantV206V2.dataIndex + 1 ; |
| | | //累计流量:5字节BCD码,取值范围0~99999999.99,单位为m3。 |
| | | int tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 4) ; |
| | | cdData.totalAmount = tpInt/100.0 ; |
| | | long tpLong = ByteUtil.BCD2Long_LE(bs, index, index + 4) ; |
| | | cdData.totalAmount = tpLong/100.0 ; |
| | | |
| | | index += 5 ; |
| | | //用水户号数据格式:8字节低位在前高位在后。 |
| | | cdData.icCardNo = GlParse.parseIcCardNo(bs, index) ; |
| | | if(ByteUtil.bytesIsAll0xFF(bs, index, 8)){ |
| | | throw new Exception("IC卡号数据格式错误,8字节全部为0xFF,舍弃数据") ; |
| | | }cdData.icCardNo = GlParse.parseIcCardNo(bs, index) ; |
| | | |
| | | index += 8 ; |
| | | //IC卡号格式:4字节HEX码低位在前高位在后。 |
| | | if(ByteUtil.bytesIsAll0xFF(bs, index, 4)){ |
| | | throw new Exception("IC地址数据格式错误,4字节全部为0xFF,舍弃数据") ; |
| | | } |
| | | cdData.icCardAddr = ByteUtil.bytes2Hex_LE(bs, false, index, 4) ; |
| | | |
| | | index += 4 ; |
| | | //用水户余额:用户余额4字节BCD码,取值范围0.00~999999.99,单位为元。 |
| | | tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 3) ; |
| | | int tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 3) ; |
| | | cdData.remainMoney = tpInt/100.0 ; |
| | | |
| | | index += 4 ; |
| | |
| | | |
| | | short index = ProtocolConstantV206V2.dataIndex + 1 ; |
| | | //累计流量:5字节BCD码,取值范围0~9999999999,单位为m3。 |
| | | int tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 4) ; |
| | | cdData.totalAmount = tpInt/100.0 ; |
| | | long tpLong = ByteUtil.BCD2Long_LE(bs, index, index + 4) ; |
| | | cdData.totalAmount = tpLong/100.0 ; |
| | | |
| | | index += 5 ; |
| | | //用水户号数据格式:8字节低位在前高位在后。 |
| | | if(ByteUtil.bytesIsAll0xFF(bs, index, 8)){ |
| | | throw new Exception("IC卡号数据格式错误,8字节全部为0xFF,舍弃数据") ; |
| | | } |
| | | cdData.icCardNo = GlParse.parseIcCardNo(bs, index) ; |
| | | |
| | | index += 8 ; |
| | | //IC卡号格式:4字节HEX码低位在前高位在后。 |
| | | if(ByteUtil.bytesIsAll0xFF(bs, index, 4)){ |
| | | throw new Exception("IC地址数据格式错误,4字节全部为0xFF,舍弃数据") ; |
| | | } |
| | | cdData.icCardAddr = ByteUtil.bytes2Hex_LE(bs, false, index, 4) ; |
| | | |
| | | index += 4 ; |
| | | //用水户余额:用户余额4字节BCD码,取值范围0.00~999999.99,单位为元。 |
| | | tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 3) ; |
| | | cdData.remainMoney = tpInt/100.0 ; |
| | | tpLong = ByteUtil.BCD2Long_LE(bs, index, index + 3) ; |
| | | cdData.remainMoney = tpLong/100.0 ; |
| | | |
| | | index += 4 ; |
| | | //用水户用水开始时间:6字节BCD码,顺序是年月日时分秒,其中公元年=2000+年。 |
| | |
| | | |
| | | index += 6 ; |
| | | //用水户本次用水量:累计流量5字节BCD码,取值范围0~9999999999,单位为m3。 |
| | | tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 4) ; |
| | | cdData.thisAmount = tpInt/100.0 ; |
| | | tpLong = ByteUtil.BCD2Long_LE(bs, index, index + 4) ; |
| | | cdData.thisAmount = tpLong/100.0 ; |
| | | |
| | | index += 5 ; |
| | | //用水户本次消费金额:用户余额4字节BCD码,取值范围0.00~999999.99,单位为元。 |
| | | tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 3) ; |
| | | cdData.thisMoney = tpInt/100.0 ; |
| | | tpLong = ByteUtil.BCD2Long_LE(bs, index, index + 3) ; |
| | | cdData.thisMoney = tpLong/100.0 ; |
| | | |
| | | index += 4 ; |
| | | //用水户本次用水时长:用水时长2字节BCD码,取值范围0~9999,单位为分钟。 |
| | | tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | int tpInt = ByteUtil.BCD2Int_LE(bs, index, index + 1) ; |
| | | cdData.thisTime = tpInt; |
| | | |
| | | index += 2 ; |
| | |
| | | Data data = new Data() ; |
| | | data.setSubData(new DataV2()) ; |
| | | |
| | | int bsLen = new CommonV2().parseDataLen(bs) ; |
| | | int bsLen = new CommonV2().parseDataLen4P206(bs) ; |
| | | if(bsLen > 0){ |
| | | try { |
| | | obj.doParse(bs, |