| | |
| | | import com.dy.common.mw.protocol.p206V202404.ProtocolConstantV206V202404; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd80Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd81Vo; |
| | | import com.dy.common.mw.protocol.p206V202404.upVos.DataCd93_A3Vo; |
| | | import com.dy.common.util.ByteUtil; |
| | | import com.dy.common.util.ByteUtilUnsigned; |
| | | import org.apache.logging.log4j.LogManager; |
| | |
| | | vo.alarmEleLowVolt = (byte)(b & 0x20) ; |
| | | vo.stateIcEnable = (byte)(b & 0x40) ; |
| | | } |
| | | /** |
| | | * 分析状态与报警 |
| | | * @param bs |
| | | * @param index |
| | | * @return |
| | | */ |
| | | public static void parseAlarmAndState(byte[] bs, int index, DataCd93_A3Vo vo){ |
| | | byte b = bs[index] ; |
| | | vo.statePump = (byte)(b & 0x1) ; |
| | | vo.alarmWaterRemain = (byte)(b & 0x2) ; |
| | | vo.alarm0WaterRemain = (byte)(b & 0x4) ; |
| | | vo.alarmExceedYear = (byte)(b & 0x8) ; |
| | | vo.alarmWaterMeterFault = (byte)(b & 0x10) ; |
| | | vo.alarmSteal = (byte)(b & 0x20) ; |
| | | vo.alarmWaterMeterBreak = (byte)(b & 0x40) ; |
| | | vo.alarmEleMeterFault = (byte)(b & 0x80) ; |
| | | |
| | | index++ ; |
| | | b = bs[index] ; |
| | | vo.alarm0MoneyRemain = (byte)(b & 0x1) ; |
| | | vo.alarmInnerDoor = (byte)(b & 0x2) ; |
| | | vo.alarmOuterDoor = (byte)(b & 0x4) ; |
| | | vo.alarmEleMiss = (byte)(b & 0x8) ; |
| | | vo.alarmEleExceed = (byte)(b & 0x10) ; |
| | | vo.alarmEleLowVolt = (byte)(b & 0x20) ; |
| | | vo.stateIcEnable = (byte)(b & 0x40) ; |
| | | } |
| | | |
| | | public static String parseTp(byte[] bs, short index){ |
| | | String dt = "" ; |
| | |
| | | * @throws Exception |
| | | */ |
| | | public static void parseCd80And5B(byte[] bs, DataCd80Vo cdData) throws Exception{ |
| | | |
| | | int index = ProtocolConstantV206V202404.dataIndex ; |
| | | cdData.controllerType = ByteUtil.bytes2Hex(bs, false, index, 1) ; |
| | | |
| | | index++ ; |
| | | cdData.projectNo = 0 + bs[index]; |
| | | cdData.projectNo = (int)bs[index]; |
| | | |
| | | index++ ; |
| | | cdData.useWaterType = bs[index]; |
| | |
| | | cdData.csq = ByteUtil.BCD2Int_BE(bs, index, index) ; |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分析功能93、A3和85数据 |
| | | * @param bs |
| | | * @param cdData |
| | | * @throws Exception |
| | | */ |
| | | public static void parseCd93A3And85(byte[] bs, DataCd93_A3Vo cdData) throws Exception { |
| | | int index = ProtocolConstantV206V202404.dataIndex ; |
| | | cdData.controllerType = ByteUtil.bytes2Hex(bs, false, index, 1) ; |
| | | |
| | | index++ ; |
| | | cdData.projectNo = (int)bs[index]; |
| | | |
| | | index ++ ; |
| | | cdData.opResult = bs[index]; |
| | | |
| | | index ++ ; |
| | | cdData.opType = bs[index]; |
| | | |
| | | index++ ; |
| | | cdData.icCardAddr = ByteUtil.bytes2Hex(bs, false, index, 4) ; |
| | | |
| | | index += 8 ; |
| | | cdData.icCardNo = GlParse.parseIcCardNo(bs, index, 6, 2) ; |
| | | |
| | | index += 8 ; |
| | | cdData.orderNo = ByteUtil.BCD2String_BE(bs, index, index + 7) ; |
| | | |
| | | index ++ ; |
| | | String mm = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | index ++ ; |
| | | String HH = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | index ++ ; |
| | | String dd = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | index ++ ; |
| | | String MM = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | cdData.startDt = MM + "月" + dd + "日" + HH + "时" + mm + "分" ; |
| | | |
| | | index ++ ; |
| | | mm = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | index ++ ; |
| | | HH = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | index ++ ; |
| | | dd = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | index ++ ; |
| | | MM = ByteUtil.BCD2String_LE(bs, index, index) ; |
| | | cdData.endDt = MM + "月" + dd + "日" + HH + "时" + mm + "分" ; |
| | | |
| | | index ++ ; |
| | | cdData.waterTotalAmount = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.eleTotalAmount = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.moneyRemain = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.waterRemain = ByteUtil.BCD2Int_BE(bs, index, index + 4)/100.0D ; |
| | | |
| | | index += 5 ; |
| | | cdData.thisEle = ByteUtil.BCD2Int_BE(bs, index, index + 3)/100.0D ; |
| | | |
| | | index += 4 ; |
| | | cdData.thisWater = ByteUtil.BCD2Int_BE(bs, index, index + 3)/100.0D ; |
| | | |
| | | index += 4 ; |
| | | cdData.thisMoney = ByteUtil.BCD2Int_BE(bs, index, index + 3)/100.0D ; |
| | | |
| | | index += 4 ; |
| | | cdData.thisDuration = ByteUtil.BCD2Int_BE(bs, index, index + 1) ; |
| | | |
| | | index += 2 ; |
| | | GlParse.parseAlarmAndState(bs, index, cdData) ; |
| | | } |
| | | } |