| | |
| | | private static final Logger log = LogManager.getLogger(GlParse.class); |
| | | |
| | | public static DataAlarmVo parseAlarm(byte[] bs, short index){ |
| | | /* |
| | | 11011111 (DF) + 11111001 (F9) |
| | | 报警: |
| | | 蓄电池电压:报警 |
| | | 漏损:报警 |
| | | 仪表:报警 |
| | | 阀门:报警 |
| | | */ |
| | | DataAlarmVo avo = new DataAlarmVo() ; |
| | | byte b = bs[index] ; |
| | | index++ ; |
| | | avo.batteryVolt = (byte)(b & 0x2 >> 1) ; |
| | | avo.meter = (byte)(b & 0x20 >> 5) ; |
| | | byte b = bs[index + 1] ; |
| | | avo.batteryVolt = (byte)((b & 0x2) >> 1) ; |
| | | avo.meter = (byte)((b & 0x20) >> 5) ; |
| | | |
| | | b = bs[index] ; |
| | | avo.loss = (byte)(b & 0x2 >> 1) ; |
| | | avo.valve = (byte)(b & 0x4 >> 2) ; |
| | | avo.loss = (byte)((b & 0x2) >> 1) ; |
| | | avo.valve = (byte)((b & 0x4) >> 2) ; |
| | | return avo ; |
| | | } |
| | | |
| | | public static DataStateVo parseState(byte[] bs, short index){ |
| | | DataStateVo avo = new DataStateVo() ; |
| | | byte b = bs[index] ; |
| | | index++ ; |
| | | avo.icCard = (byte)(b & 0x4 >> 2) ; |
| | | avo.working = (byte)(b & 0x10 >> 4) ; |
| | | avo.powerType = (byte)(b & 0x40 >> 6) ; |
| | | byte b = bs[index + 1] ; |
| | | avo.icCard = (byte)((b & 0x4) >> 2) ; |
| | | avo.working = (byte)((b & 0x10) >> 4) ; |
| | | avo.powerType = (byte)((b & 0x40) >> 6) ; |
| | | return avo ; |
| | | } |
| | | |